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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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/CoreProbeSink.h" | 33 #include "core/CoreProbeSink.h" |
34 #include "core/inspector/InspectorLogAgent.h" | 34 #include "core/inspector/InspectorLogAgent.h" |
| 35 #include "core/inspector/InspectorNetworkAgent.h" |
35 #include "core/inspector/InspectorTraceEvents.h" | 36 #include "core/inspector/InspectorTraceEvents.h" |
36 #include "core/inspector/WorkerThreadDebugger.h" | 37 #include "core/inspector/WorkerThreadDebugger.h" |
37 #include "core/inspector/protocol/Protocol.h" | 38 #include "core/inspector/protocol/Protocol.h" |
| 39 #include "core/loader/WorkerFetchContext.h" |
38 #include "core/probe/CoreProbes.h" | 40 #include "core/probe/CoreProbes.h" |
39 #include "core/workers/WorkerBackingThread.h" | 41 #include "core/workers/WorkerBackingThread.h" |
| 42 #include "core/workers/WorkerGlobalScope.h" |
40 #include "core/workers/WorkerReportingProxy.h" | 43 #include "core/workers/WorkerReportingProxy.h" |
41 #include "core/workers/WorkerThread.h" | 44 #include "core/workers/WorkerThread.h" |
| 45 #include "platform/RuntimeEnabledFeatures.h" |
42 #include "platform/WebThreadSupportingGC.h" | 46 #include "platform/WebThreadSupportingGC.h" |
43 | 47 |
44 namespace blink { | 48 namespace blink { |
45 | 49 |
46 WorkerInspectorController* WorkerInspectorController::Create( | 50 WorkerInspectorController* WorkerInspectorController::Create( |
47 WorkerThread* thread) { | 51 WorkerThread* thread) { |
48 WorkerThreadDebugger* debugger = | 52 WorkerThreadDebugger* debugger = |
49 WorkerThreadDebugger::From(thread->GetIsolate()); | 53 WorkerThreadDebugger::From(thread->GetIsolate()); |
50 return debugger ? new WorkerInspectorController(thread, debugger) : nullptr; | 54 return debugger ? new WorkerInspectorController(thread, debugger) : nullptr; |
51 } | 55 } |
(...skipping 11 matching lines...) Expand all Loading... |
63 | 67 |
64 void WorkerInspectorController::ConnectFrontend(int session_id) { | 68 void WorkerInspectorController::ConnectFrontend(int session_id) { |
65 if (sessions_.find(session_id) != sessions_.end()) | 69 if (sessions_.find(session_id) != sessions_.end()) |
66 return; | 70 return; |
67 | 71 |
68 InspectorSession* session = new InspectorSession( | 72 InspectorSession* session = new InspectorSession( |
69 this, probe_sink_.Get(), session_id, debugger_->GetV8Inspector(), | 73 this, probe_sink_.Get(), session_id, debugger_->GetV8Inspector(), |
70 debugger_->ContextGroupId(thread_), nullptr); | 74 debugger_->ContextGroupId(thread_), nullptr); |
71 session->Append( | 75 session->Append( |
72 new InspectorLogAgent(thread_->GetConsoleMessageStorage(), nullptr)); | 76 new InspectorLogAgent(thread_->GetConsoleMessageStorage(), nullptr)); |
| 77 if (thread_->GlobalScope()->IsWorkerGlobalScope() && |
| 78 RuntimeEnabledFeatures::OffMainThreadFetchEnabled()) { |
| 79 DCHECK(ToWorkerGlobalScope(thread_->GlobalScope())->GetFetchContext()); |
| 80 session->Append(InspectorNetworkAgent::CreateForWorker( |
| 81 ToWorkerGlobalScope(thread_->GlobalScope()))); |
| 82 } |
73 if (sessions_.IsEmpty()) | 83 if (sessions_.IsEmpty()) |
74 thread_->GetWorkerBackingThread().BackingThread().AddTaskObserver(this); | 84 thread_->GetWorkerBackingThread().BackingThread().AddTaskObserver(this); |
75 sessions_.insert(session_id, session); | 85 sessions_.insert(session_id, session); |
76 } | 86 } |
77 | 87 |
78 void WorkerInspectorController::DisconnectFrontend(int session_id) { | 88 void WorkerInspectorController::DisconnectFrontend(int session_id) { |
79 auto it = sessions_.find(session_id); | 89 auto it = sessions_.find(session_id); |
80 if (it == sessions_.end()) | 90 if (it == sessions_.end()) |
81 return; | 91 return; |
82 it->value->Dispose(); | 92 it->value->Dispose(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 for (auto& it : sessions_) | 135 for (auto& it : sessions_) |
126 it.value->flushProtocolNotifications(); | 136 it.value->flushProtocolNotifications(); |
127 } | 137 } |
128 | 138 |
129 DEFINE_TRACE(WorkerInspectorController) { | 139 DEFINE_TRACE(WorkerInspectorController) { |
130 visitor->Trace(probe_sink_); | 140 visitor->Trace(probe_sink_); |
131 visitor->Trace(sessions_); | 141 visitor->Trace(sessions_); |
132 } | 142 } |
133 | 143 |
134 } // namespace blink | 144 } // namespace blink |
OLD | NEW |