| 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_agent_host.h" | 5 #include "content/browser/devtools/shared_worker_devtools_agent_host.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/browser/devtools/devtools_manager.h" |
| 8 #include "content/browser/devtools/shared_worker_devtools_manager.h" | 9 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
| 9 #include "content/browser/shared_worker/shared_worker_instance.h" | 10 #include "content/browser/shared_worker/shared_worker_instance.h" |
| 10 #include "content/browser/shared_worker/shared_worker_service_impl.h" | 11 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
| 11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 void TerminateSharedWorkerOnIO( | 18 void TerminateSharedWorkerOnIO( |
| 18 WorkerDevToolsAgentHost::WorkerId worker_id) { | 19 WorkerDevToolsAgentHost::WorkerId worker_id) { |
| 19 SharedWorkerServiceImpl::GetInstance()->TerminateWorker( | 20 SharedWorkerServiceImpl::GetInstance()->TerminateWorker( |
| 20 worker_id.first, worker_id.second); | 21 worker_id.first, worker_id.second); |
| 21 } | 22 } |
| 22 | 23 |
| 23 } // namespace | 24 } // namespace |
| 24 | 25 |
| 25 SharedWorkerDevToolsAgentHost::SharedWorkerDevToolsAgentHost( | 26 SharedWorkerDevToolsAgentHost::SharedWorkerDevToolsAgentHost( |
| 26 WorkerId worker_id, | 27 WorkerId worker_id, |
| 27 const SharedWorkerInstance& shared_worker) | 28 const SharedWorkerInstance& shared_worker) |
| 28 : WorkerDevToolsAgentHost(worker_id), | 29 : WorkerDevToolsAgentHost(worker_id), |
| 29 shared_worker_(new SharedWorkerInstance(shared_worker)) { | 30 shared_worker_(new SharedWorkerInstance(shared_worker)) { |
| 31 DevToolsManager::GetInstance()->AgentHostCreated(this); |
| 30 } | 32 } |
| 31 | 33 |
| 32 std::string SharedWorkerDevToolsAgentHost::GetType() { | 34 std::string SharedWorkerDevToolsAgentHost::GetType() { |
| 33 return kTypeSharedWorker; | 35 return kTypeSharedWorker; |
| 34 } | 36 } |
| 35 | 37 |
| 36 std::string SharedWorkerDevToolsAgentHost::GetTitle() { | 38 std::string SharedWorkerDevToolsAgentHost::GetTitle() { |
| 37 return base::UTF16ToUTF8(shared_worker_->name()); | 39 return base::UTF16ToUTF8(shared_worker_->name()); |
| 38 } | 40 } |
| 39 | 41 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 55 } | 57 } |
| 56 | 58 |
| 57 bool SharedWorkerDevToolsAgentHost::Matches( | 59 bool SharedWorkerDevToolsAgentHost::Matches( |
| 58 const SharedWorkerInstance& other) { | 60 const SharedWorkerInstance& other) { |
| 59 return shared_worker_->Matches(other); | 61 return shared_worker_->Matches(other); |
| 60 } | 62 } |
| 61 | 63 |
| 62 SharedWorkerDevToolsAgentHost::~SharedWorkerDevToolsAgentHost() { | 64 SharedWorkerDevToolsAgentHost::~SharedWorkerDevToolsAgentHost() { |
| 63 SharedWorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData( | 65 SharedWorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData( |
| 64 worker_id()); | 66 worker_id()); |
| 67 DevToolsManager::GetInstance()->AgentHostDestroyed(this); |
| 65 } | 68 } |
| 66 | 69 |
| 67 } // namespace content | 70 } // namespace content |
| OLD | NEW |