#ifndef ScriptProfiler_h
#define ScriptProfiler_h
#include "bindings/v8/ScriptHeapSnapshot.h"
#include "bindings/v8/ScriptState.h"
#include "core/inspector/ScriptProfile.h"
#include "wtf/Forward.h"
#include "wtf/PassRefPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class ExternalStringVisitor;
class WrappedNodeVisitor;
class Page;
class ScriptObject;
class ScriptValue;
class WorkerGlobalScope;
class ScriptProfiler {
WTF_MAKE_NONCOPYABLE(ScriptProfiler);
public:
class HeapSnapshotProgress {
public:
virtual ~HeapSnapshotProgress() { }
virtual void Start(int totalWork) = 0;
virtual void Worked(int workDone) = 0;
virtual void Done() = 0;
virtual bool isCanceled() = 0;
};
class OutputStream {
public:
virtual ~OutputStream() { }
virtual void write(const uint32_t* chunk, const int size) = 0;
};
static void collectGarbage();
static ScriptObject objectByHeapObjectId(unsigned id);
static unsigned getHeapObjectId(const ScriptValue&);
static void clearHeapObjectIds();
static void setSamplingInterval(int intervalUs);
static void start(const String& title);
static PassRefPtr<ScriptProfile> stop(const String& title);
static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String& title, HeapSnapshotProgress*);
static void startTrackingHeapObjects(bool trackAllocations);
static void stopTrackingHeapObjects();
static unsigned requestHeapStatsUpdate(OutputStream*);
static void initialize();
static void visitNodeWrappers(WrappedNodeVisitor*);
static HashMap<String, double>* currentProfileNameIdleTimeMap();
static void setIdle(bool isIdle);
};
}
#endif