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

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

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 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
« no previous file with comments | « chrome/common/child_process_host.cc ('k') | chrome/common/extensions/extension.cc » ('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) 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/common/child_thread.h" 5 #include "chrome/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 "chrome/common/child_process.h" 10 #include "chrome/common/child_process.h"
(...skipping 29 matching lines...) Expand all
40 webkit_glue::SetUserAgent( 40 webkit_glue::SetUserAgent(
41 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 41 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
42 switches::kUserAgent)); 42 switches::kUserAgent));
43 } 43 }
44 44
45 channel_.reset(new IPC::SyncChannel(channel_name_, 45 channel_.reset(new IPC::SyncChannel(channel_name_,
46 IPC::Channel::MODE_CLIENT, this, 46 IPC::Channel::MODE_CLIENT, this,
47 ChildProcess::current()->io_message_loop(), true, 47 ChildProcess::current()->io_message_loop(), true,
48 ChildProcess::current()->GetShutDownEvent())); 48 ChildProcess::current()->GetShutDownEvent()));
49 #ifdef IPC_MESSAGE_LOG_ENABLED 49 #ifdef IPC_MESSAGE_LOG_ENABLED
50 IPC::Logging::current()->SetIPCSender(this); 50 IPC::Logging::GetInstance()->SetIPCSender(this);
51 #endif 51 #endif
52 52
53 resource_dispatcher_.reset(new ResourceDispatcher(this)); 53 resource_dispatcher_.reset(new ResourceDispatcher(this));
54 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 54 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
55 file_system_dispatcher_.reset(new FileSystemDispatcher()); 55 file_system_dispatcher_.reset(new FileSystemDispatcher());
56 56
57 sync_message_filter_ = 57 sync_message_filter_ =
58 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); 58 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
59 channel_->AddFilter(sync_message_filter_.get()); 59 channel_->AddFilter(sync_message_filter_.get());
60 60
61 // When running in unit tests, there is already a NotificationService object. 61 // When running in unit tests, there is already a NotificationService object.
62 // Since only one can exist at a time per thread, check first. 62 // Since only one can exist at a time per thread, check first.
63 if (!NotificationService::current()) 63 if (!NotificationService::current())
64 notification_service_.reset(new NotificationService); 64 notification_service_.reset(new NotificationService);
65 } 65 }
66 66
67 ChildThread::~ChildThread() { 67 ChildThread::~ChildThread() {
68 #ifdef IPC_MESSAGE_LOG_ENABLED 68 #ifdef IPC_MESSAGE_LOG_ENABLED
69 IPC::Logging::current()->SetIPCSender(NULL); 69 IPC::Logging::GetInstance()->SetIPCSender(NULL);
70 #endif 70 #endif
71 71
72 channel_->RemoveFilter(sync_message_filter_.get()); 72 channel_->RemoveFilter(sync_message_filter_.get());
73 73
74 // Close this channel before resetting the message loop attached to it so 74 // Close this channel before resetting the message loop attached to it so
75 // the message loop can call ChannelProxy::Context::OnChannelClosed(), which 75 // the message loop can call ChannelProxy::Context::OnChannelClosed(), which
76 // releases the reference count to this channel. 76 // releases the reference count to this channel.
77 channel_->Close(); 77 channel_->Close();
78 78
79 // The ChannelProxy object caches a pointer to the IPC thread, so need to 79 // The ChannelProxy object caches a pointer to the IPC thread, so need to
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 check_with_browser_before_shutdown_ = true; 173 check_with_browser_before_shutdown_ = true;
174 } 174 }
175 175
176 void ChildThread::OnShutdown() { 176 void ChildThread::OnShutdown() {
177 MessageLoop::current()->Quit(); 177 MessageLoop::current()->Quit();
178 } 178 }
179 179
180 #if defined(IPC_MESSAGE_LOG_ENABLED) 180 #if defined(IPC_MESSAGE_LOG_ENABLED)
181 void ChildThread::OnSetIPCLoggingEnabled(bool enable) { 181 void ChildThread::OnSetIPCLoggingEnabled(bool enable) {
182 if (enable) 182 if (enable)
183 IPC::Logging::current()->Enable(); 183 IPC::Logging::GetInstance()->Enable();
184 else 184 else
185 IPC::Logging::current()->Disable(); 185 IPC::Logging::GetInstance()->Disable();
186 } 186 }
187 #endif // IPC_MESSAGE_LOG_ENABLED 187 #endif // IPC_MESSAGE_LOG_ENABLED
188 188
189 ChildThread* ChildThread::current() { 189 ChildThread* ChildThread::current() {
190 return ChildProcess::current()->main_thread(); 190 return ChildProcess::current()->main_thread();
191 } 191 }
192 192
193 void ChildThread::OnProcessFinalRelease() { 193 void ChildThread::OnProcessFinalRelease() {
194 if (on_channel_error_called_ || !check_with_browser_before_shutdown_) { 194 if (on_channel_error_called_ || !check_with_browser_before_shutdown_) {
195 MessageLoop::current()->Quit(); 195 MessageLoop::current()->Quit();
196 return; 196 return;
197 } 197 }
198 198
199 // The child process shutdown sequence is a request response based mechanism, 199 // The child process shutdown sequence is a request response based mechanism,
200 // where we send out an initial feeler request to the child process host 200 // where we send out an initial feeler request to the child process host
201 // instance in the browser to verify if it's ok to shutdown the child process. 201 // instance in the browser to verify if it's ok to shutdown the child process.
202 // The browser then sends back a response if it's ok to shutdown. 202 // The browser then sends back a response if it's ok to shutdown.
203 Send(new PluginProcessHostMsg_ShutdownRequest); 203 Send(new PluginProcessHostMsg_ShutdownRequest);
204 } 204 }
OLDNEW
« no previous file with comments | « chrome/common/child_process_host.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698