/** @file GalioDebug.h
 *
 * Copyright (C) Espial Limited 2014 - Company confidential - All rights reserved.
 *
 */

#ifndef GalioDebug_h
#define GalioDebug_h

#if ENABLE(RMAI)

#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
#include "ScriptCallStack.h"
#include "Console.h"

namespace WebCore {

class ScriptArguments;
class ScriptCallStack;
    
class GalioDebug : public RefCounted<GalioDebug> {
public:

    static PassRefPtr<GalioDebug> create(PassRefPtr<Console> console);

    int flexAllocated() const;
    int flexFree() const;
    int heapFree() const;
    int heapAllocated() const;

    void log(PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack> = nullptr);
    void quit( int rc );
    void dumpAllDocuments();
    void dumpAllViews();
    void dumpAllDOMObjects();
    void gc( bool debug = false);
    String getBacktrace( int level = 0);
    String getWaferActiveList();
    String getWaferVisibleList();
    void enableDebug( const String & area );
    void disableDebug( const String & area );
    void resetDebug( const String & area );

protected:
    GalioDebug(PassRefPtr<Console> console);

private:
    mutable RefPtr<Console> m_console;
};

} // namespace WebCore

#endif // ENABLE(RMAI)

#endif // GalioDebug_h
