/*
- * Copyright (c) 2008, Google Inc. All rights reserved.
+ * Copyright (c) 2008, 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
#define ScriptCallStack_h
#include "ScriptCallFrame.h"
-#include "ScriptState.h"
#include <wtf/Noncopyable.h>
-#include <wtf/RefPtr.h>
-
-namespace JSC {
- class ExecState;
- class JSValue;
-}
+#include <wtf/Vector.h>
namespace WebCore {
- class InspectorArray;
+class InspectorArray;
+
+class ScriptCallStack : public Noncopyable {
+public:
+ static const size_t maxCallStackSizeToCapture = 200;
- class ScriptCallStack : public Noncopyable {
- public:
- ScriptCallStack(JSC::ExecState*, unsigned skipArgumentCount = 0);
- ~ScriptCallStack();
+ ScriptCallStack(Vector<ScriptCallFrame>&);
+ ~ScriptCallStack();
- ScriptState* state() const { return m_exec; }
- ScriptState* globalState() const { return m_exec->lexicalGlobalObject()->globalExec(); }
- // frame retrieval methods
- const ScriptCallFrame &at(unsigned);
- unsigned size();
- static bool stackTrace(int, const RefPtr<InspectorArray>&);
+ const ScriptCallFrame &at(size_t);
+ size_t size();
+ static bool stackTrace(int, const RefPtr<InspectorArray>&);
- private:
- void initialize();
- bool m_initialized;
+ bool isEqual(ScriptCallStack*) const;
+ PassRefPtr<InspectorArray> buildInspectorObject() const;
- JSC::ExecState* m_exec;
- Vector<ScriptCallFrame> m_frames;
- JSC::JSFunction* m_caller;
- };
+private:
+ Vector<ScriptCallFrame> m_frames;
+};
} // namespace WebCore