Title: [133604] branches/chromium/1312/Source/WebCore/inspector
Revision
133604
Author
[email protected]
Date
2012-11-06 07:16:17 -0800 (Tue, 06 Nov 2012)

Log Message

Merge 133052 - Web Inspector: frame chooser does not work on subsequent inspector open.
https://bugs.webkit.org/show_bug.cgi?id=100771

Reviewed by Yury Semikhatsky.

- Make WorkerRuntimeAgent and PageRuntimeAgent register themselves in the instrumenting agents independently
- Move pause / run worker handling from InspectorRuntimeAgent into WorkerRuntimeAgent
- Remove remains of the front-end reused signal from InspectorAgent
- Send execution contexts post clear window object instead of post commit load.

* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::InspectorAgent):
(WebCore::InspectorAgent::clearFrontend):
(WebCore::InspectorAgent::didCommitLoad):
* inspector/InspectorAgent.h:
(InspectorAgent):
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
(WebCore::InspectorInstrumentation::willEvaluateWorkerScript):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::restore):
* inspector/InspectorRuntimeAgent.cpp:
(WebCore::InspectorRuntimeAgent::InspectorRuntimeAgent):
(WebCore::InspectorRuntimeAgent::~InspectorRuntimeAgent):
(WebCore::InspectorRuntimeAgent::run):
(WebCore::InspectorRuntimeAgent::setScriptDebugServer):
* inspector/InspectorRuntimeAgent.h:
(InspectorRuntimeAgent):
* inspector/InstrumentingAgents.h:
(WebCore):
(WebCore::InstrumentingAgents::InstrumentingAgents):
(WebCore::InstrumentingAgents::workerRuntimeAgent):
(WebCore::InstrumentingAgents::setWorkerRuntimeAgent):
(InstrumentingAgents):
* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::PageRuntimeAgent):
(WebCore::PageRuntimeAgent::~PageRuntimeAgent):
(WebCore::PageRuntimeAgent::setFrontend):
(WebCore::PageRuntimeAgent::clearFrontend):
(WebCore::PageRuntimeAgent::enable):
(WebCore::PageRuntimeAgent::didCreateMainWorldContext):
* inspector/PageRuntimeAgent.h:
(PageRuntimeAgent):
* inspector/WorkerRuntimeAgent.cpp:
(WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent):
(WebCore::WorkerRuntimeAgent::~WorkerRuntimeAgent):
(WebCore::WorkerRuntimeAgent::run):
(WebCore):
(WebCore::WorkerRuntimeAgent::pauseWorkerContext):
* inspector/WorkerRuntimeAgent.h:
(WorkerRuntimeAgent):


[email protected]
Review URL: https://chromiumcodereview.appspot.com/11366107

Modified Paths

Diff

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorAgent.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorAgent.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorAgent.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -68,7 +68,6 @@
     , m_inspectedPage(page)
     , m_frontend(0)
     , m_injectedScriptManager(injectedScriptManager)
-    , m_didCommitLoadFired(false)
 {
     ASSERT_ARG(page, page);
     m_instrumentingAgents->setInspectorAgent(this);
@@ -102,7 +101,6 @@
 {
     m_pendingEvaluateTestCommands.clear();
     m_frontend = 0;
-    m_didCommitLoadFired = false;
     m_injectedScriptManager->discardInjectedScripts();
     ErrorString error;
     disable(&error);
@@ -110,7 +108,6 @@
 
 void InspectorAgent::didCommitLoad()
 {
-    m_didCommitLoadFired = true;
     m_injectedScriptManager->discardInjectedScripts();
 }
 

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorAgent.h (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorAgent.h	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorAgent.h	2012-11-06 15:16:17 UTC (rev 133604)
@@ -79,7 +79,6 @@
 
     void didCommitLoad();
     void domContentLoadedEventFired();
-    bool didCommitLoadFired() { return m_didCommitLoadFired; }
 
     bool hasFrontend() const { return m_frontend; }
 
@@ -109,7 +108,6 @@
     pair<RefPtr<TypeBuilder::Runtime::RemoteObject>, RefPtr<InspectorObject> > m_pendingInspectData;
     typedef HashMap<String, String> InjectedScriptForOriginMap;
     InjectedScriptForOriginMap m_injectedScriptForOrigin;
-    bool m_didCommitLoadFired;
 };
 
 } // namespace WebCore

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorController.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorController.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorController.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -125,7 +125,7 @@
     m_resourceAgent = resourceAgentPtr.get();
     m_agents.append(resourceAgentPtr.release());
 
-    OwnPtr<InspectorRuntimeAgent> runtimeAgentPtr(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), page, pageAgent, m_inspectorAgent));
+    OwnPtr<InspectorRuntimeAgent> runtimeAgentPtr(PageRuntimeAgent::create(m_instrumentingAgents.get(), m_state.get(), m_injectedScriptManager.get(), page, pageAgent));
     InspectorRuntimeAgent* runtimeAgent = runtimeAgentPtr.get();
     m_agents.append(runtimeAgentPtr.release());
 

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorInstrumentation.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -57,7 +57,6 @@
 #include "InspectorPageAgent.h"
 #include "InspectorProfilerAgent.h"
 #include "InspectorResourceAgent.h"
