| 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 26 matching lines...) Expand all Loading... |
| 37 #include <v8-debug.h> | 37 #include <v8-debug.h> |
| 38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 39 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
| 40 #include "wtf/PassOwnPtr.h" | 40 #include "wtf/PassOwnPtr.h" |
| 41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 42 #include "wtf/text/StringHash.h" | 42 #include "wtf/text/StringHash.h" |
| 43 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 class ScriptController; |
| 47 class ScriptDebugListener; | 48 class ScriptDebugListener; |
| 48 class ScriptObject; | 49 class ScriptObject; |
| 49 class ScriptState; | 50 class ScriptState; |
| 50 class ScriptValue; | 51 class ScriptValue; |
| 51 | 52 |
| 52 class ScriptDebugServer { | 53 class ScriptDebugServer { |
| 53 WTF_MAKE_NONCOPYABLE(ScriptDebugServer); | 54 WTF_MAKE_NONCOPYABLE(ScriptDebugServer); |
| 54 public: | 55 public: |
| 55 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a
ctualLineNumber, int* actualColumnNumber); | 56 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a
ctualLineNumber, int* actualColumnNumber); |
| 56 void removeBreakpoint(const String& breakpointId); | 57 void removeBreakpoint(const String& breakpointId); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 void setPauseOnNextStatement(bool pause); | 69 void setPauseOnNextStatement(bool pause); |
| 69 void breakProgram(); | 70 void breakProgram(); |
| 70 void continueProgram(); | 71 void continueProgram(); |
| 71 void stepIntoStatement(); | 72 void stepIntoStatement(); |
| 72 void stepOverStatement(); | 73 void stepOverStatement(); |
| 73 void stepOutOfFunction(); | 74 void stepOutOfFunction(); |
| 74 | 75 |
| 75 bool setScriptSource(const String& sourceID, const String& newContent, bool
preview, String* error, ScriptValue* newCallFrames, ScriptObject* result); | 76 bool setScriptSource(const String& sourceID, const String& newContent, bool
preview, String* error, ScriptValue* newCallFrames, ScriptObject* result); |
| 76 void updateCallStack(ScriptValue* callFrame); | 77 void updateCallStack(ScriptValue* callFrame); |
| 77 | 78 |
| 78 void setScriptPreprocessor(const String& preprocessorBody); | |
| 79 | |
| 80 class Task { | 79 class Task { |
| 81 public: | 80 public: |
| 82 virtual ~Task() { } | 81 virtual ~Task() { } |
| 83 virtual void run() = 0; | 82 virtual void run() = 0; |
| 84 }; | 83 }; |
| 85 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*); | 84 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*); |
| 86 void runPendingTasks(); | 85 void runPendingTasks(); |
| 87 | 86 |
| 88 bool isPaused(); | 87 bool isPaused(); |
| 89 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; } | 88 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; } |
| 90 | 89 |
| 91 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); | 90 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); |
| 92 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); | 91 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); |
| 93 v8::Local<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> function
Value, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVal
ue); | 92 v8::Local<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> function
Value, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVal
ue); |
| 94 | 93 |
| 95 | 94 |
| 96 virtual void compileScript(ScriptState*, const String& expression, const Str
ing& sourceURL, String* scriptId, String* exceptionMessage); | 95 virtual void compileScript(ScriptState*, const String& expression, const Str
ing& sourceURL, String* scriptId, String* exceptionMessage); |
| 97 virtual void clearCompiledScripts(); | 96 virtual void clearCompiledScripts(); |
| 98 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
sult, bool* wasThrown, String* exceptionMessage); | 97 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
sult, bool* wasThrown, String* exceptionMessage); |
| 98 virtual ScriptController* scriptController(v8::Handle<v8::Context>); |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 explicit ScriptDebugServer(v8::Isolate*); | 101 explicit ScriptDebugServer(v8::Isolate*); |
| 102 virtual ~ScriptDebugServer(); | 102 virtual ~ScriptDebugServer(); |
| 103 | 103 |
| 104 ScriptValue currentCallFrame(); | 104 ScriptValue currentCallFrame(); |
| 105 | 105 |
| 106 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
xt>) = 0; | 106 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
xt>) = 0; |
| 107 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; | 107 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; |
| 108 virtual void quitMessageLoopOnPause() = 0; | 108 virtual void quitMessageLoopOnPause() = 0; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 124 PauseOnExceptionsState m_pauseOnExceptionsState; | 124 PauseOnExceptionsState m_pauseOnExceptionsState; |
| 125 ScopedPersistent<v8::Object> m_debuggerScript; | 125 ScopedPersistent<v8::Object> m_debuggerScript; |
| 126 ScopedPersistent<v8::Object> m_executionState; | 126 ScopedPersistent<v8::Object> m_executionState; |
| 127 v8::Local<v8::Context> m_pausedContext; | 127 v8::Local<v8::Context> m_pausedContext; |
| 128 bool m_breakpointsActivated; | 128 bool m_breakpointsActivated; |
| 129 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; | 129 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; |
| 130 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts; | 130 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts; |
| 131 v8::Isolate* m_isolate; | 131 v8::Isolate* m_isolate; |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 class ScriptPreprocessor; | 134 void preprocess(v8::Handle<v8::Context>, v8::Handle<v8::Object> eventData); |
| 135 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; | |
| 136 bool m_runningNestedMessageLoop; | 135 bool m_runningNestedMessageLoop; |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace WebCore | 138 } // namespace WebCore |
| 140 | 139 |
| 141 | 140 |
| 142 #endif // ScriptDebugServer_h | 141 #endif // ScriptDebugServer_h |
| OLD | NEW |