| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // At this point OnWorkerRunLoopStopped is already called, so | 147 // At this point OnWorkerRunLoopStopped is already called, so |
| 148 // worker_task_runner_->RunsTasksOnCurrentThread() returns false | 148 // worker_task_runner_->RunsTasksOnCurrentThread() returns false |
| 149 // (while we're still on the worker thread). | 149 // (while we're still on the worker thread). |
| 150 script_context_.reset(); | 150 script_context_.reset(); |
| 151 main_thread_proxy_->PostTask( | 151 main_thread_proxy_->PostTask( |
| 152 FROM_HERE, | 152 FROM_HERE, |
| 153 base::Bind(&CallWorkerContextDestroyedOnMainThread, | 153 base::Bind(&CallWorkerContextDestroyedOnMainThread, |
| 154 embedded_worker_id_)); | 154 embedded_worker_id_)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void EmbeddedWorkerContextClient::reportException( |
| 158 const blink::WebString& error_message, |
| 159 int line_number, |
| 160 int column_number, |
| 161 const blink::WebString& source_url) { |
| 162 sender_->Send(new EmbeddedWorkerHostMsg_ReportException( |
| 163 embedded_worker_id_, error_message, line_number, |
| 164 column_number, GURL(source_url))); |
| 165 } |
| 166 |
| 157 void EmbeddedWorkerContextClient::didHandleActivateEvent( | 167 void EmbeddedWorkerContextClient::didHandleActivateEvent( |
| 158 int request_id, | 168 int request_id, |
| 159 blink::WebServiceWorkerEventResult result) { | 169 blink::WebServiceWorkerEventResult result) { |
| 160 DCHECK(script_context_); | 170 DCHECK(script_context_); |
| 161 script_context_->DidHandleActivateEvent(request_id, result); | 171 script_context_->DidHandleActivateEvent(request_id, result); |
| 162 } | 172 } |
| 163 | 173 |
| 164 void EmbeddedWorkerContextClient::didHandleInstallEvent( | 174 void EmbeddedWorkerContextClient::didHandleInstallEvent( |
| 165 int request_id, | 175 int request_id, |
| 166 blink::WebServiceWorkerEventResult result) { | 176 blink::WebServiceWorkerEventResult result) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 237 } |
| 228 | 238 |
| 229 void EmbeddedWorkerContextClient::SendWorkerStarted() { | 239 void EmbeddedWorkerContextClient::SendWorkerStarted() { |
| 230 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 240 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 231 sender_->Send(new EmbeddedWorkerHostMsg_WorkerStarted( | 241 sender_->Send(new EmbeddedWorkerHostMsg_WorkerStarted( |
| 232 WorkerTaskRunner::Instance()->CurrentWorkerId(), | 242 WorkerTaskRunner::Instance()->CurrentWorkerId(), |
| 233 embedded_worker_id_)); | 243 embedded_worker_id_)); |
| 234 } | 244 } |
| 235 | 245 |
| 236 } // namespace content | 246 } // namespace content |
| OLD | NEW |