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

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 459003002: Plumbs URLRequestContext and CacheBlobStorageContext down to cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cache1
Patch Set: Rebase Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/browser/fileapi/chrome_blob_storage_context.h"
9 #include "content/browser/message_port_message_filter.h" 10 #include "content/browser/message_port_message_filter.h"
10 #include "content/browser/message_port_service.h" 11 #include "content/browser/message_port_service.h"
11 #include "content/browser/service_worker/embedded_worker_registry.h" 12 #include "content/browser/service_worker/embedded_worker_registry.h"
12 #include "content/browser/service_worker/service_worker_context_core.h" 13 #include "content/browser/service_worker/service_worker_context_core.h"
13 #include "content/browser/service_worker/service_worker_context_wrapper.h" 14 #include "content/browser/service_worker/service_worker_context_wrapper.h"
14 #include "content/browser/service_worker/service_worker_handle.h" 15 #include "content/browser/service_worker/service_worker_handle.h"
15 #include "content/browser/service_worker/service_worker_registration.h" 16 #include "content/browser/service_worker/service_worker_registration.h"
16 #include "content/browser/service_worker/service_worker_utils.h" 17 #include "content/browser/service_worker/service_worker_utils.h"
17 #include "content/common/service_worker/embedded_worker_messages.h" 18 #include "content/common/service_worker/embedded_worker_messages.h"
18 #include "content/common/service_worker/service_worker_messages.h" 19 #include "content/common/service_worker/service_worker_messages.h"
19 #include "ipc/ipc_message_macros.h" 20 #include "ipc/ipc_message_macros.h"
20 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h" 21 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
23 #include "webkit/browser/blob/blob_storage_context.h"
jkarlin 2014/08/12 19:22:15 I'll remove this line
jkarlin 2014/08/13 00:14:00 Needed to keep this one after all.
22 24
23 using blink::WebServiceWorkerError; 25 using blink::WebServiceWorkerError;
24 26
25 namespace content { 27 namespace content {
26 28
27 namespace { 29 namespace {
28 30
29 const char kShutdownErrorMessage[] = 31 const char kShutdownErrorMessage[] =
30 "The Service Worker system has shutdown."; 32 "The Service Worker system has shutdown.";
31 33
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 69
68 ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() { 70 ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() {
69 if (GetContext()) { 71 if (GetContext()) {
70 GetContext()->RemoveAllProviderHostsForProcess(render_process_id_); 72 GetContext()->RemoveAllProviderHostsForProcess(render_process_id_);
71 GetContext()->embedded_worker_registry()->RemoveChildProcessSender( 73 GetContext()->embedded_worker_registry()->RemoveChildProcessSender(
72 render_process_id_); 74 render_process_id_);
73 } 75 }
74 } 76 }
75 77
76 void ServiceWorkerDispatcherHost::Init( 78 void ServiceWorkerDispatcherHost::Init(
77 ServiceWorkerContextWrapper* context_wrapper) { 79 ServiceWorkerContextWrapper* context_wrapper,
80 net::URLRequestContext* request_context,
michaeln 2014/08/13 00:11:28 i think this would need to be a URLRequestContextG
jkarlin 2014/08/13 00:34:41 Done.
81 ChromeBlobStorageContext* blob_storage) {
78 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 82 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
79 BrowserThread::PostTask( 83 BrowserThread::PostTask(BrowserThread::IO,
80 BrowserThread::IO, FROM_HERE, 84 FROM_HERE,
81 base::Bind(&ServiceWorkerDispatcherHost::Init, 85 base::Bind(&ServiceWorkerDispatcherHost::Init,
82 this, make_scoped_refptr(context_wrapper))); 86 this,
87 make_scoped_refptr(context_wrapper),
88 base::Unretained(request_context),
89 make_scoped_refptr(blob_storage)));
83 return; 90 return;
84 } 91 }
85 context_wrapper_ = context_wrapper; 92 context_wrapper_ = context_wrapper;
86 GetContext()->embedded_worker_registry()->AddChildProcessSender( 93 GetContext()->embedded_worker_registry()->AddChildProcessSender(
87 render_process_id_, this); 94 render_process_id_, this);
95 if (blob_storage->context())
96 context_wrapper_->SetBlobParametersForCache(
97 request_context, blob_storage->context()->AsWeakPtr());
88 } 98 }
89 99
90 void ServiceWorkerDispatcherHost::OnFilterAdded(IPC::Sender* sender) { 100 void ServiceWorkerDispatcherHost::OnFilterAdded(IPC::Sender* sender) {
91 BrowserMessageFilter::OnFilterAdded(sender); 101 BrowserMessageFilter::OnFilterAdded(sender);
92 channel_ready_ = true; 102 channel_ready_ = true;
93 std::vector<IPC::Message*> messages; 103 std::vector<IPC::Message*> messages;
94 pending_messages_.release(&messages); 104 pending_messages_.release(&messages);
95 for (size_t i = 0; i < messages.size(); ++i) { 105 for (size_t i = 0; i < messages.size(); ++i) {
96 BrowserMessageFilter::Send(messages[i]); 106 BrowserMessageFilter::Send(messages[i]);
97 } 107 }
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 status, &error_type, &error_message); 499 status, &error_type, &error_message);
490 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 500 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
491 thread_id, request_id, error_type, error_message)); 501 thread_id, request_id, error_type, error_message));
492 } 502 }
493 503
494 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() { 504 ServiceWorkerContextCore* ServiceWorkerDispatcherHost::GetContext() {
495 return context_wrapper_->context(); 505 return context_wrapper_->context();
496 } 506 }
497 507
498 } // namespace content 508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698