| 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" |
| 42 #include "platform/WebThreadSupportingGC.h" | 45 #include "platform/WebThreadSupportingGC.h" |
| 43 | 46 |
| 44 namespace blink { | 47 namespace blink { |
| 45 | 48 |
| 46 WorkerInspectorController* WorkerInspectorController::Create( | 49 WorkerInspectorController* WorkerInspectorController::Create( |
| 47 WorkerThread* thread) { | 50 WorkerThread* thread) { |
| 48 WorkerThreadDebugger* debugger = | 51 WorkerThreadDebugger* debugger = |
| 49 WorkerThreadDebugger::From(thread->GetIsolate()); | 52 WorkerThreadDebugger::From(thread->GetIsolate()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 67 if (session_) | 70 if (session_) |
| 68 return; | 71 return; |
| 69 | 72 |
| 70 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification | 73 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification |
| 71 // call. | 74 // call. |
| 72 session_ = new InspectorSession(this, instrumenting_agents_.Get(), 0, | 75 session_ = new InspectorSession(this, instrumenting_agents_.Get(), 0, |
| 73 debugger_->GetV8Inspector(), | 76 debugger_->GetV8Inspector(), |
| 74 debugger_->ContextGroupId(thread_), nullptr); | 77 debugger_->ContextGroupId(thread_), nullptr); |
| 75 session_->Append( | 78 session_->Append( |
| 76 new InspectorLogAgent(thread_->GetConsoleMessageStorage(), nullptr)); | 79 new InspectorLogAgent(thread_->GetConsoleMessageStorage(), nullptr)); |
| 80 if (thread_->GlobalScope()->IsWorkerGlobalScope()) { |
| 81 WorkerFetchContext* worker_fetch_contrext = |
| 82 ToWorkerGlobalScope(thread_->GlobalScope())->FetchContext(); |
| 83 if (worker_fetch_contrext) { |
| 84 session_->Append(InspectorNetworkAgent::Create(nullptr)); |
| 85 } |
| 86 } |
| 77 thread_->GetWorkerBackingThread().BackingThread().AddTaskObserver(this); | 87 thread_->GetWorkerBackingThread().BackingThread().AddTaskObserver(this); |
| 78 } | 88 } |
| 79 | 89 |
| 80 void WorkerInspectorController::DisconnectFrontend() { | 90 void WorkerInspectorController::DisconnectFrontend() { |
| 81 if (!session_) | 91 if (!session_) |
| 82 return; | 92 return; |
| 83 session_->Dispose(); | 93 session_->Dispose(); |
| 84 session_.Clear(); | 94 session_.Clear(); |
| 85 thread_->GetWorkerBackingThread().BackingThread().RemoveTaskObserver(this); | 95 thread_->GetWorkerBackingThread().BackingThread().RemoveTaskObserver(this); |
| 86 } | 96 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 if (session_) | 129 if (session_) |
| 120 session_->flushProtocolNotifications(); | 130 session_->flushProtocolNotifications(); |
| 121 } | 131 } |
| 122 | 132 |
| 123 DEFINE_TRACE(WorkerInspectorController) { | 133 DEFINE_TRACE(WorkerInspectorController) { |
| 124 visitor->Trace(instrumenting_agents_); | 134 visitor->Trace(instrumenting_agents_); |
| 125 visitor->Trace(session_); | 135 visitor->Trace(session_); |
| 126 } | 136 } |
| 127 | 137 |
| 128 } // namespace blink | 138 } // namespace blink |
| OLD | NEW |