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

Unified Diff: android_webview/browser/net/aw_request_interceptor.cc

Issue 1544863002: [Android WebView] Implement initial settings and callback support for Service Workers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more clean-up Created 4 years, 11 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: android_webview/browser/net/aw_request_interceptor.cc
diff --git a/android_webview/browser/net/aw_request_interceptor.cc b/android_webview/browser/net/aw_request_interceptor.cc
index 30ae888793ad4ec98ef57a42f7d7d574c6055586..fb8b37fec568233b6c288f85b13669878fa5024e 100644
--- a/android_webview/browser/net/aw_request_interceptor.cc
+++ b/android_webview/browser/net/aw_request_interceptor.cc
@@ -114,6 +114,23 @@ class ShouldInterceptRequestAdaptor
DISALLOW_COPY_AND_ASSIGN(ShouldInterceptRequestAdaptor);
};
+scoped_ptr<AwContentsIoThreadClient> GetCorrespondingIoThreadClient(
+ net::URLRequest* request) {
+ int render_process_id, render_frame_id;
+ if (!content::ResourceRequestInfo::GetRenderFrameForRequest(
+ request, &render_process_id, &render_frame_id)) {
+ return AwContentsIoThreadClient::GetServiceWorkerIoThreadClient();
mnaganov (inactive) 2016/01/12 00:42:03 Are you sure it's safe to assume that if a corresp
timvolodine 2016/01/13 17:07:58 Just checked: regular web workers do have a valid
mnaganov (inactive) 2016/01/13 17:55:27 OK, please then add a comment here explaining why
timvolodine 2016/01/14 19:43:55 Done.
+ }
+
+ scoped_ptr<AwContentsIoThreadClient> io_thread_client =
+ AwContentsIoThreadClient::FromID(render_process_id, render_frame_id);
+
+ if (!io_thread_client)
+ return AwContentsIoThreadClient::GetServiceWorkerIoThreadClient();
+
+ return io_thread_client;
+}
+
} // namespace
AwRequestInterceptor::AwRequestInterceptor() {}
@@ -129,14 +146,8 @@ net::URLRequestJob* AwRequestInterceptor::MaybeInterceptRequest(
if (request->GetUserData(kRequestAlreadyHasJobDataKey))
return nullptr;
- int render_process_id, render_frame_id;
- if (!content::ResourceRequestInfo::GetRenderFrameForRequest(
- request, &render_process_id, &render_frame_id)) {
- return nullptr;
- }
-
scoped_ptr<AwContentsIoThreadClient> io_thread_client =
- AwContentsIoThreadClient::FromID(render_process_id, render_frame_id);
+ GetCorrespondingIoThreadClient(request);
if (!io_thread_client)
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698