-#include "InspectorRuntimeAgent.h"
 #include "InspectorTimelineAgent.h"
 #include "InspectorWorkerAgent.h"
 #include "InstrumentingAgents.h"
@@ -67,6 +66,7 @@
 #include "ScriptProfile.h"
 #include "StyleRule.h"
 #include "WorkerContext.h"
+#include "WorkerRuntimeAgent.h"
 #include "WorkerThread.h"
 #include "XMLHttpRequest.h"
 #include <wtf/StdLibExtras.h>
@@ -127,7 +127,7 @@
 #endif
     if (PageRuntimeAgent* pageRuntimeAgent = instrumentingAgents->pageRuntimeAgent()) {
         if (world == mainThreadNormalWorld())
-            pageRuntimeAgent->didClearWindowObject(frame);
+            pageRuntimeAgent->didCreateMainWorldContext(frame);
     }
 }
 
@@ -1076,7 +1076,7 @@
     if (!instrumentingAgents)
         return;
 #if ENABLE(_javascript__DEBUGGER)
-    if (InspectorRuntimeAgent* runtimeAgent = instrumentingAgents->inspectorRuntimeAgent())
+    if (WorkerRuntimeAgent* runtimeAgent = instrumentingAgents->workerRuntimeAgent())
         runtimeAgent->pauseWorkerContext(workerContext);
 #endif
 }
@@ -1164,13 +1164,6 @@
     return consoleAgent && consoleAgent->enabled();
 }
 
-bool InspectorInstrumentation::runtimeAgentEnabled(Frame* frame)
-{
-    InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame);
-    InspectorRuntimeAgent* runtimeAgent = instrumentingAgents ? instrumentingAgents->inspectorRuntimeAgent() : 0;
-    return runtimeAgent && runtimeAgent->enabled();
-}
-
 bool InspectorInstrumentation::timelineAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
 {
     InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext);

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorInstrumentation.h (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorInstrumentation.h	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorInstrumentation.h	2012-11-06 15:16:17 UTC (rev 133604)
@@ -257,7 +257,6 @@
     static bool hasFrontends() { return s_frontendCounter; }
     static bool canvasAgentEnabled(ScriptExecutionContext*);
     static bool consoleAgentEnabled(ScriptExecutionContext*);
-    static bool runtimeAgentEnabled(Frame*);
     static bool timelineAgentEnabled(ScriptExecutionContext*);
     static bool collectingHTMLParseErrors(Page*);
 #else

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorPageAgent.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -355,9 +355,6 @@
     if (m_state->getBoolean(PageAgentState::pageAgentEnabled)) {
         ErrorString error;
         enable(&error);
-
-        if (m_inspectorAgent->didCommitLoadFired())
-            frameNavigated(m_page->mainFrame()->loader()->documentLoader());
 #if ENABLE(TOUCH_EVENTS)
         updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touchEventEmulationEnabled));
 #endif

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorRuntimeAgent.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorRuntimeAgent.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorRuntimeAgent.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -37,11 +37,6 @@
 #include "InjectedScript.h"
 #include "InjectedScriptManager.h"
 #include "InspectorValues.h"
-#include "InstrumentingAgents.h"
-#include "WorkerContext.h"
-#include "WorkerDebuggerAgent.h"
-#include "WorkerRunLoop.h"
-#include "WorkerThread.h"
 #include <wtf/PassRefPtr.h>
 
 
