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

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

Issue 347543002: DevTools: Extract CSS resources preloading from css agent to page agent controlled loader. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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/InspectorResourceContentLoader.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 49d2fb7afc980b926cdb1338848977769cdaf5fb..65e664c08a366b3f31f7241291f17369e6ad2d73 100644
--- a/Source/core/inspector/InspectorPageAgent.cpp
+++ b/Source/core/inspector/InspectorPageAgent.cpp
@@ -62,6 +62,7 @@
#include "core/inspector/InspectorClient.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/inspector/InspectorOverlay.h"
+#include "core/inspector/InspectorResourceContentLoader.h"
#include "core/inspector/InspectorState.h"
#include "core/inspector/InstrumentingAgents.h"
#include "core/loader/CookieJar.h"
@@ -403,6 +404,7 @@ void InspectorPageAgent::enable(ErrorString*)
m_enabled = true;
m_state->setBoolean(PageAgentState::pageAgentEnabled, true);
m_instrumentingAgents->setInspectorPageAgent(this);
+ m_inspectorResourceContentLoader = adoptPtr(new InspectorResourceContentLoader(m_page));
}
void InspectorPageAgent::disable(ErrorString*)
@@ -412,6 +414,7 @@ void InspectorPageAgent::disable(ErrorString*)
m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad);
m_overlay->hide();
m_instrumentingAgents->setInspectorPageAgent(0);
+ m_inspectorResourceContentLoader.clear();
m_deviceMetricsOverridden = false;
setShowPaintRects(0, false);
@@ -538,7 +541,8 @@ static void cachedResourcesForDocument(Document* document, Vector<Resource*>& re
}
}
-static Vector<Document*> importsForFrame(LocalFrame* frame)
+// static
+Vector<Document*> InspectorPageAgent::importsForFrame(LocalFrame* frame)
{
Vector<Document*> result;
Document* rootDocument = frame->document();
@@ -557,7 +561,7 @@ static Vector<Resource*> cachedResourcesForFrame(LocalFrame* frame)
{
Vector<Resource*> result;
Document* rootDocument = frame->document();
- Vector<Document*> loaders = importsForFrame(frame);
+ Vector<Document*> loaders = InspectorPageAgent::importsForFrame(frame);
cachedResourcesForDocument(rootDocument, result);
for (size_t i = 0; i < loaders.size(); ++i)
@@ -857,7 +861,7 @@ void InspectorPageAgent::loadEventFired(LocalFrame* frame)
void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
{
- // FIXME: If "frame" is always guarenteed to be in the same Page as loader->frame()
+ // FIXME: If "frame" is always guaranteed to be in the same Page as loader->frame()
// then all we need to check here is loader->frame()->isMainFrame()
// and we don't need "frame" at all.
if (loader->frame() == m_page->mainFrame()) {
@@ -865,6 +869,8 @@ void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader)
m_scriptPreprocessorSource = m_pendingScriptPreprocessor;
m_pendingScriptToEvaluateOnLoadOnce = String();
m_pendingScriptPreprocessor = String();
+ if (m_inspectorResourceContentLoader)
+ m_inspectorResourceContentLoader->stop();
}
m_frontend->frameNavigated(buildObjectForFrame(loader->frame()));
}
@@ -1117,7 +1123,7 @@ PassRefPtr<TypeBuilder::Page::FrameResourceTree> InspectorPageAgent::buildObject
subresources->addItem(resourceObject);
}
- Vector<Document*> allImports = importsForFrame(frame);
+ Vector<Document*> allImports = InspectorPageAgent::importsForFrame(frame);
for (Vector<Document*>::const_iterator it = allImports.begin(); it != allImports.end(); ++it) {
Document* import = *it;
RefPtr<TypeBuilder::Page::FrameResourceTree::Resources> resourceObject = TypeBuilder::Page::FrameResourceTree::Resources::create()
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/core/inspector/InspectorResourceContentLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698