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

Side by Side Diff: content/browser/debugger/worker_devtools_manager.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/debugger/worker_devtools_manager.h" 5 #include "content/browser/debugger/worker_devtools_manager.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "base/tuple.h" 10 #include "base/tuple.h"
11 #include "content/browser/browser_thread.h" 11 #include "content/browser/browser_thread.h"
12 #include "content/browser/debugger/devtools_agent_host.h" 12 #include "content/browser/debugger/devtools_agent_host.h"
13 #include "content/browser/debugger/devtools_manager.h" 13 #include "content/browser/debugger/devtools_manager.h"
14 #include "content/browser/debugger/worker_devtools_message_filter.h" 14 #include "content/browser/debugger/worker_devtools_message_filter.h"
15 #include "content/browser/worker_host/worker_process_host.h" 15 #include "content/browser/worker_host/worker_process_host.h"
16 #include "content/browser/worker_host/worker_service.h" 16 #include "content/browser/worker_host/worker_service.h"
17 #include "content/common/devtools_messages.h" 17 #include "content/common/devtools_messages.h"
18 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
20 #include "content/common/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
22 22
23 class WorkerDevToolsManager::AgentHosts 23 class WorkerDevToolsManager::AgentHosts
24 : private content::NotificationObserver { 24 : private content::NotificationObserver {
25 public: 25 public:
26 static void Add(WorkerId id, WorkerDevToolsAgentHost* host) { 26 static void Add(WorkerId id, WorkerDevToolsAgentHost* host) {
27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
28 if (!instance_) 28 if (!instance_)
29 instance_ = new AgentHosts(); 29 instance_ = new AgentHosts();
30 instance_->map_[id] = host; 30 instance_->map_[id] = host;
(...skipping 16 matching lines...) Expand all
47 Instances& map = instance_->map_; 47 Instances& map = instance_->map_;
48 Instances::iterator it = map.find(id); 48 Instances::iterator it = map.find(id);
49 if (it == map.end()) 49 if (it == map.end())
50 return NULL; 50 return NULL;
51 return it->second; 51 return it->second;
52 } 52 }
53 53
54 private: 54 private:
55 AgentHosts() { 55 AgentHosts() {
56 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, 56 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING,
57 NotificationService::AllSources()); 57 content::NotificationService::AllSources());
58 } 58 }
59 ~AgentHosts() {} 59 ~AgentHosts() {}
60 60
61 // content::NotificationObserver implementation. 61 // content::NotificationObserver implementation.
62 virtual void Observe(int type, 62 virtual void Observe(int type,
63 const content::NotificationSource&, 63 const content::NotificationSource&,
64 const content::NotificationDetails&) OVERRIDE; 64 const content::NotificationDetails&) OVERRIDE;
65 65
66 static AgentHosts* instance_; 66 static AgentHosts* instance_;
67 typedef std::map<WorkerId, WorkerDevToolsAgentHost*> Instances; 67 typedef std::map<WorkerId, WorkerDevToolsAgentHost*> Instances;
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { 502 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) {
503 BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); 503 BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS);
504 for (; !iter.Done(); ++iter) { 504 for (; !iter.Done(); ++iter) {
505 if (iter->id() == id.first) { 505 if (iter->id() == id.first) {
506 iter->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); 506 iter->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second));
507 return; 507 return;
508 } 508 }
509 } 509 }
510 } 510 }
511 511
OLDNEW
« no previous file with comments | « content/browser/debugger/render_view_devtools_agent_host.cc ('k') | content/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698