@@ -63,14 +58,11 @@
 #if ENABLE(_javascript__DEBUGGER)
     , m_scriptDebugServer(0)
 #endif
-    , m_paused(false)
 {
-    m_instrumentingAgents->setInspectorRuntimeAgent(this);
 }
 
 InspectorRuntimeAgent::~InspectorRuntimeAgent()
 {
-    m_instrumentingAgents->setInspectorRuntimeAgent(0);
 }
 
 #if ENABLE(_javascript__DEBUGGER)
@@ -172,7 +164,6 @@
 
 void InspectorRuntimeAgent::run(ErrorString*)
 {
-    m_paused = false;
 }
 
 #if ENABLE(_javascript__DEBUGGER)
@@ -180,18 +171,6 @@
 {
     m_scriptDebugServer = scriptDebugServer;
 }
-
-#if ENABLE(WORKERS)
-void InspectorRuntimeAgent::pauseWorkerContext(WorkerContext* context)
-{
-    m_paused = true;
-    MessageQueueWaitResult result;
-    do {
-        result = context->thread()->runLoop().runInMode(context, WorkerDebuggerAgent::debuggerTaskMode);
-    // Keep waiting until execution is resumed.
-    } while (result == MessageQueueMessageReceived && m_paused);
-}
-#endif // ENABLE(WORKERS)
 #endif // ENABLE(_javascript__DEBUGGER)
 
 } // namespace WebCore

Modified: branches/chromium/1312/Source/WebCore/inspector/InspectorRuntimeAgent.h (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InspectorRuntimeAgent.h	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InspectorRuntimeAgent.h	2012-11-06 15:16:17 UTC (rev 133604)
@@ -85,10 +85,7 @@
 
 #if ENABLE(_javascript__DEBUGGER)
     void setScriptDebugServer(ScriptDebugServer*);
-#if ENABLE(WORKERS)
-    void pauseWorkerContext(WorkerContext*);
 #endif
-#endif
 
 protected:
     InspectorRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*);
@@ -105,7 +102,6 @@
 #if ENABLE(_javascript__DEBUGGER)
     ScriptDebugServer* m_scriptDebugServer;
 #endif
-    bool m_paused;
 };
 
 } // namespace WebCore

Modified: branches/chromium/1312/Source/WebCore/inspector/InstrumentingAgents.h (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/InstrumentingAgents.h	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/InstrumentingAgents.h	2012-11-06 15:16:17 UTC (rev 133604)
@@ -50,12 +50,12 @@
 class InspectorPageAgent;
 class InspectorProfilerAgent;
 class InspectorResourceAgent;
-class InspectorRuntimeAgent;
 class InspectorTimelineAgent;
 class InspectorWorkerAgent;
 class Page;
 class PageRuntimeAgent;
 class WorkerContext;
+class WorkerRuntimeAgent;
 
 class InstrumentingAgents {
     WTF_MAKE_NONCOPYABLE(InstrumentingAgents);
@@ -68,8 +68,8 @@
         , m_inspectorConsoleAgent(0)
         , m_inspectorDOMAgent(0)
         , m_inspectorResourceAgent(0)
-        , m_inspectorRuntimeAgent(0)
         , m_pageRuntimeAgent(0)
+        , m_workerRuntimeAgent(0)
         , m_inspectorTimelineAgent(0)
         , m_inspectorDOMStorageAgent(0)
 #if ENABLE(SQL_DATABASE)
@@ -109,12 +109,12 @@
     InspectorResourceAgent* inspectorResourceAgent() const { return m_inspectorResourceAgent; }
     void setInspectorResourceAgent(InspectorResourceAgent* agent) { m_inspectorResourceAgent = agent; }
 
-    InspectorRuntimeAgent* inspectorRuntimeAgent() const { return m_inspectorRuntimeAgent; }
-    void setInspectorRuntimeAgent(InspectorRuntimeAgent* agent) { m_inspectorRuntimeAgent = agent; }
-
     PageRuntimeAgent* pageRuntimeAgent() const { return m_pageRuntimeAgent; }
     void setPageRuntimeAgent(PageRuntimeAgent* agent) { m_pageRuntimeAgent = agent; }
 
+    WorkerRuntimeAgent* workerRuntimeAgent() const { return m_workerRuntimeAgent; }
+    void setWorkerRuntimeAgent(WorkerRuntimeAgent* agent) { m_workerRuntimeAgent = agent; }
+
     InspectorTimelineAgent* inspectorTimelineAgent() const { return m_inspectorTimelineAgent; }
     void setInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_inspectorTimelineAgent = agent; }
 
@@ -160,8 +160,8 @@
     InspectorConsoleAgent* m_inspectorConsoleAgent;
     InspectorDOMAgent* m_inspectorDOMAgent;
     InspectorResourceAgent* m_inspectorResourceAgent;
-    InspectorRuntimeAgent* m_inspectorRuntimeAgent;
     PageRuntimeAgent* m_pageRuntimeAgent;
+    WorkerRuntimeAgent* m_workerRuntimeAgent;
     InspectorTimelineAgent* m_inspectorTimelineAgent;
     InspectorDOMStorageAgent* m_inspectorDOMStorageAgent;
 #if ENABLE(SQL_DATABASE)

Modified: branches/chromium/1312/Source/WebCore/inspector/PageRuntimeAgent.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/PageRuntimeAgent.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -38,7 +38,6 @@
 #include "Document.h"
 #include "InjectedScript.h"
 #include "InjectedScriptManager.h"
-#include "InspectorAgent.h"
 #include "InspectorPageAgent.h"
 #include "InspectorState.h"
 #include "InstrumentingAgents.h"
@@ -53,28 +52,28 @@
 static const char runtimeEnabled[] = "runtimeEnabled";
 };
 
