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

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

Issue 988003002: DevTools: pick sw targets to attach to on the backend side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 5 years, 9 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/service_worker_devtools_agent_host.h" 5 #include "content/browser/devtools/service_worker_devtools_agent_host.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/browser/devtools/service_worker_devtools_manager.h" 8 #include "content/browser/devtools/service_worker_devtools_manager.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_version.h" 10 #include "content/browser/service_worker/service_worker_version.h"
(...skipping 22 matching lines...) Expand all
33 if (ServiceWorkerContextCore* context = context_weak.get()) { 33 if (ServiceWorkerContextCore* context = context_weak.get()) {
34 if (ServiceWorkerVersion* version = context->GetLiveVersion(version_id)) 34 if (ServiceWorkerVersion* version = context->GetLiveVersion(version_id))
35 version->SetDevToolsAttached(attached); 35 version->SetDevToolsAttached(attached);
36 } 36 }
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 ServiceWorkerDevToolsAgentHost::ServiceWorkerDevToolsAgentHost( 41 ServiceWorkerDevToolsAgentHost::ServiceWorkerDevToolsAgentHost(
42 WorkerId worker_id, 42 WorkerId worker_id,
43 const ServiceWorkerIdentifier& service_worker, 43 const ServiceWorkerIdentifier& service_worker)
44 bool debug_service_worker_on_start)
45 : WorkerDevToolsAgentHost(worker_id), 44 : WorkerDevToolsAgentHost(worker_id),
46 service_worker_(new ServiceWorkerIdentifier(service_worker)) { 45 service_worker_(new ServiceWorkerIdentifier(service_worker)) {
47 if (debug_service_worker_on_start)
48 set_state(WORKER_PAUSED_FOR_DEBUG_ON_START);
49 } 46 }
50 47
51 DevToolsAgentHost::Type ServiceWorkerDevToolsAgentHost::GetType() { 48 DevToolsAgentHost::Type ServiceWorkerDevToolsAgentHost::GetType() {
52 return TYPE_SERVICE_WORKER; 49 return TYPE_SERVICE_WORKER;
53 } 50 }
54 51
55 std::string ServiceWorkerDevToolsAgentHost::GetTitle() { 52 std::string ServiceWorkerDevToolsAgentHost::GetTitle() {
56 if (RenderProcessHost* host = RenderProcessHost::FromID(worker_id().first)) { 53 if (RenderProcessHost* host = RenderProcessHost::FromID(worker_id().first)) {
57 return base::StringPrintf("Worker pid:%d", 54 return base::StringPrintf("Worker pid:%d",
58 base::GetProcId(host->GetHandle())); 55 base::GetProcId(host->GetHandle()));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const ServiceWorkerIdentifier& other) { 95 const ServiceWorkerIdentifier& other) {
99 return service_worker_->Matches(other); 96 return service_worker_->Matches(other);
100 } 97 }
101 98
102 ServiceWorkerDevToolsAgentHost::~ServiceWorkerDevToolsAgentHost() { 99 ServiceWorkerDevToolsAgentHost::~ServiceWorkerDevToolsAgentHost() {
103 ServiceWorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData( 100 ServiceWorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData(
104 worker_id()); 101 worker_id());
105 } 102 }
106 103
107 } // namespace content 104 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698