| OLD | NEW |
| 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/renderer/service_worker/embedded_worker_context_client.h" | 5 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // At this point OnWorkerRunLoopStopped is already called, so | 113 // At this point OnWorkerRunLoopStopped is already called, so |
| 114 // worker_task_runner_->RunsTasksOnCurrentThread() returns false | 114 // worker_task_runner_->RunsTasksOnCurrentThread() returns false |
| 115 // (while we're still on the worker thread). | 115 // (while we're still on the worker thread). |
| 116 script_context_.reset(); | 116 script_context_.reset(); |
| 117 main_thread_proxy_->PostTask( | 117 main_thread_proxy_->PostTask( |
| 118 FROM_HERE, | 118 FROM_HERE, |
| 119 base::Bind(&CallWorkerContextDestroyedOnMainThread, | 119 base::Bind(&CallWorkerContextDestroyedOnMainThread, |
| 120 embedded_worker_id_)); | 120 embedded_worker_id_)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void EmbeddedWorkerContextClient::didHandleInstallEvent(int request_id) { | 123 void EmbeddedWorkerContextClient::didHandleInstallEvent( |
| 124 int request_id, |
| 125 blink::WebServiceWorkerEventResult result) { |
| 124 DCHECK(script_context_); | 126 DCHECK(script_context_); |
| 125 script_context_->DidHandleInstallEvent(request_id); | 127 script_context_->DidHandleInstallEvent(request_id, result); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void EmbeddedWorkerContextClient::didHandleFetchEvent(int request_id) { | 130 void EmbeddedWorkerContextClient::didHandleFetchEvent(int request_id) { |
| 129 DCHECK(script_context_); | 131 DCHECK(script_context_); |
| 130 script_context_->DidHandleFetchEvent( | 132 script_context_->DidHandleFetchEvent( |
| 131 request_id, | 133 request_id, |
| 132 SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, | 134 SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, |
| 133 ServiceWorkerResponse()); | 135 ServiceWorkerResponse()); |
| 134 } | 136 } |
| 135 | 137 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 157 } | 159 } |
| 158 | 160 |
| 159 void EmbeddedWorkerContextClient::SendWorkerStarted() { | 161 void EmbeddedWorkerContextClient::SendWorkerStarted() { |
| 160 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 162 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 161 sender_->Send(new EmbeddedWorkerHostMsg_WorkerStarted( | 163 sender_->Send(new EmbeddedWorkerHostMsg_WorkerStarted( |
| 162 WorkerTaskRunner::Instance()->CurrentWorkerId(), | 164 WorkerTaskRunner::Instance()->CurrentWorkerId(), |
| 163 embedded_worker_id_)); | 165 embedded_worker_id_)); |
| 164 } | 166 } |
| 165 | 167 |
| 166 } // namespace content | 168 } // namespace content |
| OLD | NEW |