| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/worker/worker_thread.h" | 5 #include "chrome/worker/worker_thread.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/thread_local.h" | 9 #include "base/thread_local.h" |
| 10 #include "chrome/common/appcache/appcache_dispatcher.h" | 10 #include "chrome/common/appcache/appcache_dispatcher.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 db_message_filter_ = NULL; | 70 db_message_filter_ = NULL; |
| 71 | 71 |
| 72 WebKit::shutdown(); | 72 WebKit::shutdown(); |
| 73 lazy_tls.Pointer()->Set(NULL); | 73 lazy_tls.Pointer()->Set(NULL); |
| 74 } | 74 } |
| 75 | 75 |
| 76 WorkerThread* WorkerThread::current() { | 76 WorkerThread* WorkerThread::current() { |
| 77 return lazy_tls.Pointer()->Get(); | 77 return lazy_tls.Pointer()->Get(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void WorkerThread::OnControlMessageReceived(const IPC::Message& msg) { | 80 bool WorkerThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 81 // Appcache messages are handled by a delegate. | 81 // Appcache messages are handled by a delegate. |
| 82 if (appcache_dispatcher_->OnMessageReceived(msg)) | 82 if (appcache_dispatcher_->OnMessageReceived(msg)) |
| 83 return; | 83 return true; |
| 84 | 84 |
| 85 bool handled = true; |
| 85 IPC_BEGIN_MESSAGE_MAP(WorkerThread, msg) | 86 IPC_BEGIN_MESSAGE_MAP(WorkerThread, msg) |
| 86 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateWorker) | 87 IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateWorker) |
| 88 IPC_MESSAGE_UNHANDLED(handled = false) |
| 87 IPC_END_MESSAGE_MAP() | 89 IPC_END_MESSAGE_MAP() |
| 90 return handled; |
| 88 } | 91 } |
| 89 | 92 |
| 90 void WorkerThread::OnCreateWorker( | 93 void WorkerThread::OnCreateWorker( |
| 91 const WorkerProcessMsg_CreateWorker_Params& params) { | 94 const WorkerProcessMsg_CreateWorker_Params& params) { |
| 92 WorkerAppCacheInitInfo appcache_init_info( | 95 WorkerAppCacheInitInfo appcache_init_info( |
| 93 params.is_shared, params.creator_process_id, | 96 params.is_shared, params.creator_process_id, |
| 94 params.creator_appcache_host_id, | 97 params.creator_appcache_host_id, |
| 95 params.shared_worker_appcache_id); | 98 params.shared_worker_appcache_id); |
| 96 | 99 |
| 97 // WebWorkerStub and WebSharedWorkerStub own themselves. | 100 // WebWorkerStub and WebSharedWorkerStub own themselves. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 111 } | 114 } |
| 112 } | 115 } |
| 113 | 116 |
| 114 void WorkerThread::RemoveWorkerStub(WebWorkerStubBase* stub) { | 117 void WorkerThread::RemoveWorkerStub(WebWorkerStubBase* stub) { |
| 115 worker_stubs_.erase(stub); | 118 worker_stubs_.erase(stub); |
| 116 } | 119 } |
| 117 | 120 |
| 118 void WorkerThread::AddWorkerStub(WebWorkerStubBase* stub) { | 121 void WorkerThread::AddWorkerStub(WebWorkerStubBase* stub) { |
| 119 worker_stubs_.insert(stub); | 122 worker_stubs_.insert(stub); |
| 120 } | 123 } |
| OLD | NEW |