diff options
author | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 12:50:29 +0000 |
---|---|---|
committer | kaznacheev@chromium.org <kaznacheev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 12:50:29 +0000 |
commit | 9354a6c2c69ea4ec178d32ee1acafcaa757d6af9 (patch) | |
tree | eec14e8893e368f37bda6bc726d2c345fec89ddd /content/browser/devtools/worker_devtools_manager.cc | |
parent | 8c496131851133ba744197a899a3ed7d31fa655e (diff) | |
download | chromium_src-9354a6c2c69ea4ec178d32ee1acafcaa757d6af9.zip chromium_src-9354a6c2c69ea4ec178d32ee1acafcaa757d6af9.tar.gz chromium_src-9354a6c2c69ea4ec178d32ee1acafcaa757d6af9.tar.bz2 |
Minor clean up in WorkerDevToolsManager
BUG=None
Review URL: https://chromiumcodereview.appspot.com/14051004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194902 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/devtools/worker_devtools_manager.cc')
-rw-r--r-- | content/browser/devtools/worker_devtools_manager.cc | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/content/browser/devtools/worker_devtools_manager.cc b/content/browser/devtools/worker_devtools_manager.cc index db5cc74..d69be2b 100644 --- a/content/browser/devtools/worker_devtools_manager.cc +++ b/content/browser/devtools/worker_devtools_manager.cc @@ -61,11 +61,12 @@ class WorkerDevToolsManager::WorkerDevToolsAgentHost explicit WorkerDevToolsAgentHost(WorkerId worker_id) : has_worker_id_(false) { SetWorkerId(worker_id, false); - AddRef(); // Balanced in ResetWorkerId. } void SetWorkerId(WorkerId worker_id, bool reattach) { worker_id_ = worker_id; + if (!has_worker_id_) + AddRef(); // Balanced in ResetWorkerId. has_worker_id_ = true; g_agent_map.Get()[worker_id_] = this; @@ -84,7 +85,7 @@ class WorkerDevToolsManager::WorkerDevToolsAgentHost void ResetWorkerId() { g_agent_map.Get().erase(worker_id_); has_worker_id_ = false; - Release(); + Release(); // Balanced in SetWorkerId. } void SaveAgentRuntimeState(const std::string& state) { @@ -97,10 +98,7 @@ class WorkerDevToolsManager::WorkerDevToolsAgentHost } private: - virtual ~WorkerDevToolsAgentHost() { - g_agent_map.Get().erase(worker_id_); - g_orphan_map.Get().erase(worker_id_); - } + virtual ~WorkerDevToolsAgentHost(); static void ConnectToWorker( int worker_process_id, @@ -180,16 +178,16 @@ class WorkerDevToolsManager::DetachedClientHosts { agent->ResetWorkerId(); } - private: - DetachedClientHosts() {} - ~DetachedClientHosts() {} - static void RemovePendingWorkerData(WorkerId id) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&RemoveInspectedWorkerDataOnIOThread, id)); } + private: + DetachedClientHosts() {} + ~DetachedClientHosts() {} + static void RemoveInspectedWorkerDataOnIOThread(WorkerId id) { WorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData(id); } @@ -441,4 +439,10 @@ void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); } +WorkerDevToolsManager::WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { + DetachedClientHosts::RemovePendingWorkerData(worker_id_); + g_agent_map.Get().erase(worker_id_); + g_orphan_map.Get().erase(worker_id_); +} + } // namespace content |