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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/inspector/WorkerInspectorController.h" | 31 #include "core/inspector/WorkerInspectorController.h" |
32 | 32 |
33 #include "core/InstrumentingAgents.h" | 33 #include "core/InstrumentingAgents.h" |
34 #include "core/inspector/InspectorInstrumentation.h" | 34 #include "core/inspector/InspectorInstrumentation.h" |
35 #include "core/inspector/InspectorLogAgent.h" | 35 #include "core/inspector/InspectorLogAgent.h" |
36 #include "core/inspector/InspectorNetworkAgent.h" | |
37 #include "core/inspector/WorkerThreadDebugger.h" | 36 #include "core/inspector/WorkerThreadDebugger.h" |
38 #include "core/inspector/protocol/Protocol.h" | 37 #include "core/inspector/protocol/Protocol.h" |
39 #include "core/workers/WorkerBackingThread.h" | 38 #include "core/workers/WorkerBackingThread.h" |
40 #include "core/workers/WorkerReportingProxy.h" | 39 #include "core/workers/WorkerReportingProxy.h" |
41 #include "core/workers/WorkerThread.h" | 40 #include "core/workers/WorkerThread.h" |
42 #include "platform/WebThreadSupportingGC.h" | 41 #include "platform/WebThreadSupportingGC.h" |
43 | 42 |
44 namespace blink { | 43 namespace blink { |
45 | 44 |
46 WorkerInspectorController* WorkerInspectorController::create( | 45 WorkerInspectorController* WorkerInspectorController::create( |
47 WorkerThread* thread, | 46 WorkerThread* thread) { |
48 bool networkCapability) { | |
49 WorkerThreadDebugger* debugger = | 47 WorkerThreadDebugger* debugger = |
50 WorkerThreadDebugger::from(thread->isolate()); | 48 WorkerThreadDebugger::from(thread->isolate()); |
51 return debugger ? new WorkerInspectorController(thread, debugger, | 49 return debugger ? new WorkerInspectorController(thread, debugger) : nullptr; |
52 networkCapability) | |
53 : nullptr; | |
54 } | 50 } |
55 | 51 |
56 WorkerInspectorController::WorkerInspectorController( | 52 WorkerInspectorController::WorkerInspectorController( |
57 WorkerThread* thread, | 53 WorkerThread* thread, |
58 WorkerThreadDebugger* debugger, | 54 WorkerThreadDebugger* debugger) |
59 bool networkCapability) | |
60 : m_debugger(debugger), | 55 : m_debugger(debugger), |
61 m_thread(thread), | 56 m_thread(thread), |
62 m_instrumentingAgents(new InstrumentingAgents()), | 57 m_instrumentingAgents(new InstrumentingAgents()) {} |
63 m_networkCapability(networkCapability) {} | |
64 | 58 |
65 WorkerInspectorController::~WorkerInspectorController() { | 59 WorkerInspectorController::~WorkerInspectorController() { |
66 DCHECK(!m_thread); | 60 DCHECK(!m_thread); |
67 } | 61 } |
68 | 62 |
69 void WorkerInspectorController::connectFrontend() { | 63 void WorkerInspectorController::connectFrontend() { |
70 if (m_session) | 64 if (m_session) |
71 return; | 65 return; |
72 | 66 |
73 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification | 67 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification |
74 // call. | 68 // call. |
75 m_session = new InspectorSession( | 69 m_session = new InspectorSession( |
76 this, m_instrumentingAgents.get(), 0, m_debugger->v8Inspector(), | 70 this, m_instrumentingAgents.get(), 0, m_debugger->v8Inspector(), |
77 m_debugger->contextGroupId(m_thread), nullptr); | 71 m_debugger->contextGroupId(m_thread), nullptr); |
78 m_session->append( | 72 m_session->append( |
79 new InspectorLogAgent(m_thread->consoleMessageStorage(), nullptr)); | 73 new InspectorLogAgent(m_thread->consoleMessageStorage(), nullptr)); |
80 if (m_networkCapability) | |
81 m_session->append(InspectorNetworkAgent::create(nullptr)); | |
82 m_thread->workerBackingThread().backingThread().addTaskObserver(this); | 74 m_thread->workerBackingThread().backingThread().addTaskObserver(this); |
83 } | 75 } |
84 | 76 |
85 void WorkerInspectorController::disconnectFrontend() { | 77 void WorkerInspectorController::disconnectFrontend() { |
86 if (!m_session) | 78 if (!m_session) |
87 return; | 79 return; |
88 m_session->dispose(); | 80 m_session->dispose(); |
89 m_session.clear(); | 81 m_session.clear(); |
90 m_thread->workerBackingThread().backingThread().removeTaskObserver(this); | 82 m_thread->workerBackingThread().backingThread().removeTaskObserver(this); |
91 } | 83 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (m_session) | 116 if (m_session) |
125 m_session->flushProtocolNotifications(); | 117 m_session->flushProtocolNotifications(); |
126 } | 118 } |
127 | 119 |
128 DEFINE_TRACE(WorkerInspectorController) { | 120 DEFINE_TRACE(WorkerInspectorController) { |
129 visitor->trace(m_instrumentingAgents); | 121 visitor->trace(m_instrumentingAgents); |
130 visitor->trace(m_session); | 122 visitor->trace(m_session); |
131 } | 123 } |
132 | 124 |
133 } // namespace blink | 125 } // namespace blink |
OLD | NEW |