-PageRuntimeAgent::PageRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent, InspectorAgent* inspectorAgent)
+PageRuntimeAgent::PageRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
     : InspectorRuntimeAgent(instrumentingAgents, state, injectedScriptManager)
     , m_inspectedPage(page)
     , m_pageAgent(pageAgent)
-    , m_inspectorAgent(inspectorAgent)
     , m_frontend(0)
+    , m_mainWorldContextCreated(false)
 {
+    m_instrumentingAgents->setPageRuntimeAgent(this);
 }
 
 PageRuntimeAgent::~PageRuntimeAgent()
 {
+    m_instrumentingAgents->setPageRuntimeAgent(0);
 }
 
 void PageRuntimeAgent::setFrontend(InspectorFrontend* frontend)
 {
     m_frontend = frontend->runtime();
-    m_instrumentingAgents->setPageRuntimeAgent(this);
 }
 
 void PageRuntimeAgent::clearFrontend()
 {
-    m_instrumentingAgents->setPageRuntimeAgent(0);
     m_frontend = 0;
     String errorString;
     disable(&errorString);
@@ -98,7 +97,7 @@
     // Only report existing contexts if the page did commit load, otherwise we may
     // unintentionally initialize contexts in the frames which may trigger some listeners
     // that are expected to be triggered only after the load is committed, see http://crbug.com/131623
-    if (m_inspectorAgent->didCommitLoadFired())
+    if (m_mainWorldContextCreated)
         reportExecutionContextCreation();
 }
 
@@ -111,8 +110,10 @@
     m_state->setBoolean(PageRuntimeAgentState::runtimeEnabled, false);
 }
 
-void PageRuntimeAgent::didClearWindowObject(Frame* frame)
+void PageRuntimeAgent::didCreateMainWorldContext(Frame* frame)
 {
+    m_mainWorldContextCreated = true;
+
     if (!m_enabled)
         return;
     ASSERT(m_frontend);

Modified: branches/chromium/1312/Source/WebCore/inspector/PageRuntimeAgent.h (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/PageRuntimeAgent.h	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/PageRuntimeAgent.h	2012-11-06 15:16:17 UTC (rev 133604)
@@ -40,16 +40,15 @@
 
 namespace WebCore {
 
-class InspectorAgent;
 class InspectorPageAgent;
 class Page;
 class SecurityOrigin;
 
 class PageRuntimeAgent : public InspectorRuntimeAgent {
 public:
-    static PassOwnPtr<PageRuntimeAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent, InspectorAgent* inspectorAgent)
+    static PassOwnPtr<PageRuntimeAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, Page* page, InspectorPageAgent* pageAgent)
     {
-        return adoptPtr(new PageRuntimeAgent(instrumentingAgents, state, injectedScriptManager, page, pageAgent, inspectorAgent));
+        return adoptPtr(new PageRuntimeAgent(instrumentingAgents, state, injectedScriptManager, page, pageAgent));
     }
     virtual ~PageRuntimeAgent();
     virtual void setFrontend(InspectorFrontend*);
@@ -58,11 +57,11 @@
     virtual void enable(ErrorString*);
     virtual void disable(ErrorString*);
 
-    void didClearWindowObject(Frame*);
+    void didCreateMainWorldContext(Frame*);
     void didCreateIsolatedContext(Frame*, ScriptState*, SecurityOrigin*);
 
 private:
-    PageRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, Page*, InspectorPageAgent*, InspectorAgent*);
+    PageRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, Page*, InspectorPageAgent*);
 
     virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
     virtual void muteConsole();
