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

Unified Diff: Source/core/inspector/InspectorPageAgent.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/InspectorPageAgent.h ('k') | Source/core/inspector/InspectorResolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorPageAgent.cpp
diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp
index 5a27c827c06b660ccfa1764f7f6295dc35b0fd2e..4b744bf008b7974cddd26243c39894e975ece940 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -56,6 +56,7 @@
#include "core/inspector/InspectorIdentifiers.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorOverlay.h"
+#include "core/inspector/InspectorResolver.h"
#include "core/inspector/InspectorResourceContentLoader.h"
#include "core/inspector/InspectorState.h"
#include "core/inspector/InstrumentingAgents.h"
@@ -199,10 +200,6 @@ PassOwnPtr<TextResourceDecoder> InspectorPageAgent::createResourceTextDecoder(co
static void resourceContent(ErrorString* errorString, LocalFrame* frame, const KURL& url, String* result, bool* base64Encoded)
{
- DocumentLoader* loader = InspectorPageAgent::assertDocumentLoader(errorString, frame);
- if (!loader)
- return;
-
if (!InspectorPageAgent::cachedResourceContent(InspectorPageAgent::cachedResource(frame, url), result, base64Encoded))
*errorString = "No resource with given URL found";
}
@@ -396,7 +393,7 @@ void InspectorPageAgent::enable(ErrorString*)
m_instrumentingAgents->setInspectorPageAgent(this);
if (m_inspectorResourceContentLoader)
m_inspectorResourceContentLoader->dispose();
- m_inspectorResourceContentLoader = adoptPtrWillBeNoop(new InspectorResourceContentLoader(inspectedFrame()));
+ m_inspectorResourceContentLoader = adoptPtrWillBeNoop(new InspectorResourceContentLoader(m_inspectedFrame));
}
void InspectorPageAgent::discardAgent()
@@ -458,12 +455,12 @@ void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa
ErrorString unused;
m_debuggerAgent->setSkipAllPauses(&unused, true);
m_reloading = true;
- inspectedFrame()->reload(asBool(optionalIgnoreCache) ? EndToEndReload : NormalReload, NotClientRedirect);
+ m_inspectedFrame->reload(asBool(optionalIgnoreCache) ? EndToEndReload : NormalReload, NotClientRedirect);
}
void InspectorPageAgent::navigate(ErrorString*, const String& url, String* outFrameId)
{
- *outFrameId = frameId(inspectedFrame());
+ *outFrameId = frameId(m_inspectedFrame);
}
static void cachedResourcesForDocument(Document* document, Vector<Resource*>& result, bool skipXHRs)
@@ -527,7 +524,7 @@ static Vector<Resource*> cachedResourcesForFrame(LocalFrame* frame, bool skipXHR
void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>& object)
{
- object = buildObjectForFrameTree(inspectedFrame());
+ object = buildObjectForFrameTree(m_inspectedFrame);
}
void InspectorPageAgent::finishReload()
@@ -588,7 +585,7 @@ void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c
{
results = TypeBuilder::Array<TypeBuilder::Debugger::SearchMatch>::create();
- LocalFrame* frame = frameForId(frameId);
+ LocalFrame* frame = InspectorResolver::resolveFrame(m_inspectedFrame, frameId);
KURL kurl(ParsedURLString, url);
FrameLoader* frameLoader = frame ? &frame->loader() : nullptr;
@@ -641,21 +638,21 @@ void InspectorPageAgent::didClearDocumentOfWindowObject(LocalFrame* frame)
void InspectorPageAgent::domContentLoadedEventFired(LocalFrame* frame)
{
- if (frame != inspectedFrame())
+ if (frame != m_inspectedFrame)
return;
frontend()->domContentEventFired(monotonicallyIncreasingTime());
}
void InspectorPageAgent::loadEventFired(LocalFrame* frame)
{
- if (frame != inspectedFrame())
+ if (frame != m_inspectedFrame)
return;
frontend()->loadEventFired(monotonicallyIncreasingTime());
}
void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
{
- if (loader->frame() == inspectedFrame()) {
+ if (loader->frame() == m_inspectedFrame) {
finishReload();
m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce;
m_pendingScriptToEvaluateOnLoadOnce = String();
@@ -678,32 +675,9 @@ void InspectorPageAgent::frameDetachedFromParent(LocalFrame* frame)
frontend()->frameDetached(frameId(frame));
}
-FrameHost* InspectorPageAgent::frameHost()
-{
- return m_inspectedFrame->host();
-}
-
-LocalFrame* InspectorPageAgent::frameForId(const String& frameId)
-{
- LocalFrame* frame = InspectorIdentifiers<LocalFrame>::lookup(frameId);
- return frame && frame->instrumentingAgents() == m_inspectedFrame->instrumentingAgents() ? frame : nullptr;
-}
-
-LocalFrame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
-{
- for (Frame* frame = inspectedFrame(); frame; frame = frame->tree().traverseNext(inspectedFrame())) {
- if (!frame->isLocalFrame())
- continue;
- RefPtr<SecurityOrigin> documentOrigin = toLocalFrame(frame)->document()->securityOrigin();
- if (documentOrigin->toRawString() == originRawString)
- return toLocalFrame(frame);
- }
- return nullptr;
-}
-
LocalFrame* InspectorPageAgent::assertFrame(ErrorString* errorString, const String& frameId)
{
- LocalFrame* frame = frameForId(frameId);
+ LocalFrame* frame = InspectorResolver::resolveFrame(m_inspectedFrame, frameId);
if (!frame)
*errorString = "No frame for given id found";
return frame;
@@ -714,15 +688,6 @@ bool InspectorPageAgent::screencastEnabled()
return m_enabled && m_state->getBoolean(PageAgentState::screencastEnabled);
}
-// static
-DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorString, LocalFrame* frame)
-{
- DocumentLoader* documentLoader = frame->loader().documentLoader();
- if (!documentLoader)
- *errorString = "No documentLoader for given frame found";
- return documentLoader;
-}
-
void InspectorPageAgent::frameStartedLoading(LocalFrame* frame)
{
frontend()->frameStartedLoading(frameId(frame));
@@ -768,7 +733,7 @@ void InspectorPageAgent::didScroll()
void InspectorPageAgent::didResizeMainFrame()
{
- if (!inspectedFrame()->isMainFrame())
+ if (!m_inspectedFrame->isMainFrame())
return;
#if !OS(ANDROID)
if (m_enabled && m_state->getBoolean(PageAgentState::showSizeOnResize))
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/core/inspector/InspectorResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698