OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 |
33 #if ENABLE(INSPECTOR) | 33 #if ENABLE(INSPECTOR) |
34 | 34 |
35 #include "InspectorRuntimeAgent.h" | 35 #include "InspectorRuntimeAgent.h" |
36 | 36 |
37 #include "InjectedScript.h" | 37 #include "InjectedScript.h" |
38 #include "InjectedScriptManager.h" | 38 #include "InjectedScriptManager.h" |
39 #include "InspectorValues.h" | 39 #include "InspectorValues.h" |
40 #include "InstrumentingAgents.h" | |
41 #include "WorkerContext.h" | |
42 #include "WorkerDebuggerAgent.h" | |
43 #include "WorkerRunLoop.h" | |
44 #include "WorkerThread.h" | |
45 #include <wtf/PassRefPtr.h> | 40 #include <wtf/PassRefPtr.h> |
46 | 41 |
47 | 42 |
48 #if ENABLE(JAVASCRIPT_DEBUGGER) | 43 #if ENABLE(JAVASCRIPT_DEBUGGER) |
49 #include "ScriptDebugServer.h" | 44 #include "ScriptDebugServer.h" |
50 #endif | 45 #endif |
51 | 46 |
52 namespace WebCore { | 47 namespace WebCore { |
53 | 48 |
54 static bool asBool(const bool* const b) | 49 static bool asBool(const bool* const b) |
55 { | 50 { |
56 return b ? *b : false; | 51 return b ? *b : false; |
57 } | 52 } |
58 | 53 |
59 InspectorRuntimeAgent::InspectorRuntimeAgent(InstrumentingAgents* instrumentingA
gents, InspectorState* state, InjectedScriptManager* injectedScriptManager) | 54 InspectorRuntimeAgent::InspectorRuntimeAgent(InstrumentingAgents* instrumentingA
gents, InspectorState* state, InjectedScriptManager* injectedScriptManager) |
60 : InspectorBaseAgent<InspectorRuntimeAgent>("Runtime", instrumentingAgents,
state) | 55 : InspectorBaseAgent<InspectorRuntimeAgent>("Runtime", instrumentingAgents,
state) |
61 , m_enabled(false) | 56 , m_enabled(false) |
62 , m_injectedScriptManager(injectedScriptManager) | 57 , m_injectedScriptManager(injectedScriptManager) |
63 #if ENABLE(JAVASCRIPT_DEBUGGER) | 58 #if ENABLE(JAVASCRIPT_DEBUGGER) |
64 , m_scriptDebugServer(0) | 59 , m_scriptDebugServer(0) |
65 #endif | 60 #endif |
66 , m_paused(false) | |
67 { | 61 { |
68 m_instrumentingAgents->setInspectorRuntimeAgent(this); | |
69 } | 62 } |
70 | 63 |
71 InspectorRuntimeAgent::~InspectorRuntimeAgent() | 64 InspectorRuntimeAgent::~InspectorRuntimeAgent() |
72 { | 65 { |
73 m_instrumentingAgents->setInspectorRuntimeAgent(0); | |
74 } | 66 } |
75 | 67 |
76 #if ENABLE(JAVASCRIPT_DEBUGGER) | 68 #if ENABLE(JAVASCRIPT_DEBUGGER) |
77 static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(Scrip
tDebugServer* scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newSt
ate) | 69 static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(Scrip
tDebugServer* scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newSt
ate) |
78 { | 70 { |
79 ASSERT(scriptDebugServer); | 71 ASSERT(scriptDebugServer); |
80 ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer->
pauseOnExceptionsState(); | 72 ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer->
pauseOnExceptionsState(); |
81 if (presentState != newState) | 73 if (presentState != newState) |
82 scriptDebugServer->setPauseOnExceptionsState(newState); | 74 scriptDebugServer->setPauseOnExceptionsState(newState); |
83 return presentState; | 75 return presentState; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 injectedScript.releaseObject(objectId); | 157 injectedScript.releaseObject(objectId); |
166 } | 158 } |
167 | 159 |
168 void InspectorRuntimeAgent::releaseObjectGroup(ErrorString*, const String& objec
tGroup) | 160 void InspectorRuntimeAgent::releaseObjectGroup(ErrorString*, const String& objec
tGroup) |
169 { | 161 { |
170 m_injectedScriptManager->releaseObjectGroup(objectGroup); | 162 m_injectedScriptManager->releaseObjectGroup(objectGroup); |
171 } | 163 } |
172 | 164 |
173 void InspectorRuntimeAgent::run(ErrorString*) | 165 void InspectorRuntimeAgent::run(ErrorString*) |
174 { | 166 { |
175 m_paused = false; | |
176 } | 167 } |
177 | 168 |
178 #if ENABLE(JAVASCRIPT_DEBUGGER) | 169 #if ENABLE(JAVASCRIPT_DEBUGGER) |
179 void InspectorRuntimeAgent::setScriptDebugServer(ScriptDebugServer* scriptDebugS
erver) | 170 void InspectorRuntimeAgent::setScriptDebugServer(ScriptDebugServer* scriptDebugS
erver) |
180 { | 171 { |
181 m_scriptDebugServer = scriptDebugServer; | 172 m_scriptDebugServer = scriptDebugServer; |
182 } | 173 } |
183 | |
184 #if ENABLE(WORKERS) | |
185 void InspectorRuntimeAgent::pauseWorkerContext(WorkerContext* context) | |
186 { | |
187 m_paused = true; | |
188 MessageQueueWaitResult result; | |
189 do { | |
190 result = context->thread()->runLoop().runInMode(context, WorkerDebuggerA
gent::debuggerTaskMode); | |
191 // Keep waiting until execution is resumed. | |
192 } while (result == MessageQueueMessageReceived && m_paused); | |
193 } | |
194 #endif // ENABLE(WORKERS) | |
195 #endif // ENABLE(JAVASCRIPT_DEBUGGER) | 174 #endif // ENABLE(JAVASCRIPT_DEBUGGER) |
196 | 175 |
197 } // namespace WebCore | 176 } // namespace WebCore |
198 | 177 |
199 #endif // ENABLE(INSPECTOR) | 178 #endif // ENABLE(INSPECTOR) |
OLD | NEW |