| 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 13 matching lines...) Expand all  Loading... | 
|   24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |   24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
|   25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |   25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
|   26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |   26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
|   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 ScriptDebugServer_h |   31 #ifndef ScriptDebugServer_h | 
|   32 #define ScriptDebugServer_h |   32 #define ScriptDebugServer_h | 
|   33  |   33  | 
 |   34 #include "bindings/core/v8/Nullable.h" | 
|   34 #include "bindings/core/v8/ScopedPersistent.h" |   35 #include "bindings/core/v8/ScopedPersistent.h" | 
|   35 #include "core/inspector/ScriptBreakpoint.h" |   36 #include "core/inspector/ScriptBreakpoint.h" | 
|   36 #include "core/inspector/ScriptCallStack.h" |   37 #include "core/inspector/ScriptCallStack.h" | 
|   37 #include "core/inspector/ScriptDebugListener.h" |   38 #include "core/inspector/ScriptDebugListener.h" | 
|   38 #include "wtf/HashMap.h" |   39 #include "wtf/HashMap.h" | 
|   39 #include "wtf/PassOwnPtr.h" |   40 #include "wtf/PassOwnPtr.h" | 
|   40 #include <v8-debug.h> |   41 #include <v8-debug.h> | 
|   41 #include <v8.h> |   42 #include <v8.h> | 
|   42  |   43  | 
|   43 namespace blink { |   44 namespace blink { | 
|   44  |   45  | 
|   45 class ScriptState; |   46 class ScriptState; | 
|   46 class ScriptDebugListener; |   47 class ScriptDebugListener; | 
|   47 class ScriptSourceCode; |   48 class ScriptSourceCode; | 
|   48 class ScriptValue; |   49 class ScriptValue; | 
|   49 class JavaScriptCallFrame; |   50 class JavaScriptCallFrame; | 
|   50  |   51  | 
|   51 class ScriptDebugServer { |   52 class ScriptDebugServer : public NoBaseWillBeGarbageCollectedFinalized<ScriptDeb
     ugServer> { | 
|   52     WTF_MAKE_NONCOPYABLE(ScriptDebugServer); |   53     WTF_MAKE_NONCOPYABLE(ScriptDebugServer); | 
|   53 public: |   54 public: | 
 |   55     virtual ~ScriptDebugServer(); | 
 |   56     virtual void trace(Visitor*); | 
 |   57  | 
|   54     String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a
     ctualLineNumber, int* actualColumnNumber, bool interstatementLocation); |   58     String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a
     ctualLineNumber, int* actualColumnNumber, bool interstatementLocation); | 
|   55     void removeBreakpoint(const String& breakpointId); |   59     void removeBreakpoint(const String& breakpointId); | 
|   56     void clearBreakpoints(); |   60     void clearBreakpoints(); | 
|   57     void setBreakpointsActivated(bool activated); |   61     void setBreakpointsActivated(bool activated); | 
|   58  |   62  | 
|   59     enum PauseOnExceptionsState { |   63     enum PauseOnExceptionsState { | 
|   60         DontPauseOnExceptions, |   64         DontPauseOnExceptions, | 
|   61         PauseOnAllExceptions, |   65         PauseOnAllExceptions, | 
|   62         PauseOnUncaughtExceptions |   66         PauseOnUncaughtExceptions | 
|   63     }; |   67     }; | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   97     v8::Local<v8::Value> collectionEntries(v8::Handle<v8::Object>&); |  101     v8::Local<v8::Value> collectionEntries(v8::Handle<v8::Object>&); | 
|   98     v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); |  102     v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); | 
|   99     v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio
     nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa
     lue); |  103     v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio
     nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa
     lue); | 
|  100     v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, 
     v8::Handle<v8::Value> argv[]); |  104     v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, 
     v8::Handle<v8::Value> argv[]); | 
|  101  |  105  | 
|  102     virtual void compileScript(ScriptState*, const String& expression, const Str
     ing& sourceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber,
      int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace); |  106     virtual void compileScript(ScriptState*, const String& expression, const Str
     ing& sourceURL, String* scriptId, String* exceptionDetailsText, int* lineNumber,
      int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace); | 
|  103     virtual void clearCompiledScripts(); |  107     virtual void clearCompiledScripts(); | 
|  104     virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
     sult, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* colum
     nNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace); |  108     virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re
     sult, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* colum
     nNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace); | 
|  105     virtual void setPreprocessorSource(const String&) { } |  109     virtual void setPreprocessorSource(const String&) { } | 
|  106     virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) { } |  110     virtual void preprocessBeforeCompile(const v8::Debug::EventDetails&) { } | 
|  107     virtual PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSou
     rceCode&); |  111     virtual Nullable<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSourc
     eCode&); | 
|  108     virtual String preprocessEventListener(LocalFrame*, const String& source, co
     nst String& url, const String& functionName); |  112     virtual String preprocessEventListener(LocalFrame*, const String& source, co
     nst String& url, const String& functionName); | 
|  109     virtual void clearPreprocessor() { } |  113     virtual void clearPreprocessor() { } | 
|  110  |  114  | 
|  111     virtual void muteWarningsAndDeprecations() { } |  115     virtual void muteWarningsAndDeprecations() { } | 
|  112     virtual void unmuteWarningsAndDeprecations() { } |  116     virtual void unmuteWarningsAndDeprecations() { } | 
|  113  |  117  | 
|  114 protected: |  118 protected: | 
|  115     explicit ScriptDebugServer(v8::Isolate*); |  119     explicit ScriptDebugServer(v8::Isolate*); | 
|  116     virtual ~ScriptDebugServer(); |  | 
|  117  |  120  | 
|  118     virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
     xt>) = 0; |  121     virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte
     xt>) = 0; | 
|  119     virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; |  122     virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; | 
|  120     virtual void quitMessageLoopOnPause() = 0; |  123     virtual void quitMessageLoopOnPause() = 0; | 
|  121  |  124  | 
|  122     static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
     ; |  125     static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>&)
     ; | 
|  123     void handleProgramBreak(ScriptState* pausedScriptState, v8::Handle<v8::Objec
     t> executionState, v8::Handle<v8::Value> exception, v8::Handle<v8::Array> hitBre
     akpoints, bool isPromiseRejection = false); |  126     void handleProgramBreak(ScriptState* pausedScriptState, v8::Handle<v8::Objec
     t> executionState, v8::Handle<v8::Value> exception, v8::Handle<v8::Array> hitBre
     akpoints, bool isPromiseRejection = false); | 
|  124  |  127  | 
|  125     static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails
     ); |  128     static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails
     ); | 
|  126     void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); |  129     void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|  154  |  157  | 
|  155     void handleV8PromiseEvent(ScriptDebugListener*, ScriptState* pausedScriptSta
     te, v8::Handle<v8::Object> executionState, v8::Handle<v8::Object> eventData); |  158     void handleV8PromiseEvent(ScriptDebugListener*, ScriptState* pausedScriptSta
     te, v8::Handle<v8::Object> executionState, v8::Handle<v8::Object> eventData); | 
|  156  |  159  | 
|  157     bool m_runningNestedMessageLoop; |  160     bool m_runningNestedMessageLoop; | 
|  158 }; |  161 }; | 
|  159  |  162  | 
|  160 } // namespace blink |  163 } // namespace blink | 
|  161  |  164  | 
|  162  |  165  | 
|  163 #endif // ScriptDebugServer_h |  166 #endif // ScriptDebugServer_h | 
| OLD | NEW |