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

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

Issue 2900613002: Support DevTools for off-main-thread-fetch (Closed)
Patch Set: Created 3 years, 7 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
Index: third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
index 9f21b6665a3165a2db2e9d5eefa2935a9790a0b4..c90c0dcabfc1176c772d875fac9599bdbec3771a 100644
--- a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
@@ -7,14 +7,17 @@
#include "core/frame/Deprecation.h"
#include "core/frame/UseCounter.h"
#include "core/loader/MixedContentChecker.h"
+#include "core/probe/CoreProbes.h"
#include "core/timing/WorkerGlobalScopePerformance.h"
#include "core/workers/WorkerClients.h"
#include "core/workers/WorkerGlobalScope.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/Supplementable.h"
#include "platform/WebTaskRunner.h"
#include "platform/exported/WrappedResourceRequest.h"
#include "platform/loader/fetch/ResourceFetcher.h"
#include "platform/scheduler/child/web_scheduler.h"
+#include "platform/weborigin/SecurityPolicy.h"
#include "public/platform/Platform.h"
#include "public/platform/WebMixedContent.h"
#include "public/platform/WebMixedContentContextType.h"
@@ -122,15 +125,18 @@ SecurityContext* WorkerFetchContext::GetParentSecurityContext() const {
bool WorkerFetchContext::ShouldBlockRequestByInspector(
const ResourceRequest& resource_request) const {
- // TODO(horo): Implement this.
- return false;
+ bool should_block_request = false;
+ probe::shouldBlockRequest(worker_global_scope_, resource_request,
+ &should_block_request);
+ return should_block_request;
kinuko 2017/05/22 06:53:40 I think now this can be implemented in BaseFetchCo
horo 2017/05/22 07:32:17 Done.
}
void WorkerFetchContext::DispatchDidBlockRequest(
const ResourceRequest& resource_request,
const FetchInitiatorInfo& fetch_initiator_info,
ResourceRequestBlockedReason blocked_reason) const {
- // TODO(horo): Implement this.
+ probe::didBlockRequest(worker_global_scope_, resource_request, nullptr,
+ fetch_initiator_info, blocked_reason);
}
void WorkerFetchContext::ReportLocalLoadFailed(const KURL&) const {
@@ -174,6 +180,11 @@ bool WorkerFetchContext::IsControlledByServiceWorker() const {
void WorkerFetchContext::PrepareRequest(ResourceRequest& request,
RedirectType) {
+ String user_agent = worker_global_scope_->UserAgent();
+ probe::applyUserAgentOverride(worker_global_scope_, &user_agent);
+ DCHECK(!user_agent.IsNull());
+ request.SetHTTPUserAgent(AtomicString(user_agent));
+
request.OverrideLoadingIPCType(WebURLRequest::LoadingIPCType::kMojo);
WrappedResourceRequest webreq(request);
web_context_->WillSendRequest(webreq);
@@ -195,6 +206,15 @@ void WorkerFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request,
request.SetHTTPHeaderField("Save-Data", "on");
}
+void WorkerFetchContext::DispatchWillSendRequest(
+ unsigned long identifier,
+ ResourceRequest& request,
+ const ResourceResponse& redirect_response,
+ const FetchInitiatorInfo& initiator_info) {
+ probe::willSendRequest(worker_global_scope_, identifier, nullptr, request,
+ redirect_response, initiator_info);
+}
+
void WorkerFetchContext::DispatchDidReceiveResponse(
unsigned long identifier,
const ResourceResponse& response,
@@ -212,6 +232,38 @@ void WorkerFetchContext::DispatchDidReceiveResponse(
web_context_->DidDisplayContentWithCertificateErrors(response.Url());
}
}
+ probe::didReceiveResourceResponse(worker_global_scope_, identifier, nullptr,
+ response, resource);
+}
+
+void WorkerFetchContext::DispatchDidReceiveData(unsigned long identifier,
+ const char* data,
+ int data_length) {
+ probe::didReceiveData(worker_global_scope_, identifier, nullptr, data,
+ data_length);
+}
+
+void WorkerFetchContext::DispatchDidReceiveEncodedData(
+ unsigned long identifier,
+ int encoded_data_length) {
+ probe::didReceiveEncodedDataLength(worker_global_scope_, identifier,
+ encoded_data_length);
kinuko 2017/05/22 06:53:40 ditto
horo 2017/05/22 07:32:17 Done.
horo 2017/05/22 10:42:39 Ah, BaseFetchContext's |execution_context_| is nul
+}
+
+void WorkerFetchContext::DispatchDidFinishLoading(unsigned long identifier,
+ double finish_time,
+ int64_t encoded_data_length,
+ int64_t decoded_body_length) {
+ probe::didFinishLoading(worker_global_scope_, identifier, nullptr,
+ finish_time, encoded_data_length,
+ decoded_body_length);
+}
+
+void WorkerFetchContext::DispatchDidFail(unsigned long identifier,
+ const ResourceError& error,
+ int64_t encoded_data_length,
+ bool is_internal_request) {
+ probe::didFailLoading(worker_global_scope_, identifier, error);
}
void WorkerFetchContext::AddResourceTiming(const ResourceTimingInfo& info) {

Powered by Google App Engine
This is Rietveld 408576698