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

Side by Side Diff: content/browser/devtools/embedded_worker_devtools_manager.cc

Issue 814513003: Split EmbeddedWorkerDevToolsAgentHost into two for Shared- and ServiceWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed horo's comments Created 6 years 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/embedded_worker_devtools_manager.h" 5 #include "content/browser/devtools/embedded_worker_devtools_manager.h"
6 6
7 #include "content/browser/devtools/devtools_manager.h" 7 #include "content/browser/devtools/devtools_manager.h"
8 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h"
9 #include "content/browser/devtools/ipc_devtools_agent_host.h" 8 #include "content/browser/devtools/ipc_devtools_agent_host.h"
9 #include "content/browser/devtools/service_worker_devtools_agent_host.h"
10 #include "content/browser/devtools/shared_worker_devtools_agent_host.h"
10 #include "content/browser/shared_worker/shared_worker_instance.h" 11 #include "content/browser/shared_worker/shared_worker_instance.h"
11 #include "content/common/devtools_messages.h" 12 #include "content/common/devtools_messages.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/worker_service.h" 15 #include "content/public/browser/worker_service.h"
15 #include "ipc/ipc_listener.h" 16 #include "ipc/ipc_listener.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 // Called on the UI thread. 20 // Called on the UI thread.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 96 }
96 97
97 bool EmbeddedWorkerDevToolsManager::SharedWorkerCreated( 98 bool EmbeddedWorkerDevToolsManager::SharedWorkerCreated(
98 int worker_process_id, 99 int worker_process_id,
99 int worker_route_id, 100 int worker_route_id,
100 const SharedWorkerInstance& instance) { 101 const SharedWorkerInstance& instance) {
101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
102 const WorkerId id(worker_process_id, worker_route_id); 103 const WorkerId id(worker_process_id, worker_route_id);
103 AgentHostMap::iterator it = FindExistingSharedWorkerAgentHost(instance); 104 AgentHostMap::iterator it = FindExistingSharedWorkerAgentHost(instance);
104 if (it == workers_.end()) { 105 if (it == workers_.end()) {
105 workers_[id] = new EmbeddedWorkerDevToolsAgentHost(id, instance); 106 workers_[id] = new SharedWorkerDevToolsAgentHost(id, instance);
106 DevToolsManager::GetInstance()->AgentHostChanged(workers_[id]); 107 DevToolsManager::GetInstance()->AgentHostChanged(workers_[id]);
107 return false; 108 return false;
108 } 109 }
109 WorkerRestarted(id, it); 110 WorkerRestarted(id, it);
110 return true; 111 return true;
111 } 112 }
112 113
113 bool EmbeddedWorkerDevToolsManager::ServiceWorkerCreated( 114 bool EmbeddedWorkerDevToolsManager::ServiceWorkerCreated(
114 int worker_process_id, 115 int worker_process_id,
115 int worker_route_id, 116 int worker_route_id,
116 const ServiceWorkerIdentifier& service_worker_id) { 117 const ServiceWorkerIdentifier& service_worker_id) {
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
118 const WorkerId id(worker_process_id, worker_route_id); 119 const WorkerId id(worker_process_id, worker_route_id);
119 AgentHostMap::iterator it = 120 AgentHostMap::iterator it =
120 FindExistingServiceWorkerAgentHost(service_worker_id); 121 FindExistingServiceWorkerAgentHost(service_worker_id);
121 if (it == workers_.end()) { 122 if (it == workers_.end()) {
122 workers_[id] = new EmbeddedWorkerDevToolsAgentHost( 123 workers_[id] = new ServiceWorkerDevToolsAgentHost(
123 id, service_worker_id, debug_service_worker_on_start_); 124 id, service_worker_id, debug_service_worker_on_start_);
124 DevToolsManager::GetInstance()->AgentHostChanged(workers_[id]); 125 DevToolsManager::GetInstance()->AgentHostChanged(workers_[id]);
125 return debug_service_worker_on_start_; 126 return debug_service_worker_on_start_;
126 } 127 }
127 WorkerRestarted(id, it); 128 WorkerRestarted(id, it);
128 return true; 129 return true;
129 } 130 }
130 131
131 void EmbeddedWorkerDevToolsManager::WorkerDestroyed(int worker_process_id, 132 void EmbeddedWorkerDevToolsManager::WorkerDestroyed(int worker_process_id,
132 int worker_route_id) { 133 int worker_route_id) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 workers_.erase(it); 204 workers_.erase(it);
204 workers_[id] = agent_host; 205 workers_[id] = agent_host;
205 DevToolsManager::GetInstance()->AgentHostChanged(agent_host); 206 DevToolsManager::GetInstance()->AgentHostChanged(agent_host);
206 } 207 }
207 208
208 void EmbeddedWorkerDevToolsManager::ResetForTesting() { 209 void EmbeddedWorkerDevToolsManager::ResetForTesting() {
209 workers_.clear(); 210 workers_.clear();
210 } 211 }
211 212
212 } // namespace content 213 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698