summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp')
-rw-r--r--Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp47
1 files changed, 30 insertions, 17 deletions
diff --git a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
index e0d9ede15..b5e34741c 100644
--- a/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
+++ b/Source/JavaScriptCore/inspector/InspectorAgentRegistry.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,39 +27,52 @@
#include "config.h"
#include "InspectorAgentRegistry.h"
-#if ENABLE(INSPECTOR)
-
#include "InspectorAgentBase.h"
namespace Inspector {
-InspectorAgentRegistry::InspectorAgentRegistry()
+AgentRegistry::AgentRegistry()
{
}
-void InspectorAgentRegistry::append(std::unique_ptr<InspectorAgentBase> agent)
+AgentRegistry::~AgentRegistry()
{
- m_agents.append(std::move(agent));
+ // Allow agents to remove cross-references to other agents that would otherwise
+ // make it difficult to establish a correct destruction order for all agents.
+ for (auto& agent : m_agents)
+ agent->discardAgent();
}
-void InspectorAgentRegistry::didCreateFrontendAndBackend(InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
+void AgentRegistry::append(std::unique_ptr<InspectorAgentBase> agent)
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->didCreateFrontendAndBackend(frontendChannel, backendDispatcher);
+ m_agents.append(WTFMove(agent));
}
-void InspectorAgentRegistry::willDestroyFrontendAndBackend(InspectorDisconnectReason reason)
+#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
+void AgentRegistry::appendExtraAgent(std::unique_ptr<InspectorAgentBase> agent)
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->willDestroyFrontendAndBackend(reason);
+ m_extraDomains.append(agent->domainName());
+
+ append(WTFMove(agent));
}
+#endif
-void InspectorAgentRegistry::discardAgents()
+void AgentRegistry::didCreateFrontendAndBackend(FrontendRouter* frontendRouter, BackendDispatcher* backendDispatcher)
{
- for (size_t i = 0; i < m_agents.size(); i++)
- m_agents[i]->discardAgent();
+ for (auto& agent : m_agents)
+ agent->didCreateFrontendAndBackend(frontendRouter, backendDispatcher);
}
-} // namespace Inspector
+void AgentRegistry::willDestroyFrontendAndBackend(DisconnectReason reason)
+{
+ for (auto& agent : m_agents)
+ agent->willDestroyFrontendAndBackend(reason);
+}
-#endif // ENABLE(INSPECTOR)
+void AgentRegistry::discardValues()
+{
+ for (auto& agent : m_agents)
+ agent->discardValues();
+}
+
+} // namespace Inspector