Index: components/devtools_service/devtools_registry_impl.h |
diff --git a/components/devtools_service/devtools_registry_impl.h b/components/devtools_service/devtools_registry_impl.h |
index c12c0de2f10feae5df4c97a87bcbe215e0a6e044..431f39a601c9a938b0cd091909edb1dc5f5477d6 100644 |
--- a/components/devtools_service/devtools_registry_impl.h |
+++ b/components/devtools_service/devtools_registry_impl.h |
@@ -5,30 +5,57 @@ |
#ifndef COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_ |
#define COMPONENTS_DEVTOOLS_SERVICE_DEVTOOLS_REGISTRY_IMPL_H_ |
+#include <map> |
+#include <string> |
+ |
#include "base/macros.h" |
+#include "base/memory/linked_ptr.h" |
#include "components/devtools_service/public/interfaces/devtools_service.mojom.h" |
#include "mojo/common/weak_binding_set.h" |
namespace devtools_service { |
+class DevToolsAgentHost; |
class DevToolsService; |
class DevToolsRegistryImpl : public DevToolsRegistry { |
public: |
+ class Iterator { |
+ public: |
+ // |registry| must outlive this object. |
+ explicit Iterator(DevToolsRegistryImpl* registry); |
+ ~Iterator(); |
+ |
+ bool IsAtEnd() const { return iter_ == registry_->agents_.end(); } |
+ void Advance() { ++iter_; } |
+ |
+ DevToolsAgentHost* value() { return iter_->second.get(); } |
+ |
+ private: |
+ DevToolsRegistryImpl* const registry_; |
+ std::map<std::string, linked_ptr<DevToolsAgentHost>>::const_iterator iter_; |
+ }; |
+ |
// |service| must outlive this object. |
explicit DevToolsRegistryImpl(DevToolsService* service); |
~DevToolsRegistryImpl() override; |
void BindToRegistryRequest(mojo::InterfaceRequest<DevToolsRegistry> request); |
+ DevToolsAgentHost* GetAgentById(const std::string& id); |
+ |
private: |
// DevToolsRegistry implementation. |
void RegisterAgent(DevToolsAgentPtr agent) override; |
+ void OnAgentConnectionError(const std::string& id); |
+ |
DevToolsService* const service_; |
mojo::WeakBindingSet<DevToolsRegistry> bindings_; |
+ std::map<std::string, linked_ptr<DevToolsAgentHost>> agents_; |
+ |
DISALLOW_COPY_AND_ASSIGN(DevToolsRegistryImpl); |
}; |