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

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

Issue 32283003: Fix crash with IPC_MESSAGE_LOG_ENABLED when running in single-process mode or in-process-gpu. The … (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Remove the change to the DCHECK Created 7 years, 1 month 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
« no previous file with comments | « content/child/child_thread.h ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/child/child_thread.h" 5 #include "content/child/child_thread.h"
6 6
7 #include "base/allocator/allocator_extension.h" 7 #include "base/allocator/allocator_extension.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 void QuitMainThreadMessageLoop() { 127 void QuitMainThreadMessageLoop() {
128 base::MessageLoop::current()->Quit(); 128 base::MessageLoop::current()->Quit();
129 } 129 }
130 130
131 #endif 131 #endif
132 132
133 } // namespace 133 } // namespace
134 134
135 ChildThread::ChildThread() 135 ChildThread::ChildThread()
136 : channel_connected_factory_(this) { 136 : channel_connected_factory_(this),
137 in_browser_process_(false) {
137 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 138 channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
138 switches::kProcessChannelID); 139 switches::kProcessChannelID);
139 Init(); 140 Init();
140 } 141 }
141 142
142 ChildThread::ChildThread(const std::string& channel_name) 143 ChildThread::ChildThread(const std::string& channel_name)
143 : channel_name_(channel_name), 144 : channel_name_(channel_name),
144 channel_connected_factory_(this) { 145 channel_connected_factory_(this),
146 in_browser_process_(true) {
145 Init(); 147 Init();
146 } 148 }
147 149
148 void ChildThread::Init() { 150 void ChildThread::Init() {
149 g_lazy_tls.Pointer()->Set(this); 151 g_lazy_tls.Pointer()->Set(this);
150 on_channel_error_called_ = false; 152 on_channel_error_called_ = false;
151 message_loop_ = base::MessageLoop::current(); 153 message_loop_ = base::MessageLoop::current();
152 #ifdef IPC_MESSAGE_LOG_ENABLED 154 #ifdef IPC_MESSAGE_LOG_ENABLED
153 // We must make sure to instantiate the IPC Logger *before* we create the 155 // We must make sure to instantiate the IPC Logger *before* we create the
154 // channel, otherwise we can get a callback on the IO thread which creates 156 // channel, otherwise we can get a callback on the IO thread which creates
155 // the logger, and the logger does not like being created on the IO thread. 157 // the logger, and the logger does not like being created on the IO thread.
156 IPC::Logging::GetInstance(); 158 IPC::Logging::GetInstance();
157 #endif 159 #endif
158 channel_.reset( 160 channel_.reset(
159 new IPC::SyncChannel(channel_name_, 161 new IPC::SyncChannel(channel_name_,
160 IPC::Channel::MODE_CLIENT, 162 IPC::Channel::MODE_CLIENT,
161 this, 163 this,
162 ChildProcess::current()->io_message_loop_proxy(), 164 ChildProcess::current()->io_message_loop_proxy(),
163 true, 165 true,
164 ChildProcess::current()->GetShutDownEvent())); 166 ChildProcess::current()->GetShutDownEvent()));
165 #ifdef IPC_MESSAGE_LOG_ENABLED 167 #ifdef IPC_MESSAGE_LOG_ENABLED
166 IPC::Logging::GetInstance()->SetIPCSender(this); 168 if (!in_browser_process_)
169 IPC::Logging::GetInstance()->SetIPCSender(this);
167 #endif 170 #endif
168 171
169 sync_message_filter_ = 172 sync_message_filter_ =
170 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); 173 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
171 thread_safe_sender_ = new ThreadSafeSender( 174 thread_safe_sender_ = new ThreadSafeSender(
172 base::MessageLoopProxy::current().get(), sync_message_filter_.get()); 175 base::MessageLoopProxy::current().get(), sync_message_filter_.get());
173 176
174 resource_dispatcher_.reset(new ResourceDispatcher(this)); 177 resource_dispatcher_.reset(new ResourceDispatcher(this));
175 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); 178 socket_stream_dispatcher_.reset(new SocketStreamDispatcher());
176 websocket_dispatcher_.reset(new WebSocketDispatcher); 179 websocket_dispatcher_.reset(new WebSocketDispatcher);
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // inflight that would addref it. 479 // inflight that would addref it.
477 Send(new ChildProcessHostMsg_ShutdownRequest); 480 Send(new ChildProcessHostMsg_ShutdownRequest);
478 } 481 }
479 482
480 void ChildThread::EnsureConnected() { 483 void ChildThread::EnsureConnected() {
481 LOG(INFO) << "ChildThread::EnsureConnected()"; 484 LOG(INFO) << "ChildThread::EnsureConnected()";
482 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); 485 base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
483 } 486 }
484 487
485 } // namespace content 488 } // namespace content
OLDNEW
« no previous file with comments | « content/child/child_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698