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

Unified Diff: Source/core/inspector/WorkerInspectorController.cpp

Issue 1163923005: Fix crash in inspector-protocol/debugger/debugger-pause-dedicated-worker.html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed printf Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/WorkerInspectorController.h ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/WorkerInspectorController.cpp
diff --git a/Source/core/inspector/WorkerInspectorController.cpp b/Source/core/inspector/WorkerInspectorController.cpp
index 47e45ae45cb0a5b8dbd9bc2e389c59b148c40270..6db1770b86001feafabfed3029e8127f83b688ba 100644
--- a/Source/core/inspector/WorkerInspectorController.cpp
+++ b/Source/core/inspector/WorkerInspectorController.cpp
@@ -32,6 +32,7 @@
#include "core/inspector/WorkerInspectorController.h"
+#include "bindings/core/v8/WorkerThreadDebugger.h"
#include "core/InspectorBackendDispatcher.h"
#include "core/InspectorFrontend.h"
#include "core/inspector/AsyncCallTracker.h"
@@ -44,6 +45,7 @@
#include "core/inspector/InspectorProfilerAgent.h"
#include "core/inspector/InspectorState.h"
#include "core/inspector/InspectorStateClient.h"
+#include "core/inspector/InspectorTaskRunner.h"
#include "core/inspector/InspectorTimelineAgent.h"
#include "core/inspector/InstrumentingAgents.h"
#include "core/inspector/WorkerConsoleAgent.h"
@@ -87,6 +89,24 @@ private:
virtual void updateInspectorStateCookie(const String& cookie) override { }
};
+class RunInspectorCommandsTask final : public InspectorTaskRunner::Task {
+public:
+ explicit RunInspectorCommandsTask(WorkerThread* thread)
+ : m_thread(thread) { }
+ virtual ~RunInspectorCommandsTask() { }
+ virtual void run() override
+ {
+ // Process all queued debugger commands. WorkerThread is certainly
+ // alive if this task is being executed.
+ m_thread->willEnterNestedLoop();
+ while (MessageQueueMessageReceived == m_thread->runDebuggerTask(WorkerThread::DontWaitForMessage)) { }
+ m_thread->didLeaveNestedLoop();
+ }
+
+private:
+ WorkerThread* m_thread;
+};
+
}
class WorkerInjectedScriptHostClient: public InjectedScriptHostClient {
@@ -104,6 +124,7 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl
, m_injectedScriptManager(InjectedScriptManager::createForWorker())
, m_workerThreadDebugger(WorkerThreadDebugger::create(workerGlobalScope))
, m_agents(m_instrumentingAgents.get(), m_state.get())
+ , m_inspectorTaskRunner(adoptPtr(new InspectorTaskRunner(v8::Isolate::GetCurrent())))
, m_paused(false)
{
OwnPtrWillBeRawPtr<WorkerRuntimeAgent> workerRuntimeAgent = WorkerRuntimeAgent::create(m_injectedScriptManager.get(), m_workerThreadDebugger->debugger(), workerGlobalScope, this);
@@ -174,8 +195,10 @@ void WorkerInspectorController::restoreInspectorStateFromCookie(const String& in
void WorkerInspectorController::dispatchMessageFromFrontend(const String& message)
{
+ m_inspectorTaskRunner->setIgnoreInterrupts(true);
if (m_backendDispatcher)
m_backendDispatcher->dispatch(message);
+ m_inspectorTaskRunner->setIgnoreInterrupts(false);
}
void WorkerInspectorController::dispose()
@@ -186,7 +209,7 @@ void WorkerInspectorController::dispose()
void WorkerInspectorController::interruptAndDispatchInspectorCommands()
{
- m_workerDebuggerAgent->interruptAndDispatchInspectorCommands();
+ m_inspectorTaskRunner->interruptAndRun(adoptPtr(new RunInspectorCommandsTask(m_workerGlobalScope->thread())));
}
void WorkerInspectorController::resumeStartup()
« no previous file with comments | « Source/core/inspector/WorkerInspectorController.h ('k') | Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698