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

Side by Side Diff: content/public/browser/devtools_target_list.h

Issue 12319114: Extract debugger target enumeration into a separate class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger
Patch Set: Cleaner version ready for review Created 7 years, 9 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_
6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/memory/ref_counted.h"
12 #include "content/common/content_export.h"
13
14 namespace content {
15
16 class DevToolsAgentHost;
17
18 // Interface responsible for mapping DevToolsAgentHost instances to/from
19 // string identifiers.
20 class CONTENT_EXPORT DevToolsAgentHostBinding {
21 public:
22 virtual ~DevToolsAgentHostBinding() {}
23
24 // Returns the mapping of DevToolsAgentHost to identifier.
25 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) = 0;
26
27 // Returns the mapping of identifier to DevToolsAgentHost.
28 virtual DevToolsAgentHost* ForIdentifier(const std::string& id) = 0;
29 };
30
31 class CONTENT_EXPORT DevToolsTargetList : public DevToolsAgentHostBinding {
pfeldman 2013/03/01 08:49:30 I think these serve slightly different reasons and
Vladislav Kaznacheev 2013/03/01 12:58:35 Left DevToolsAgentHostBinding where it was, made D
32 public:
33 static DevToolsTargetList* GetInstance();
34
35 virtual ~DevToolsTargetList() {};
36
37 typedef std::map<std::string, scoped_refptr<DevToolsAgentHost> > AgentsMap;
38 typedef AgentsMap::iterator iterator;
39
40 AgentsMap& GetAgentsMap();
41
42 // DevToolsAgentHostBinding implementation.
43 virtual std::string GetIdentifier(DevToolsAgentHost* agent_host) OVERRIDE;
44
45 virtual DevToolsAgentHost* ForIdentifier(const std::string& id) OVERRIDE;
46
47 private:
48 AgentsMap agents_map_;
49
50 void GarbageCollect();
51
52 std::string UpdateMap(DevToolsAgentHost* agent_host);
53 };
54
55 } // namespace content
56
57 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_TARGET_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698