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

Side by Side Diff: third_party/WebKit/Source/core/inspector/WorkerInspectorController.cpp

Issue 2620463002: Show service worker navigation preload requests in DevTools Network tab (Closed)
Patch Set: fix crash Created 3 years, 10 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
OLDNEW
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
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"
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"
38 #include "core/workers/WorkerBackingThread.h" 39 #include "core/workers/WorkerBackingThread.h"
39 #include "core/workers/WorkerReportingProxy.h" 40 #include "core/workers/WorkerReportingProxy.h"
40 #include "core/workers/WorkerThread.h" 41 #include "core/workers/WorkerThread.h"
41 #include "platform/WebThreadSupportingGC.h" 42 #include "platform/WebThreadSupportingGC.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 WorkerInspectorController* WorkerInspectorController::create( 46 WorkerInspectorController* WorkerInspectorController::create(
46 WorkerThread* thread) { 47 WorkerThread* thread,
48 bool networkCapability) {
47 WorkerThreadDebugger* debugger = 49 WorkerThreadDebugger* debugger =
48 WorkerThreadDebugger::from(thread->isolate()); 50 WorkerThreadDebugger::from(thread->isolate());
49 return debugger ? new WorkerInspectorController(thread, debugger) : nullptr; 51 return debugger ? new WorkerInspectorController(thread, debugger,
52 networkCapability)
53 : nullptr;
50 } 54 }
51 55
52 WorkerInspectorController::WorkerInspectorController( 56 WorkerInspectorController::WorkerInspectorController(
53 WorkerThread* thread, 57 WorkerThread* thread,
54 WorkerThreadDebugger* debugger) 58 WorkerThreadDebugger* debugger,
59 bool networkCapability)
55 : m_debugger(debugger), 60 : m_debugger(debugger),
56 m_thread(thread), 61 m_thread(thread),
57 m_instrumentingAgents(new InstrumentingAgents()) {} 62 m_instrumentingAgents(new InstrumentingAgents()),
63 m_networkCapability(networkCapability) {}
58 64
59 WorkerInspectorController::~WorkerInspectorController() { 65 WorkerInspectorController::~WorkerInspectorController() {
60 DCHECK(!m_thread); 66 DCHECK(!m_thread);
61 } 67 }
62 68
63 void WorkerInspectorController::connectFrontend() { 69 void WorkerInspectorController::connectFrontend() {
64 if (m_session) 70 if (m_session)
65 return; 71 return;
66 72
67 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification 73 // sessionId will be overwritten by WebDevToolsAgent::sendProtocolNotification
68 // call. 74 // call.
69 m_session = new InspectorSession( 75 m_session = new InspectorSession(
70 this, m_instrumentingAgents.get(), 0, m_debugger->v8Inspector(), 76 this, m_instrumentingAgents.get(), 0, m_debugger->v8Inspector(),
71 m_debugger->contextGroupId(m_thread), nullptr); 77 m_debugger->contextGroupId(m_thread), nullptr);
72 m_session->append( 78 m_session->append(
73 new InspectorLogAgent(m_thread->consoleMessageStorage(), nullptr)); 79 new InspectorLogAgent(m_thread->consoleMessageStorage(), nullptr));
80 if (m_networkCapability)
81 m_session->append(InspectorNetworkAgent::create(nullptr));
74 m_thread->workerBackingThread().backingThread().addTaskObserver(this); 82 m_thread->workerBackingThread().backingThread().addTaskObserver(this);
75 } 83 }
76 84
77 void WorkerInspectorController::disconnectFrontend() { 85 void WorkerInspectorController::disconnectFrontend() {
78 if (!m_session) 86 if (!m_session)
79 return; 87 return;
80 m_session->dispose(); 88 m_session->dispose();
81 m_session.clear(); 89 m_session.clear();
82 m_thread->workerBackingThread().backingThread().removeTaskObserver(this); 90 m_thread->workerBackingThread().backingThread().removeTaskObserver(this);
83 } 91 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (m_session) 124 if (m_session)
117 m_session->flushProtocolNotifications(); 125 m_session->flushProtocolNotifications();
118 } 126 }
119 127
120 DEFINE_TRACE(WorkerInspectorController) { 128 DEFINE_TRACE(WorkerInspectorController) {
121 visitor->trace(m_instrumentingAgents); 129 visitor->trace(m_instrumentingAgents);
122 visitor->trace(m_session); 130 visitor->trace(m_session);
123 } 131 }
124 132
125 } // namespace blink 133 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698