Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: Source/bindings/v8/ScriptDebugServer.h

Issue 19284011: Apply ScriptPreprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase, fix Mac compiler issue Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 #include <v8-debug.h> 38 #include <v8-debug.h>
39 #include "wtf/HashMap.h" 39 #include "wtf/HashMap.h"
40 #include "wtf/Noncopyable.h" 40 #include "wtf/Noncopyable.h"
41 #include "wtf/PassOwnPtr.h" 41 #include "wtf/PassOwnPtr.h"
42 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
43 #include "wtf/text/StringHash.h" 43 #include "wtf/text/StringHash.h"
44 #include "wtf/text/WTFString.h" 44 #include "wtf/text/WTFString.h"
45 45
46 namespace WebCore { 46 namespace WebCore {
47 47
48 class ScriptController;
48 class ScriptDebugListener; 49 class ScriptDebugListener;
49 class ScriptObject; 50 class ScriptObject;
50 class ScriptState; 51 class ScriptState;
51 class ScriptValue; 52 class ScriptValue;
52 class JavaScriptCallFrame; 53 class JavaScriptCallFrame;
53 54
54 class ScriptDebugServer { 55 class ScriptDebugServer {
55 WTF_MAKE_NONCOPYABLE(ScriptDebugServer); 56 WTF_MAKE_NONCOPYABLE(ScriptDebugServer);
56 public: 57 public:
57 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);
(...skipping 13 matching lines...) Expand all
71 bool canBreakProgram(); 72 bool canBreakProgram();
72 void breakProgram(); 73 void breakProgram();
73 void continueProgram(); 74 void continueProgram();
74 void stepIntoStatement(); 75 void stepIntoStatement();
75 void stepOverStatement(); 76 void stepOverStatement();
76 void stepOutOfFunction(); 77 void stepOutOfFunction();
77 78
78 bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc riptValue* newCallFrames, ScriptObject* result); 79 bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc riptValue* newCallFrames, ScriptObject* result);
79 void updateCallStack(ScriptValue* callFrame); 80 void updateCallStack(ScriptValue* callFrame);
80 81
81 void setScriptPreprocessor(const String& preprocessorBody);
82
83 class Task { 82 class Task {
84 public: 83 public:
85 virtual ~Task() { } 84 virtual ~Task() { }
86 virtual void run() = 0; 85 virtual void run() = 0;
87 }; 86 };
88 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*); 87 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*);
89 void runPendingTasks(); 88 void runPendingTasks();
90 89
91 bool isPaused(); 90 bool isPaused();
92 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; } 91 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; }
93 92
94 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); 93 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>);
95 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); 94 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&);
96 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa lue); 95 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa lue);
97 96 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]);
98 97
99 virtual void compileScript(ScriptState*, const String& expression, const Str ing& sourceURL, String* scriptId, String* exceptionMessage); 98 virtual void compileScript(ScriptState*, const String& expression, const Str ing& sourceURL, String* scriptId, String* exceptionMessage);
100 virtual void clearCompiledScripts(); 99 virtual void clearCompiledScripts();
101 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re sult, bool* wasThrown, String* exceptionMessage); 100 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re sult, bool* wasThrown, String* exceptionMessage);
101 virtual ScriptController* scriptController(v8::Handle<v8::Context>);
102 102
103 protected: 103 protected:
104 explicit ScriptDebugServer(v8::Isolate*); 104 explicit ScriptDebugServer(v8::Isolate*);
105 virtual ~ScriptDebugServer(); 105 virtual ~ScriptDebugServer();
106
107 ScriptValue currentCallFrame(); 106 ScriptValue currentCallFrame();
108 107
109 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte xt>) = 0; 108 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte xt>) = 0;
110 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; 109 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0;
111 virtual void quitMessageLoopOnPause() = 0; 110 virtual void quitMessageLoopOnPause() = 0;
112 111
113 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>& args); 112 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
114 void handleProgramBreak(v8::Handle<v8::Object> executionState, v8::Handle<v8 ::Value> exception, v8::Handle<v8::Array> hitBreakpoints); 113 void handleProgramBreak(v8::Handle<v8::Object> executionState, v8::Handle<v8 ::Value> exception, v8::Handle<v8::Array> hitBreakpoints);
115 void handleProgramBreak(const v8::Debug::EventDetails&, v8::Handle<v8::Value > exception, v8::Handle<v8::Array> hitBreakpointNumbers); 114 void handleProgramBreak(const v8::Debug::EventDetails&, v8::Handle<v8::Value > exception, v8::Handle<v8::Array> hitBreakpointNumbers);
116 115
117 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails ); 116 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails );
118 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); 117 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails);
119 118
120 void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Ob ject> sourceObject); 119 void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Ob ject> sourceObject);
121 120
122 void ensureDebuggerScriptCompiled(); 121 void ensureDebuggerScriptCompiled();
123 122
124 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]);
125
126 String preprocessSourceCode(const String& sourceCode);
127
128 PauseOnExceptionsState m_pauseOnExceptionsState; 123 PauseOnExceptionsState m_pauseOnExceptionsState;
129 ScopedPersistent<v8::Object> m_debuggerScript; 124 ScopedPersistent<v8::Object> m_debuggerScript;
130 ScopedPersistent<v8::Object> m_executionState; 125 ScopedPersistent<v8::Object> m_executionState;
131 v8::Handle<v8::Context> m_pausedContext; 126 v8::Handle<v8::Context> m_pausedContext;
132 bool m_breakpointsActivated; 127 bool m_breakpointsActivated;
133 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; 128 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate;
134 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts; 129 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts;
135 v8::Isolate* m_isolate; 130 v8::Isolate* m_isolate;
136
137 private: 131 private:
138 PassRefPtr<JavaScriptCallFrame> wrapCallFrames(v8::Handle<v8::Object> execut ionState, int maximumLimit); 132 PassRefPtr<JavaScriptCallFrame> wrapCallFrames(v8::Handle<v8::Object> execut ionState, int maximumLimit);
139
140 class ScriptPreprocessor;
141 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor;
142 bool m_runningNestedMessageLoop; 133 bool m_runningNestedMessageLoop;
143 }; 134 };
144 135
145 } // namespace WebCore 136 } // namespace WebCore
146 137
147 138
148 #endif // ScriptDebugServer_h 139 #endif // ScriptDebugServer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698