| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef JavaScriptCallFrame_h | 31 #ifndef JavaScriptCallFrame_h |
| 32 #define JavaScriptCallFrame_h | 32 #define JavaScriptCallFrame_h |
| 33 | 33 |
| 34 | 34 |
| 35 #include "bindings/core/v8/ScopedPersistent.h" | 35 #include "bindings/core/v8/ScopedPersistent.h" |
| 36 #include "bindings/core/v8/ScriptState.h" | 36 #include "bindings/core/v8/ScriptState.h" |
| 37 #include "bindings/core/v8/ScriptWrappable.h" | |
| 38 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 39 #include "wtf/text/WTFString.h" | 38 #include "wtf/text/WTFString.h" |
| 40 #include <v8.h> | 39 #include <v8.h> |
| 41 | 40 |
| 42 namespace blink { | 41 namespace blink { |
| 43 | 42 |
| 44 class JavaScriptCallFrame : public RefCountedWillBeGarbageCollectedFinalized<Jav
aScriptCallFrame>, public ScriptWrappable { | 43 class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> { |
| 45 DEFINE_WRAPPERTYPEINFO(); | |
| 46 public: | 44 public: |
| 47 static PassRefPtrWillBeRawPtr<JavaScriptCallFrame> create(v8::Local<v8::Cont
ext> debuggerContext, v8::Local<v8::Object> callFrame) | 45 static PassRefPtrWillBeRawPtr<JavaScriptCallFrame> create(v8::Local<v8::Cont
ext> debuggerContext, v8::Local<v8::Object> callFrame) |
| 48 { | 46 { |
| 49 return adoptRefWillBeNoop(new JavaScriptCallFrame(debuggerContext, callF
rame)); | 47 return adoptRefWillBeNoop(new JavaScriptCallFrame(debuggerContext, callF
rame)); |
| 50 } | 48 } |
| 51 ~JavaScriptCallFrame(); | 49 ~JavaScriptCallFrame(); |
| 52 DECLARE_TRACE(); | |
| 53 | 50 |
| 54 JavaScriptCallFrame* caller(); | 51 JavaScriptCallFrame* caller(); |
| 55 | 52 |
| 56 int sourceID() const; | 53 int sourceID() const; |
| 57 int line() const; | 54 int line() const; |
| 58 int column() const; | 55 int column() const; |
| 59 String scriptName() const; | 56 String scriptName() const; |
| 60 String functionName() const; | 57 String functionName() const; |
| 61 int functionLine() const; | 58 int functionLine() const; |
| 62 int functionColumn() const; | 59 int functionColumn() const; |
| 63 | 60 |
| 64 v8::Local<v8::Value> scopeChain() const; | 61 v8::Local<v8::Value> scopeChain() const; |
| 65 int scopeType(int scopeIndex) const; | 62 int scopeType(int scopeIndex) const; |
| 66 v8::Local<v8::Value> thisObject() const; | 63 v8::Local<v8::Value> thisObject() const; |
| 67 String stepInPositions() const; | 64 String stepInPositions() const; |
| 68 bool isAtReturn() const; | 65 bool isAtReturn() const; |
| 69 v8::Local<v8::Value> returnValue() const; | 66 v8::Local<v8::Value> returnValue() const; |
| 70 | 67 |
| 71 v8::Local<v8::Value> evaluateWithExceptionDetails(v8::Local<v8::Value> expre
ssion, v8::Local<v8::Value> scopeExtension); | 68 v8::Local<v8::Value> evaluateWithExceptionDetails(v8::Local<v8::Value> expre
ssion, v8::Local<v8::Value> scopeExtension); |
| 72 v8::MaybeLocal<v8::Value> restart(); | 69 v8::MaybeLocal<v8::Value> restart(); |
| 73 v8::MaybeLocal<v8::Value> setVariableValue(int scopeNumber, v8::Local<v8::Va
lue> variableName, v8::Local<v8::Value> newValue); | 70 v8::MaybeLocal<v8::Value> setVariableValue(int scopeNumber, v8::Local<v8::Va
lue> variableName, v8::Local<v8::Value> newValue); |
| 74 | 71 |
| 75 static v8::Local<v8::Object> createExceptionDetails(v8::Isolate*, v8::Local<
v8::Message>); | 72 static v8::Local<v8::Object> createExceptionDetails(v8::Isolate*, v8::Local<
v8::Message>); |
| 76 | 73 |
| 74 // FIXME: store this template in per isolate data |
| 75 void setWrapperTemplate(v8::Local<v8::FunctionTemplate> wrapperTemplate, v8:
:Isolate* isolate) { m_wrapperTemplate.Reset(isolate, wrapperTemplate); } |
| 76 v8::Local<v8::FunctionTemplate> wrapperTemplate(v8::Isolate* isolate) { retu
rn v8::Local<v8::FunctionTemplate>::New(isolate, m_wrapperTemplate); } |
| 77 |
| 77 private: | 78 private: |
| 78 JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Ob
ject> callFrame); | 79 JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Ob
ject> callFrame); |
| 79 | 80 |
| 80 int callV8FunctionReturnInt(const char* name) const; | 81 int callV8FunctionReturnInt(const char* name) const; |
| 81 String callV8FunctionReturnString(const char* name) const; | 82 String callV8FunctionReturnString(const char* name) const; |
| 82 | 83 |
| 83 v8::Isolate* m_isolate; | 84 v8::Isolate* m_isolate; |
| 84 RefPtrWillBeMember<JavaScriptCallFrame> m_caller; | 85 RefPtrWillBeMember<JavaScriptCallFrame> m_caller; |
| 85 ScopedPersistent<v8::Context> m_debuggerContext; | 86 ScopedPersistent<v8::Context> m_debuggerContext; |
| 86 ScopedPersistent<v8::Object> m_callFrame; | 87 ScopedPersistent<v8::Object> m_callFrame; |
| 88 v8::Global<v8::FunctionTemplate> m_wrapperTemplate; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace blink | 91 } // namespace blink |
| 90 | 92 |
| 91 #endif // JavaScriptCallFrame_h | 93 #endif // JavaScriptCallFrame_h |
| OLD | NEW |