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

Side by Side Diff: components/devtools_service/devtools_registry_impl.h

Issue 1164383002: Mandoline DevTools service: remote debugging protocol over HTTP/WebSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_ 5 #ifndef COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_
6 #define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_ 6 #define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_
7 7
8 #include <map>
9 #include <string>
10
8 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/linked_ptr.h"
9 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h " 13 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h "
10 #include "mojo/common/weak_binding_set.h" 14 #include "mojo/common/weak_binding_set.h"
11 15
12 namespace devtools_service { 16 namespace devtools_service {
13 17
18 class DevToolsAgentHost;
14 class DevToolsService; 19 class DevToolsService;
15 20
16 class DevToolsRegistryImpl : public DevToolsRegistry { 21 class DevToolsRegistryImpl : public DevToolsRegistry {
17 public: 22 public:
23 class Iterator {
24 public:
25 // |registry| must outlive this object.
26 explicit Iterator(DevToolsRegistryImpl* registry);
27 ~Iterator();
28
29 bool IsAtEnd() const { return iter_ == registry_->agents_.end(); }
30 void Advance() { ++iter_; }
31
32 DevToolsAgentHost* value() { return iter_->second.get(); }
33
34 private:
35 DevToolsRegistryImpl* const registry_;
36 std::map<std::string, linked_ptr<DevToolsAgentHost>>::const_iterator iter_;
37 };
38
18 // |service| must outlive this object. 39 // |service| must outlive this object.
19 explicit DevToolsRegistryImpl(DevToolsService* service); 40 explicit DevToolsRegistryImpl(DevToolsService* service);
20 ~DevToolsRegistryImpl() override; 41 ~DevToolsRegistryImpl() override;
21 42
22 void BindToRegistryRequest(mojo::InterfaceRequest<DevToolsRegistry> request); 43 void BindToRegistryRequest(mojo::InterfaceRequest<DevToolsRegistry> request);
23 44
45 DevToolsAgentHost* GetAgentById(const std::string& id);
46
24 private: 47 private:
25 // DevToolsRegistry implementation. 48 // DevToolsRegistry implementation.
26 void RegisterAgent(DevToolsAgentPtr agent) override; 49 void RegisterAgent(DevToolsAgentPtr agent) override;
27 50
51 void OnAgentConnectionError(const std::string& id);
52
28 DevToolsService* const service_; 53 DevToolsService* const service_;
29 54
30 mojo::WeakBindingSet<DevToolsRegistry> bindings_; 55 mojo::WeakBindingSet<DevToolsRegistry> bindings_;
31 56
57 std::map<std::string, linked_ptr<DevToolsAgentHost>> agents_;
58
32 DISALLOW_COPY_AND_ASSIGN(DevToolsRegistryImpl); 59 DISALLOW_COPY_AND_ASSIGN(DevToolsRegistryImpl);
33 }; 60 };
34 61
35 } // namespace devtools_service 62 } // namespace devtools_service
36 63
37 #endif // COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_ 64 #endif // COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_
OLDNEW
« no previous file with comments | « components/devtools_service/devtools_http_server.cc ('k') | components/devtools_service/devtools_registry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698