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

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

Issue 6811022: Add IPC plumbing code for Quota API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments reflected Created 9 years, 8 months 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
« no previous file with comments | « content/common/child_thread.h ('k') | content/common/content_message_generator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/content_switches.h" 13 #include "content/common/content_switches.h"
14 #include "content/common/file_system/file_system_dispatcher.h" 14 #include "content/common/file_system/file_system_dispatcher.h"
15 #include "content/common/notification_service.h" 15 #include "content/common/notification_service.h"
16 #include "content/common/quota_dispatcher.h"
16 #include "content/common/resource_dispatcher.h" 17 #include "content/common/resource_dispatcher.h"
17 #include "content/common/socket_stream_dispatcher.h" 18 #include "content/common/socket_stream_dispatcher.h"
18 #include "ipc/ipc_logging.h" 19 #include "ipc/ipc_logging.h"
19 #include "ipc/ipc_sync_channel.h" 20 #include "ipc/ipc_sync_channel.h"
20 #include "ipc/ipc_sync_message_filter.h" 21 #include "ipc/ipc_sync_message_filter.h"
21 #include "ipc/ipc_switches.h" 22 #include "ipc/ipc_switches.h"
22 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
23 24
24 ChildThread::ChildThread() { 25 ChildThread::ChildThread() {
25 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 26 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
(...skipping 20 matching lines...) Expand all
46 IPC::Channel::MODE_CLIENT, this, 47 IPC::Channel::MODE_CLIENT, this,
47 ChildProcess::current()->io_message_loop(), true, 48 ChildProcess::current()->io_message_loop(), true,
48 ChildProcess::current()->GetShutDownEvent())); 49 ChildProcess::current()->GetShutDownEvent()));
49 #ifdef IPC_MESSAGE_LOG_ENABLED 50 #ifdef IPC_MESSAGE_LOG_ENABLED
50 IPC::Logging::GetInstance()->SetIPCSender(this); 51 IPC::Logging::GetInstance()->SetIPCSender(this);
51 #endif 52 #endif
52 53
53 resource_dispatcher_.reset(new ResourceDispatcher(this)); 54 resource_dispatcher_.reset(new ResourceDispatcher(this));
54 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 55 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
55 file_system_dispatcher_.reset(new FileSystemDispatcher()); 56 file_system_dispatcher_.reset(new FileSystemDispatcher());
57 quota_dispatcher_.reset(new QuotaDispatcher());
56 58
57 sync_message_filter_ = 59 sync_message_filter_ =
58 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); 60 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
59 channel_->AddFilter(sync_message_filter_.get()); 61 channel_->AddFilter(sync_message_filter_.get());
60 62
61 #if !defined(NACL_WIN64) 63 #if !defined(NACL_WIN64)
62 // This brings in a depenency on gpu, which isn't linked in with NaCl's win64 64 // This brings in a depenency on gpu, which isn't linked in with NaCl's win64
63 // build. 65 // build.
64 channel_->AddFilter(new ChildTraceMessageFilter()); 66 channel_->AddFilter(new ChildTraceMessageFilter());
65 #endif 67 #endif
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 145 }
144 146
145 bool ChildThread::OnMessageReceived(const IPC::Message& msg) { 147 bool ChildThread::OnMessageReceived(const IPC::Message& msg) {
146 // Resource responses are sent to the resource dispatcher. 148 // Resource responses are sent to the resource dispatcher.
147 if (resource_dispatcher_->OnMessageReceived(msg)) 149 if (resource_dispatcher_->OnMessageReceived(msg))
148 return true; 150 return true;
149 if (socket_stream_dispatcher_->OnMessageReceived(msg)) 151 if (socket_stream_dispatcher_->OnMessageReceived(msg))
150 return true; 152 return true;
151 if (file_system_dispatcher_->OnMessageReceived(msg)) 153 if (file_system_dispatcher_->OnMessageReceived(msg))
152 return true; 154 return true;
155 if (quota_dispatcher_->OnMessageReceived(msg))
156 return true;
153 157
154 bool handled = true; 158 bool handled = true;
155 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) 159 IPC_BEGIN_MESSAGE_MAP(ChildThread, msg)
156 IPC_MESSAGE_HANDLER(ChildProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown) 160 IPC_MESSAGE_HANDLER(ChildProcessMsg_AskBeforeShutdown, OnAskBeforeShutdown)
157 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) 161 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown)
158 #if defined(IPC_MESSAGE_LOG_ENABLED) 162 #if defined(IPC_MESSAGE_LOG_ENABLED)
159 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, 163 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled,
160 OnSetIPCLoggingEnabled) 164 OnSetIPCLoggingEnabled)
161 #endif 165 #endif
162 IPC_MESSAGE_UNHANDLED(handled = false) 166 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 MessageLoop::current()->Quit(); 205 MessageLoop::current()->Quit();
202 return; 206 return;
203 } 207 }
204 208
205 // The child process shutdown sequence is a request response based mechanism, 209 // The child process shutdown sequence is a request response based mechanism,
206 // where we send out an initial feeler request to the child process host 210 // where we send out an initial feeler request to the child process host
207 // instance in the browser to verify if it's ok to shutdown the child process. 211 // instance in the browser to verify if it's ok to shutdown the child process.
208 // The browser then sends back a response if it's ok to shutdown. 212 // The browser then sends back a response if it's ok to shutdown.
209 Send(new ChildProcessHostMsg_ShutdownRequest); 213 Send(new ChildProcessHostMsg_ShutdownRequest);
210 } 214 }
OLDNEW
« no previous file with comments | « content/common/child_thread.h ('k') | content/common/content_message_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698