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

Side by Side Diff: Source/core/workers/WorkerInspectorProxy.cpp

Issue 1115923002: workers: Rename WorkerThread to WorkerScript. Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "core/workers/WorkerInspectorProxy.h" 7 #include "core/workers/WorkerInspectorProxy.h"
8 8
9 #include "core/dom/CrossThreadTask.h" 9 #include "core/dom/CrossThreadTask.h"
10 #include "core/inspector/InspectorInstrumentation.h" 10 #include "core/inspector/InspectorInstrumentation.h"
11 #include "core/inspector/InspectorTraceEvents.h" 11 #include "core/inspector/InspectorTraceEvents.h"
12 #include "core/inspector/WorkerInspectorController.h" 12 #include "core/inspector/WorkerInspectorController.h"
13 #include "core/workers/WorkerThread.h" 13 #include "core/workers/WorkerScript.h"
14 #include "platform/TraceEvent.h" 14 #include "platform/TraceEvent.h"
15 #include "platform/weborigin/KURL.h" 15 #include "platform/weborigin/KURL.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 WorkerInspectorProxy::WorkerInspectorProxy() 19 WorkerInspectorProxy::WorkerInspectorProxy()
20 : m_workerThread(nullptr) 20 : m_workerScript(nullptr)
21 , m_executionContext(nullptr) 21 , m_executionContext(nullptr)
22 , m_pageInspector(nullptr) 22 , m_pageInspector(nullptr)
23 , m_workerGlobalScopeProxy(nullptr) 23 , m_workerGlobalScopeProxy(nullptr)
24 { 24 {
25 } 25 }
26 26
27 PassOwnPtr<WorkerInspectorProxy> WorkerInspectorProxy::create() 27 PassOwnPtr<WorkerInspectorProxy> WorkerInspectorProxy::create()
28 { 28 {
29 return adoptPtr(new WorkerInspectorProxy()); 29 return adoptPtr(new WorkerInspectorProxy());
30 } 30 }
31 31
32 WorkerInspectorProxy::~WorkerInspectorProxy() 32 WorkerInspectorProxy::~WorkerInspectorProxy()
33 { 33 {
34 } 34 }
35 35
36 void WorkerInspectorProxy::workerThreadCreated(ExecutionContext* context, Worker Thread* workerThread, const KURL& url) 36 void WorkerInspectorProxy::workerScriptCreated(ExecutionContext* context, Worker Script* workerScript, const KURL& url)
37 { 37 {
38 m_workerThread = workerThread; 38 m_workerScript = workerScript;
39 m_executionContext = context; 39 m_executionContext = context;
40 InspectorInstrumentation::didStartWorker(context, this, url); 40 InspectorInstrumentation::didStartWorker(context, this, url);
41 } 41 }
42 42
43 void WorkerInspectorProxy::workerThreadTerminated() 43 void WorkerInspectorProxy::workerScriptTerminated()
44 { 44 {
45 if (m_workerThread) 45 if (m_workerScript)
46 InspectorInstrumentation::workerTerminated(m_executionContext, this); 46 InspectorInstrumentation::workerTerminated(m_executionContext, this);
47 m_workerThread = nullptr; 47 m_workerScript = nullptr;
48 m_pageInspector = nullptr; 48 m_pageInspector = nullptr;
49 } 49 }
50 50
51 static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context) 51 static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context)
52 { 52 {
53 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend() ; 53 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend() ;
54 } 54 }
55 55
56 void WorkerInspectorProxy::connectToInspector(WorkerInspectorProxy::PageInspecto r* pageInspector) 56 void WorkerInspectorProxy::connectToInspector(WorkerInspectorProxy::PageInspecto r* pageInspector)
57 { 57 {
58 if (!m_workerThread) 58 if (!m_workerScript)
59 return; 59 return;
60 ASSERT(!m_pageInspector); 60 ASSERT(!m_pageInspector);
61 m_pageInspector = pageInspector; 61 m_pageInspector = pageInspector;
62 m_workerThread->postDebuggerTask(FROM_HERE, createCrossThreadTask(connectToW orkerGlobalScopeInspectorTask)); 62 m_workerScript->postDebuggerTask(FROM_HERE, createCrossThreadTask(connectToW orkerGlobalScopeInspectorTask));
63 } 63 }
64 64
65 static void disconnectFromWorkerGlobalScopeInspectorTask(ExecutionContext* conte xt) 65 static void disconnectFromWorkerGlobalScopeInspectorTask(ExecutionContext* conte xt)
66 { 66 {
67 toWorkerGlobalScope(context)->workerInspectorController()->disconnectFronten d(); 67 toWorkerGlobalScope(context)->workerInspectorController()->disconnectFronten d();
68 } 68 }
69 69
70 void WorkerInspectorProxy::disconnectFromInspector() 70 void WorkerInspectorProxy::disconnectFromInspector()
71 { 71 {
72 m_pageInspector = nullptr; 72 m_pageInspector = nullptr;
73 if (!m_workerThread) 73 if (!m_workerScript)
74 return; 74 return;
75 m_workerThread->postDebuggerTask(FROM_HERE, createCrossThreadTask(disconnect FromWorkerGlobalScopeInspectorTask)); 75 m_workerScript->postDebuggerTask(FROM_HERE, createCrossThreadTask(disconnect FromWorkerGlobalScopeInspectorTask));
76 } 76 }
77 77
78 static void dispatchOnInspectorBackendTask(const String& message, ExecutionConte xt* context) 78 static void dispatchOnInspectorBackendTask(const String& message, ExecutionConte xt* context)
79 { 79 {
80 toWorkerGlobalScope(context)->workerInspectorController()->dispatchMessageFr omFrontend(message); 80 toWorkerGlobalScope(context)->workerInspectorController()->dispatchMessageFr omFrontend(message);
81 } 81 }
82 82
83 void WorkerInspectorProxy::sendMessageToInspector(const String& message) 83 void WorkerInspectorProxy::sendMessageToInspector(const String& message)
84 { 84 {
85 if (!m_workerThread) 85 if (!m_workerScript)
86 return; 86 return;
87 m_workerThread->postDebuggerTask(FROM_HERE, createCrossThreadTask(dispatchOn InspectorBackendTask, message)); 87 m_workerScript->postDebuggerTask(FROM_HERE, createCrossThreadTask(dispatchOn InspectorBackendTask, message));
88 m_workerThread->interruptAndDispatchInspectorCommands(); 88 m_workerScript->interruptAndDispatchInspectorCommands();
89 } 89 }
90 90
91 void WorkerInspectorProxy::writeTimelineStartedEvent(const String& sessionId, co nst String& workerId) 91 void WorkerInspectorProxy::writeTimelineStartedEvent(const String& sessionId, co nst String& workerId)
92 { 92 {
93 if (!m_workerThread) 93 if (!m_workerScript)
94 return; 94 return;
95 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Tracin gSessionIdForWorker", TRACE_EVENT_SCOPE_THREAD, "data", InspectorTracingSessionI dForWorkerEvent::data(sessionId, workerId, m_workerThread)); 95 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Tracin gSessionIdForWorker", TRACE_EVENT_SCOPE_THREAD, "data", InspectorTracingSessionI dForWorkerEvent::data(sessionId, workerId, m_workerScript));
96 } 96 }
97 97
98 } // namespace blink 98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698