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

Unified Diff: Source/core/inspector/InspectorResolver.cpp

Issue 1092123004: DevTools: remove dependency of most agents on InspectorPageAgent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed debug build Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorResolver.h ('k') | Source/core/inspector/InspectorResourceAgent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorResolver.cpp
diff --git a/Source/core/inspector/InspectorResolver.cpp b/Source/core/inspector/InspectorResolver.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..88a468cbd3bc1d781859b4e157e7238fc8e79f52
--- /dev/null
+++ b/Source/core/inspector/InspectorResolver.cpp
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/inspector/InspectorResolver.h"
+
+#include "core/dom/DOMNodeIds.h"
+#include "core/dom/Document.h"
+#include "core/dom/Node.h"
+#include "core/frame/LocalFrame.h"
+#include "core/inspector/InspectorIdentifiers.h"
+#include "core/loader/DocumentLoader.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+namespace InspectorResolver {
+
+Node* resolveNode(LocalFrame* inspectedFrame, int identifier)
+{
+ Node* node = DOMNodeIds::nodeForId(identifier);
+ LocalFrame* frame = node ? node->document().frame() : nullptr;
+ if (!frame || frame->instrumentingAgents() != inspectedFrame->instrumentingAgents())
+ return nullptr;
+ return node;
+}
+
+LocalFrame* resolveFrame(LocalFrame* inspectedFrame, const String& identifier)
+{
+ LocalFrame* frame = InspectorIdentifiers<LocalFrame>::lookup(identifier);
+ if (!frame || frame->instrumentingAgents() != inspectedFrame->instrumentingAgents())
+ return nullptr;
+ return frame;
+}
+
+} // namespace InspectorResolver
+
+} // namespace blink
« no previous file with comments | « Source/core/inspector/InspectorResolver.h ('k') | Source/core/inspector/InspectorResourceAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698