OLD | NEW |
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 Loading... |
53 workers_[id] = agent_host; | 53 workers_[id] = agent_host; |
54 return true; | 54 return true; |
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 DCHECK(it != workers_.end()); | 63 if (it == workers_.end()) |
| 64 return; |
64 it->second->WorkerReadyForInspection(); | 65 it->second->WorkerReadyForInspection(); |
65 } | 66 } |
66 | 67 |
67 void SharedWorkerDevToolsManager::WorkerDestroyed( | 68 void SharedWorkerDevToolsManager::WorkerDestroyed( |
68 int worker_process_id, | 69 int worker_process_id, |
69 int worker_route_id) { | 70 int worker_route_id) { |
70 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 71 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
71 const WorkerId id(worker_process_id, worker_route_id); | 72 const WorkerId id(worker_process_id, worker_route_id); |
72 AgentHostMap::iterator it = workers_.find(id); | 73 AgentHostMap::iterator it = workers_.find(id); |
73 DCHECK(it != workers_.end()); | 74 if (it == workers_.end()) |
| 75 return; |
74 scoped_refptr<SharedWorkerDevToolsAgentHost> agent_host(it->second); | 76 scoped_refptr<SharedWorkerDevToolsAgentHost> agent_host(it->second); |
75 agent_host->WorkerDestroyed(); | 77 agent_host->WorkerDestroyed(); |
76 } | 78 } |
77 | 79 |
78 void SharedWorkerDevToolsManager::RemoveInspectedWorkerData(WorkerId id) { | 80 void SharedWorkerDevToolsManager::RemoveInspectedWorkerData(WorkerId id) { |
79 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 81 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
80 workers_.erase(id); | 82 workers_.erase(id); |
81 } | 83 } |
82 SharedWorkerDevToolsManager::SharedWorkerDevToolsManager() { | 84 SharedWorkerDevToolsManager::SharedWorkerDevToolsManager() { |
83 } | 85 } |
(...skipping 11 matching lines...) Expand all Loading... |
95 } | 97 } |
96 return it; | 98 return it; |
97 } | 99 } |
98 | 100 |
99 void SharedWorkerDevToolsManager::ResetForTesting() { | 101 void SharedWorkerDevToolsManager::ResetForTesting() { |
100 workers_.clear(); | 102 workers_.clear(); |
101 } | 103 } |
102 | 104 |
103 | 105 |
104 } // namespace content | 106 } // namespace content |
OLD | NEW |