Chromium Code Reviews| Index: content/browser/service_worker/service_worker_context_wrapper.cc |
| diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc |
| index e423d70511cdef4a7a6237947f95103f8e0ff33d..0e0ff3db69682dc258326f629270dc8a0f4d699a 100644 |
| --- a/content/browser/service_worker/service_worker_context_wrapper.cc |
| +++ b/content/browser/service_worker/service_worker_context_wrapper.cc |
| @@ -49,4 +49,81 @@ ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
| return context_core_.get(); |
| } |
| +void ServiceWorkerContextWrapper::RegisterServiceWorker( |
| + const GURL& pattern, |
| + const GURL& script_url, |
| + int source_process_id, |
| + const RegistrationCallback& continuation) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, |
| + FROM_HERE, |
| + base::Bind(&ServiceWorkerContextWrapper::RegisterServiceWorkerOnIO, |
|
kinuko
2014/03/26 05:01:34
Instead of having yet another indirection method w
Jeffrey Yasskin
2014/03/26 19:58:52
Sure, done.
|
| + this, |
| + pattern, |
| + script_url, |
| + source_process_id, |
| + continuation)); |
| +} |
| + |
| +void ServiceWorkerContextWrapper::RegisterServiceWorkerOnIO( |
|
kinuko
2014/03/26 05:01:34
I know this ordering has some benfits, but can we
Jeffrey Yasskin
2014/03/26 19:58:52
Obsolete now.
|
| + const GURL& pattern, |
| + const GURL& script_url, |
| + int source_process_id, |
| + const RegistrationCallback& continuation) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + context()->RegisterServiceWorker( |
| + pattern, |
| + script_url, |
| + source_process_id, |
| + base::Bind(&ServiceWorkerContextWrapper::FinishRegistrationOnIO, |
| + this, |
| + continuation)); |
| +} |
| + |
| +void ServiceWorkerContextWrapper::FinishRegistrationOnIO( |
| + const RegistrationCallback& continuation, |
| + ServiceWorkerStatusCode status, |
| + int64 registration_id) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, base::Bind(continuation, status)); |
| +} |
| + |
| +void ServiceWorkerContextWrapper::UnregisterServiceWorker( |
| + const GURL& pattern, |
| + int source_process_id, |
| + const UnregistrationCallback& continuation) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, |
| + FROM_HERE, |
| + base::Bind(&ServiceWorkerContextWrapper::UnregisterServiceWorkerOnIO, |
| + this, |
| + pattern, |
| + source_process_id, |
| + continuation)); |
| +} |
| + |
| +void ServiceWorkerContextWrapper::UnregisterServiceWorkerOnIO( |
| + const GURL& pattern, |
| + int source_process_id, |
| + const UnregistrationCallback& continuation) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + context()->UnregisterServiceWorker( |
| + pattern, |
| + source_process_id, |
| + base::Bind(&ServiceWorkerContextWrapper::FinishUnregistrationOnIO, |
| + this, |
| + continuation)); |
| +} |
| +void ServiceWorkerContextWrapper::FinishUnregistrationOnIO( |
| + const RegistrationCallback& continuation, |
| + ServiceWorkerStatusCode status) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, base::Bind(continuation, status)); |
| +} |
| + |
| } // namespace content |