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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 1303833002: Add WebPageImportanceSignals::issuedNonGetFetchFromScript() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: m_document\.page() not ->page() Created 5 years, 3 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 | « no previous file | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index b06ea8c34b2826f8e7d618ec4a85ca98258167ac..8868888731e7606d90f3cbb0030bbca0409414df 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -48,6 +48,8 @@
#include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h"
#include "core/loader/ThreadableLoaderClient.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Page.h"
#include "platform/SharedBuffer.h"
#include "platform/Task.h"
#include "platform/network/ResourceRequest.h"
@@ -162,6 +164,24 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
m_simpleRequestHeaders.add(header.key, header.value);
}
+ // DocumentThreadableLoader is used by all javascript initiated fetch, so
+ // we use this chance to record non-GET fetch script requests.
+ // However, this is based on the following assumptions, so please be careful
+ // when adding similar logic:
+ // - ThreadableLoader is used as backend for all javascript initiated network
+ // fetches.
+ // - Note that ThreadableLoader is also used for non-network fetch such as
+ // FileReaderLoader. However it emulates GET method so signal is not
+ // recorded here.
+ // - ThreadableLoader w/ non-GET request is only created from javascript
+ // initiated fetch.
+ // - Some non-script initiated fetches such as WorkerScriptLoader also use
+ // ThreadableLoader, but they are guaranteed to use GET method.
+ if (request.httpMethod() != "GET") {
+ if (Page* page = m_document.page())
+ page->chromeClient().didObserveNonGetFetchFromScript();
+ }
+
// If the fetch request will be handled by the ServiceWorker, the
// FetchRequestMode of the request must be FetchRequestModeCORS or
// FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698