| 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 13 matching lines...) Expand all Loading... |
| 65 if (session_) | 69 if (session_) |
| 66 return; | 70 return; |
| 67 | 71 |
| 68 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification | 72 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification |
| 69 // call. | 73 // call. |
| 70 session_ = new InspectorSession(this, probe_sink_.Get(), 0, | 74 session_ = new InspectorSession(this, probe_sink_.Get(), 0, |
| 71 debugger_->GetV8Inspector(), | 75 debugger_->GetV8Inspector(), |
| 72 debugger_->ContextGroupId(thread_), nullptr); | 76 debugger_->ContextGroupId(thread_), nullptr); |
| 73 session_->Append( | 77 session_->Append( |
| 74 new InspectorLogAgent(thread_->GetConsoleMessageStorage(), nullptr)); | 78 new InspectorLogAgent(thread_->GetConsoleMessageStorage(), nullptr)); |
| 79 if (thread_->GlobalScope()->IsWorkerGlobalScope() && |
| 80 RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
| 81 DCHECK(ToWorkerGlobalScope(thread_->GlobalScope())->GetFetchContext()); |
| 82 session_->Append(InspectorNetworkAgent::CreateForWorker( |
| 83 ToWorkerGlobalScope(thread_->GlobalScope()))); |
| 84 } |
| 75 thread_->GetWorkerBackingThread().BackingThread().AddTaskObserver(this); | 85 thread_->GetWorkerBackingThread().BackingThread().AddTaskObserver(this); |
| 76 } | 86 } |
| 77 | 87 |
| 78 void WorkerInspectorController::DisconnectFrontend() { | 88 void WorkerInspectorController::DisconnectFrontend() { |
| 79 if (!session_) | 89 if (!session_) |
| 80 return; | 90 return; |
| 81 session_->Dispose(); | 91 session_->Dispose(); |
| 82 session_.Clear(); | 92 session_.Clear(); |
| 83 thread_->GetWorkerBackingThread().BackingThread().RemoveTaskObserver(this); | 93 thread_->GetWorkerBackingThread().BackingThread().RemoveTaskObserver(this); |
| 84 } | 94 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 if (session_) | 127 if (session_) |
| 118 session_->flushProtocolNotifications(); | 128 session_->flushProtocolNotifications(); |
| 119 } | 129 } |
| 120 | 130 |
| 121 DEFINE_TRACE(WorkerInspectorController) { | 131 DEFINE_TRACE(WorkerInspectorController) { |
| 122 visitor->Trace(probe_sink_); | 132 visitor->Trace(probe_sink_); |
| 123 visitor->Trace(session_); | 133 visitor->Trace(session_); |
| 124 } | 134 } |
| 125 | 135 |
| 126 } // namespace blink | 136 } // namespace blink |
| OLD | NEW |