OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/child_thread.h" | 5 #include "content/common/child_thread.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "content/common/child_process.h" | 10 #include "content/common/child_process.h" |
11 #include "content/common/child_process_messages.h" | 11 #include "content/common/child_process_messages.h" |
12 #include "content/common/child_trace_message_filter.h" | 12 #include "content/common/child_trace_message_filter.h" |
13 #include "content/common/file_system/file_system_dispatcher.h" | 13 #include "content/common/file_system/file_system_dispatcher.h" |
14 #include "content/common/quota_dispatcher.h" | 14 #include "content/common/quota_dispatcher.h" |
15 #include "content/common/resource_dispatcher.h" | 15 #include "content/common/resource_dispatcher.h" |
16 #include "content/common/socket_stream_dispatcher.h" | 16 #include "content/common/socket_stream_dispatcher.h" |
| 17 #include "content/common/worker_task_runner.h" |
17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 19 #include "content/renderer/indexed_db_message_filter.h" |
18 #include "ipc/ipc_logging.h" | 20 #include "ipc/ipc_logging.h" |
19 #include "ipc/ipc_sync_channel.h" | 21 #include "ipc/ipc_sync_channel.h" |
20 #include "ipc/ipc_sync_message_filter.h" | 22 #include "ipc/ipc_sync_message_filter.h" |
21 #include "ipc/ipc_switches.h" | 23 #include "ipc/ipc_switches.h" |
22 #include "webkit/glue/webkit_glue.h" | 24 #include "webkit/glue/webkit_glue.h" |
23 | 25 |
24 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
25 #include "content/common/handle_enumerator_win.h" | 27 #include "content/common/handle_enumerator_win.h" |
26 #endif | 28 #endif |
27 | 29 |
(...skipping 22 matching lines...) Expand all Loading... |
50 | 52 |
51 resource_dispatcher_.reset(new ResourceDispatcher(this)); | 53 resource_dispatcher_.reset(new ResourceDispatcher(this)); |
52 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | 54 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
53 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 55 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
54 quota_dispatcher_.reset(new QuotaDispatcher()); | 56 quota_dispatcher_.reset(new QuotaDispatcher()); |
55 | 57 |
56 sync_message_filter_ = | 58 sync_message_filter_ = |
57 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 59 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
58 channel_->AddFilter(sync_message_filter_.get()); | 60 channel_->AddFilter(sync_message_filter_.get()); |
59 channel_->AddFilter(new ChildTraceMessageFilter()); | 61 channel_->AddFilter(new ChildTraceMessageFilter()); |
| 62 |
| 63 idb_message_filter_ = new IndexedDBMessageFilter; |
| 64 channel_->AddFilter(idb_message_filter_.get()); |
| 65 |
| 66 worker_task_runner_ = new WorkerTaskRunner; |
| 67 worker_task_runner_->AddObserver(idb_message_filter_); |
60 } | 68 } |
61 | 69 |
62 ChildThread::~ChildThread() { | 70 ChildThread::~ChildThread() { |
63 #ifdef IPC_MESSAGE_LOG_ENABLED | 71 #ifdef IPC_MESSAGE_LOG_ENABLED |
64 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 72 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
65 #endif | 73 #endif |
66 | 74 |
67 channel_->RemoveFilter(sync_message_filter_.get()); | 75 channel_->RemoveFilter(sync_message_filter_.get()); |
68 | 76 |
69 // Close this channel before resetting the message loop attached to it so | 77 // Close this channel before resetting the message loop attached to it so |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 MessageLoop::current()->Quit(); | 248 MessageLoop::current()->Quit(); |
241 return; | 249 return; |
242 } | 250 } |
243 | 251 |
244 // The child process shutdown sequence is a request response based mechanism, | 252 // The child process shutdown sequence is a request response based mechanism, |
245 // where we send out an initial feeler request to the child process host | 253 // where we send out an initial feeler request to the child process host |
246 // instance in the browser to verify if it's ok to shutdown the child process. | 254 // instance in the browser to verify if it's ok to shutdown the child process. |
247 // The browser then sends back a response if it's ok to shutdown. | 255 // The browser then sends back a response if it's ok to shutdown. |
248 Send(new ChildProcessHostMsg_ShutdownRequest); | 256 Send(new ChildProcessHostMsg_ShutdownRequest); |
249 } | 257 } |
| 258 |
| 259 IndexedDBDispatcher* ChildThread::indexed_db_dispatcher() const { |
| 260 return idb_message_filter_->thread_specific_idb_dispatcher(); |
| 261 } |
| 262 |
| 263 WorkerTaskRunner* ChildThread::worker_task_runner() const { |
| 264 return worker_task_runner_; |
| 265 } |
OLD | NEW |