@@ -72,8 +71,8 @@
 
     Page* m_inspectedPage;
     InspectorPageAgent* m_pageAgent;
-    InspectorAgent* m_inspectorAgent;
     InspectorFrontend::Runtime* m_frontend;
+    bool m_mainWorldContextCreated;
 };
 
 } // namespace WebCore

Modified: branches/chromium/1312/Source/WebCore/inspector/WorkerRuntimeAgent.cpp (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/WorkerRuntimeAgent.cpp	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/WorkerRuntimeAgent.cpp	2012-11-06 15:16:17 UTC (rev 133604)
@@ -35,18 +35,26 @@
 #include "WorkerRuntimeAgent.h"
 
 #include "InjectedScript.h"
+#include "InstrumentingAgents.h"
 #include "ScriptState.h"
+#include "WorkerContext.h"
+#include "WorkerDebuggerAgent.h"
+#include "WorkerRunLoop.h"
+#include "WorkerThread.h"
 
 namespace WebCore {
 
 WorkerRuntimeAgent::WorkerRuntimeAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state, InjectedScriptManager* injectedScriptManager, WorkerContext* workerContext)
     : InspectorRuntimeAgent(instrumentingAgents, state, injectedScriptManager)
     , m_workerContext(workerContext)
+    , m_paused(false)
 {
+    m_instrumentingAgents->setWorkerRuntimeAgent(this);
 }
 
 WorkerRuntimeAgent::~WorkerRuntimeAgent()
 {
+    m_instrumentingAgents->setWorkerRuntimeAgent(0);
 }
 
 InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId)
@@ -69,6 +77,23 @@
     // We don't need to mute console for workers.
 }
 
+void WorkerRuntimeAgent::run(ErrorString*)
+{
+    m_paused = false;
+}
+
+#if ENABLE(_javascript__DEBUGGER)
+void WorkerRuntimeAgent::pauseWorkerContext(WorkerContext* context)
+{
+    m_paused = true;
+    MessageQueueWaitResult result;
+    do {
+        result = context->thread()->runLoop().runInMode(context, WorkerDebuggerAgent::debuggerTaskMode);
+    // Keep waiting until execution is resumed.
+    } while (result == MessageQueueMessageReceived && m_paused);
+}
+#endif // ENABLE(_javascript__DEBUGGER)
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR) && ENABLE(WORKERS)

Modified: branches/chromium/1312/Source/WebCore/inspector/WorkerRuntimeAgent.h (133603 => 133604)


--- branches/chromium/1312/Source/WebCore/inspector/WorkerRuntimeAgent.h	2012-11-06 15:16:12 UTC (rev 133603)
+++ branches/chromium/1312/Source/WebCore/inspector/WorkerRuntimeAgent.h	2012-11-06 15:16:17 UTC (rev 133604)
@@ -48,12 +48,20 @@
     }
     virtual ~WorkerRuntimeAgent();
 
+    // Protocol commands.
+    virtual void run(ErrorString*);
+
+#if ENABLE(_javascript__DEBUGGER)
+    void pauseWorkerContext(WorkerContext*);
+#endif // ENABLE(_javascript__DEBUGGER)
+
 private:
     WorkerRuntimeAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*, WorkerContext*);
     virtual InjectedScript injectedScriptForEval(ErrorString*, const int* executionContextId);
     virtual void muteConsole();
     virtual void unmuteConsole();
     WorkerContext* m_workerContext;
+    bool m_paused;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to