Chromium Code Reviews| 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; |