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

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

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: respond to haraken comment #35 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 53
53 class ScriptDebugServer { 54 class ScriptDebugServer {
54 WTF_MAKE_NONCOPYABLE(ScriptDebugServer); 55 WTF_MAKE_NONCOPYABLE(ScriptDebugServer);
55 public: 56 public:
56 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber); 57 String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, int* a ctualLineNumber, int* actualColumnNumber);
57 void removeBreakpoint(const String& breakpointId); 58 void removeBreakpoint(const String& breakpointId);
(...skipping 12 matching lines...) Expand all
70 bool canBreakProgram(); 71 bool canBreakProgram();
71 void breakProgram(); 72 void breakProgram();
72 void continueProgram(); 73 void continueProgram();
73 void stepIntoStatement(); 74 void stepIntoStatement();
74 void stepOverStatement(); 75 void stepOverStatement();
75 void stepOutOfFunction(); 76 void stepOutOfFunction();
76 77
77 bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc riptValue* newCallFrames, ScriptObject* result); 78 bool setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>&, Sc riptValue* newCallFrames, ScriptObject* result);
78 void updateCallStack(ScriptValue* callFrame); 79 void updateCallStack(ScriptValue* callFrame);
79 80
80 void setScriptPreprocessor(const String& preprocessorBody);
81
82 class Task { 81 class Task {
83 public: 82 public:
84 virtual ~Task() { } 83 virtual ~Task() { }
85 virtual void run() = 0; 84 virtual void run() = 0;
86 }; 85 };
87 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*); 86 static void interruptAndRun(PassOwnPtr<Task>, v8::Isolate*);
88 void runPendingTasks(); 87 void runPendingTasks();
89 88
90 bool isPaused(); 89 bool isPaused();
91 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; } 90 bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; }
92 91
93 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>); 92 v8::Local<v8::Value> functionScopes(v8::Handle<v8::Function>);
94 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&); 93 v8::Local<v8::Value> getInternalProperties(v8::Handle<v8::Object>&);
95 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa lue); 94 v8::Handle<v8::Value> setFunctionVariableValue(v8::Handle<v8::Value> functio nValue, int scopeNumber, const String& variableName, v8::Handle<v8::Value> newVa lue);
96 95 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]);
97 96
98 virtual void compileScript(ScriptState*, const String& expression, const Str ing& sourceURL, String* scriptId, String* exceptionMessage); 97 virtual void compileScript(ScriptState*, const String& expression, const Str ing& sourceURL, String* scriptId, String* exceptionMessage);
99 virtual void clearCompiledScripts(); 98 virtual void clearCompiledScripts();
100 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re sult, bool* wasThrown, String* exceptionMessage); 99 virtual void runScript(ScriptState*, const String& scriptId, ScriptValue* re sult, bool* wasThrown, String* exceptionMessage);
100 virtual ScriptController* scriptController(v8::Handle<v8::Context>);
101 101
102 protected: 102 protected:
103 explicit ScriptDebugServer(v8::Isolate*); 103 explicit ScriptDebugServer(v8::Isolate*);
104 virtual ~ScriptDebugServer(); 104 virtual ~ScriptDebugServer();
105
106 ScriptValue currentCallFrame(); 105 ScriptValue currentCallFrame();
107 106
108 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte xt>) = 0; 107 virtual ScriptDebugListener* getDebugListenerForContext(v8::Handle<v8::Conte xt>) = 0;
109 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0; 108 virtual void runMessageLoopOnPause(v8::Handle<v8::Context>) = 0;
110 virtual void quitMessageLoopOnPause() = 0; 109 virtual void quitMessageLoopOnPause() = 0;
111 110
112 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>& args); 111 static void breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>& args);
113 void handleProgramBreak(v8::Handle<v8::Object> executionState, v8::Handle<v8 ::Value> exception, v8::Handle<v8::Array> hitBreakpoints); 112 void handleProgramBreak(v8::Handle<v8::Object> executionState, v8::Handle<v8 ::Value> exception, v8::Handle<v8::Array> hitBreakpoints);
114 void handleProgramBreak(const v8::Debug::EventDetails&, v8::Handle<v8::Value > exception, v8::Handle<v8::Array> hitBreakpointNumbers); 113 void handleProgramBreak(const v8::Debug::EventDetails&, v8::Handle<v8::Value > exception, v8::Handle<v8::Array> hitBreakpointNumbers);
115 114
116 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails ); 115 static void v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails );
117 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails); 116 void handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails);
118 117
119 void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Ob ject> sourceObject); 118 void dispatchDidParseSource(ScriptDebugListener* listener, v8::Handle<v8::Ob ject> sourceObject);
120 119
121 void ensureDebuggerScriptCompiled(); 120 void ensureDebuggerScriptCompiled();
122 121
123 v8::Local<v8::Value> callDebuggerMethod(const char* functionName, int argc, v8::Handle<v8::Value> argv[]);
124
125 String preprocessSourceCode(const String& sourceCode);
126
127 PauseOnExceptionsState m_pauseOnExceptionsState; 122 PauseOnExceptionsState m_pauseOnExceptionsState;
128 ScopedPersistent<v8::Object> m_debuggerScript; 123 ScopedPersistent<v8::Object> m_debuggerScript;
129 ScopedPersistent<v8::Object> m_executionState; 124 ScopedPersistent<v8::Object> m_executionState;
130 v8::Handle<v8::Context> m_pausedContext; 125 v8::Handle<v8::Context> m_pausedContext;
131 bool m_breakpointsActivated; 126 bool m_breakpointsActivated;
132 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate; 127 ScopedPersistent<v8::FunctionTemplate> m_breakProgramCallbackTemplate;
133 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts; 128 HashMap<String, OwnPtr<ScopedPersistent<v8::Script> > > m_compiledScripts;
134 v8::Isolate* m_isolate; 129 v8::Isolate* m_isolate;
135
136 private: 130 private:
137 class ScriptPreprocessor;
138 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor;
139 bool m_runningNestedMessageLoop; 131 bool m_runningNestedMessageLoop;
140 }; 132 };
141 133
142 } // namespace WebCore 134 } // namespace WebCore
143 135
144 136
145 #endif // ScriptDebugServer_h 137 #endif // ScriptDebugServer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698