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

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

Issue 2000233003: DevTools: do not report worker destroyed twice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shared_worker_devtools_manager.h" 5 #include "content/browser/devtools/shared_worker_devtools_manager.h"
6 6
7 #include "content/browser/devtools/shared_worker_devtools_agent_host.h" 7 #include "content/browser/devtools/shared_worker_devtools_agent_host.h"
8 #include "content/browser/shared_worker/shared_worker_instance.h" 8 #include "content/browser/shared_worker/shared_worker_instance.h"
9 #include "content/public/browser/browser_thread.h" 9 #include "content/public/browser/browser_thread.h"
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 workers_[id] = agent_host; 53 workers_[id] = agent_host;
54 return agent_host->IsAttached(); 54 return agent_host->IsAttached();
55 } 55 }
56 56
57 void SharedWorkerDevToolsManager::WorkerReadyForInspection( 57 void SharedWorkerDevToolsManager::WorkerReadyForInspection(
58 int worker_process_id, 58 int worker_process_id,
59 int worker_route_id) { 59 int worker_route_id) {
60 DCHECK_CURRENTLY_ON(BrowserThread::UI); 60 DCHECK_CURRENTLY_ON(BrowserThread::UI);
61 const WorkerId id(worker_process_id, worker_route_id); 61 const WorkerId id(worker_process_id, worker_route_id);
62 AgentHostMap::iterator it = workers_.find(id); 62 AgentHostMap::iterator it = workers_.find(id);
63 if (it == workers_.end()) 63 if (it == workers_.end() || it->second->IsTerminated())
64 return; 64 return;
65 it->second->WorkerReadyForInspection(); 65 it->second->WorkerReadyForInspection();
66 } 66 }
67 67
68 void SharedWorkerDevToolsManager::WorkerDestroyed( 68 void SharedWorkerDevToolsManager::WorkerDestroyed(
69 int worker_process_id, 69 int worker_process_id,
70 int worker_route_id) { 70 int worker_route_id) {
71 DCHECK_CURRENTLY_ON(BrowserThread::UI); 71 DCHECK_CURRENTLY_ON(BrowserThread::UI);
72 const WorkerId id(worker_process_id, worker_route_id); 72 const WorkerId id(worker_process_id, worker_route_id);
73 AgentHostMap::iterator it = workers_.find(id); 73 AgentHostMap::iterator it = workers_.find(id);
74 if (it == workers_.end()) 74 if (it == workers_.end() || it->second->IsTerminated())
75 return; 75 return;
76 scoped_refptr<SharedWorkerDevToolsAgentHost> agent_host(it->second); 76 scoped_refptr<SharedWorkerDevToolsAgentHost> agent_host(it->second);
77 agent_host->WorkerDestroyed(); 77 agent_host->WorkerDestroyed();
78 } 78 }
79 79
80 void SharedWorkerDevToolsManager::RemoveInspectedWorkerData(WorkerId id) { 80 void SharedWorkerDevToolsManager::RemoveInspectedWorkerData(WorkerId id) {
81 DCHECK_CURRENTLY_ON(BrowserThread::UI); 81 DCHECK_CURRENTLY_ON(BrowserThread::UI);
82 workers_.erase(id); 82 workers_.erase(id);
83 } 83 }
84 SharedWorkerDevToolsManager::SharedWorkerDevToolsManager() { 84 SharedWorkerDevToolsManager::SharedWorkerDevToolsManager() {
(...skipping 12 matching lines...) Expand all
97 } 97 }
98 return it; 98 return it;
99 } 99 }
100 100
101 void SharedWorkerDevToolsManager::ResetForTesting() { 101 void SharedWorkerDevToolsManager::ResetForTesting() {
102 workers_.clear(); 102 workers_.clear();
103 } 103 }
104 104
105 105
106 } // namespace content 106 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698