Chromium Code Reviews| Index: Source/core/inspector/InspectorPageAgent.cpp |
| diff --git a/Source/core/inspector/InspectorPageAgent.cpp b/Source/core/inspector/InspectorPageAgent.cpp |
| index 5a27c827c06b660ccfa1764f7f6295dc35b0fd2e..45b2c97b70beb0688090543493a5aeb5fcf60f82 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); |
|
dgozman
2015/04/24 13:16:14
Won't this crash now?
caseq
2015/04/24 13:50:55
It doesn't on tests, at least. We don't seem to us
|
| - 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,20 +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())) { |
| + for (Frame* frame = m_inspectedFrame; frame; frame = frame->tree().traverseNext(m_inspectedFrame)) { |
| if (!frame->isLocalFrame()) |
| continue; |
| RefPtr<SecurityOrigin> documentOrigin = toLocalFrame(frame)->document()->securityOrigin(); |
| @@ -703,7 +689,7 @@ LocalFrame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& origin |
| 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 +700,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 +745,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)) |