Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: content/common/child_thread.cc

Issue 8747002: Dispatch IndexedDB IPC messages to worker threads (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: repurpose obsolete indexed-db switch to control idb on workers Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/tracked_objects.h" 12 #include "base/tracked_objects.h"
13 #include "content/common/child_process.h" 13 #include "content/common/child_process.h"
14 #include "content/common/child_process_messages.h" 14 #include "content/common/child_process_messages.h"
15 #include "content/common/child_trace_message_filter.h" 15 #include "content/common/child_trace_message_filter.h"
16 #include "content/common/file_system/file_system_dispatcher.h" 16 #include "content/common/file_system/file_system_dispatcher.h"
17 #include "content/common/indexed_db_message_filter.h"
17 #include "content/common/quota_dispatcher.h" 18 #include "content/common/quota_dispatcher.h"
18 #include "content/common/resource_dispatcher.h" 19 #include "content/common/resource_dispatcher.h"
19 #include "content/common/socket_stream_dispatcher.h" 20 #include "content/common/socket_stream_dispatcher.h"
21 #include "content/common/worker_task_runner.h"
20 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
21 #include "ipc/ipc_logging.h" 23 #include "ipc/ipc_logging.h"
22 #include "ipc/ipc_sync_channel.h" 24 #include "ipc/ipc_sync_channel.h"
23 #include "ipc/ipc_sync_message_filter.h" 25 #include "ipc/ipc_sync_message_filter.h"
24 #include "ipc/ipc_switches.h" 26 #include "ipc/ipc_switches.h"
25 #include "webkit/glue/webkit_glue.h" 27 #include "webkit/glue/webkit_glue.h"
26 28
27 #if defined(OS_WIN) 29 #if defined(OS_WIN)
28 #include "content/common/handle_enumerator_win.h" 30 #include "content/common/handle_enumerator_win.h"
29 #endif 31 #endif
(...skipping 23 matching lines...) Expand all
53 55
54 resource_dispatcher_.reset(new ResourceDispatcher(this)); 56 resource_dispatcher_.reset(new ResourceDispatcher(this));
55 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 57 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
56 file_system_dispatcher_.reset(new FileSystemDispatcher()); 58 file_system_dispatcher_.reset(new FileSystemDispatcher());
57 quota_dispatcher_.reset(new QuotaDispatcher()); 59 quota_dispatcher_.reset(new QuotaDispatcher());
58 60
59 sync_message_filter_ = 61 sync_message_filter_ =
60 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); 62 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
61 channel_->AddFilter(sync_message_filter_.get()); 63 channel_->AddFilter(sync_message_filter_.get());
62 channel_->AddFilter(new ChildTraceMessageFilter()); 64 channel_->AddFilter(new ChildTraceMessageFilter());
65
66 idb_message_filter_ = new IndexedDBMessageFilter;
67 channel_->AddFilter(idb_message_filter_.get());
68
69 worker_task_runner_ = new WorkerTaskRunner;
70 worker_task_runner_->AddObserver(idb_message_filter_.get());
63 } 71 }
64 72
65 ChildThread::~ChildThread() { 73 ChildThread::~ChildThread() {
66 #ifdef IPC_MESSAGE_LOG_ENABLED 74 #ifdef IPC_MESSAGE_LOG_ENABLED
67 IPC::Logging::GetInstance()->SetIPCSender(NULL); 75 IPC::Logging::GetInstance()->SetIPCSender(NULL);
68 #endif 76 #endif
69 77
70 channel_->RemoveFilter(sync_message_filter_.get()); 78 channel_->RemoveFilter(sync_message_filter_.get());
71 79
72 // Close this channel before resetting the message loop attached to it so 80 // Close this channel before resetting the message loop attached to it so
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 MessageLoop::current()->Quit(); 271 MessageLoop::current()->Quit();
264 return; 272 return;
265 } 273 }
266 274
267 // The child process shutdown sequence is a request response based mechanism, 275 // The child process shutdown sequence is a request response based mechanism,
268 // where we send out an initial feeler request to the child process host 276 // where we send out an initial feeler request to the child process host
269 // instance in the browser to verify if it's ok to shutdown the child process. 277 // instance in the browser to verify if it's ok to shutdown the child process.
270 // The browser then sends back a response if it's ok to shutdown. 278 // The browser then sends back a response if it's ok to shutdown.
271 Send(new ChildProcessHostMsg_ShutdownRequest); 279 Send(new ChildProcessHostMsg_ShutdownRequest);
272 } 280 }
281
282 IndexedDBDispatcher* ChildThread::indexed_db_dispatcher() const {
283 return idb_message_filter_->thread_specific_idb_dispatcher();
284 }
285
286 WorkerTaskRunner* ChildThread::worker_task_runner() const {
287 return worker_task_runner_.get();
288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698