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: content/browser/devtools/embedded_worker_devtools_manager.cc

Issue 470923004: DevTools: DevToolsAgentHost::Close/GetURL for service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed crash Created 6 years, 4 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 // 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_impl.h" 7 #include "content/browser/devtools/devtools_manager_impl.h"
8 #include "content/browser/devtools/devtools_protocol.h" 8 #include "content/browser/devtools/devtools_protocol.h"
9 #include "content/browser/devtools/devtools_protocol_constants.h" 9 #include "content/browser/devtools/devtools_protocol_constants.h"
10 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h" 10 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h"
(...skipping 10 matching lines...) Expand all
21 // Called on the UI thread. 21 // Called on the UI thread.
22 // static 22 // static
23 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( 23 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker(
24 int worker_process_id, 24 int worker_process_id,
25 int worker_route_id) { 25 int worker_route_id) {
26 return EmbeddedWorkerDevToolsManager::GetInstance() 26 return EmbeddedWorkerDevToolsManager::GetInstance()
27 ->GetDevToolsAgentHostForWorker(worker_process_id, worker_route_id); 27 ->GetDevToolsAgentHostForWorker(worker_process_id, worker_route_id);
28 } 28 }
29 29
30 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::ServiceWorkerIdentifier( 30 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::ServiceWorkerIdentifier(
31 const ServiceWorkerContextCore* const service_worker_context, 31 const ServiceWorkerContextCore* context,
32 int64 service_worker_version_id) 32 base::WeakPtr<ServiceWorkerContextCore> context_weak,
33 : service_worker_context_(service_worker_context), 33 int64 version_id,
34 service_worker_version_id_(service_worker_version_id) { 34 const GURL& url)
35 : context_(context),
36 context_weak_(context_weak),
37 version_id_(version_id),
38 url_(url) {
35 } 39 }
36 40
37 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::ServiceWorkerIdentifier( 41 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::ServiceWorkerIdentifier(
38 const ServiceWorkerIdentifier& other) 42 const ServiceWorkerIdentifier& other)
39 : service_worker_context_(other.service_worker_context_), 43 : context_(other.context_),
40 service_worker_version_id_(other.service_worker_version_id_) { 44 context_weak_(other.context_weak_),
45 version_id_(other.version_id_),
46 url_(other.url_) {
47 }
48
49 EmbeddedWorkerDevToolsManager::
50 ServiceWorkerIdentifier::~ServiceWorkerIdentifier() {
41 } 51 }
42 52
43 bool EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::Matches( 53 bool EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::Matches(
44 const ServiceWorkerIdentifier& other) const { 54 const ServiceWorkerIdentifier& other) const {
45 return service_worker_context_ == other.service_worker_context_ && 55 return context_ == other.context_ && version_id_ == other.version_id_;
46 service_worker_version_id_ == other.service_worker_version_id_; 56 }
57
58 const ServiceWorkerContextCore*
59 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::context() const {
60 return context_;
61 }
62
63 base::WeakPtr<ServiceWorkerContextCore>
64 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::context_weak() const {
65 return context_weak_;
66 }
67
68 int64
69 EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::version_id() const {
70 return version_id_;
71 }
72
73 GURL EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier::url() const {
74 return url_;
47 } 75 }
48 76
49 // static 77 // static
50 EmbeddedWorkerDevToolsManager* EmbeddedWorkerDevToolsManager::GetInstance() { 78 EmbeddedWorkerDevToolsManager* EmbeddedWorkerDevToolsManager::GetInstance() {
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 79 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
52 return Singleton<EmbeddedWorkerDevToolsManager>::get(); 80 return Singleton<EmbeddedWorkerDevToolsManager>::get();
53 } 81 }
54 82
55 DevToolsAgentHost* EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForWorker( 83 DevToolsAgentHost* EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForWorker(
56 int worker_process_id, 84 int worker_process_id,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 agent_host->WorkerRestarted(id); 179 agent_host->WorkerRestarted(id);
152 workers_.erase(it); 180 workers_.erase(it);
153 workers_[id] = agent_host; 181 workers_[id] = agent_host;
154 } 182 }
155 183
156 void EmbeddedWorkerDevToolsManager::ResetForTesting() { 184 void EmbeddedWorkerDevToolsManager::ResetForTesting() {
157 workers_.clear(); 185 workers_.clear();
158 } 186 }
159 187
160 } // namespace content 188 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698