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

Unified Diff: Source/core/workers/WorkerMessagingProxy.cpp

Issue 466753002: DevTools: Do not push to frontend messages from worker while it is alive (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove unneeded changes Created 6 years, 4 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
Index: Source/core/workers/WorkerMessagingProxy.cpp
diff --git a/Source/core/workers/WorkerMessagingProxy.cpp b/Source/core/workers/WorkerMessagingProxy.cpp
index 081a68272cb06abb18d032731482785d41c54941..77d81832c90d86572f35b82f64d570604b0feae4 100644
--- a/Source/core/workers/WorkerMessagingProxy.cpp
+++ b/Source/core/workers/WorkerMessagingProxy.cpp
@@ -33,8 +33,10 @@
#include "core/dom/Document.h"
#include "core/events/ErrorEvent.h"
#include "core/events/MessageEvent.h"
+#include "core/frame/Console.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/frame/csp/ContentSecurityPolicy.h"
+#include "core/inspector/InspectorConsoleInstrumentation.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/ScriptCallStack.h"
#include "core/inspector/WorkerDebuggerAgent.h"
@@ -176,7 +178,15 @@ void WorkerMessagingProxy::reportConsoleMessage(MessageSource source, MessageLev
{
if (m_askedToTerminate)
return;
- m_executionContext->addConsoleMessage(ConsoleMessage::create(source, level, message, sourceURL, lineNumber));
+
+ // FIXME: In case of nested workers, this should go directly to the root Document context.
+ ASSERT(m_executionContext->isDocument());
+ Document* document = toDocument(m_executionContext.get());
+ LocalDOMWindow* domWindow = document->domWindow();
+ if (!domWindow)
+ return;
vsevik 2014/08/12 14:25:13 Let's use something like pseudo code below: Conso
sergeyv 2014/08/12 15:37:53 Done.
+ domWindow->console().reportMessageToClient(level, message, nullptr);
+ InspectorInstrumentation::addMessageToConsoleFromWorker(m_executionContext.get(), this, ConsoleMessage::create(source, level, message, sourceURL, lineNumber).get());
}
void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<DedicatedWorkerThread> workerThread)

Powered by Google App Engine
This is Rietveld 408576698