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

Side by Side Diff: content/browser/child_process_launcher.cc

Issue 6976042: Turn off optimization for ChildProcessLauncher::Context::TerminateInternal. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 | « no previous file | 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) 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/browser/child_process_launcher.h" 5 #include "content/browser/child_process_launcher.h"
6 6
7 #include <utility> // For std::pair. 7 #include <utility> // For std::pair.
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "build/build_config.h"
darin (slow to review) 2011/05/27 17:37:46 nit: this header is already included for you by ot
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
16 #include "content/browser/content_browser_client.h" 17 #include "content/browser/content_browser_client.h"
17 #include "content/common/chrome_descriptors.h" 18 #include "content/common/chrome_descriptors.h"
18 #include "content/common/process_watcher.h" 19 #include "content/common/process_watcher.h"
19 #include "content/common/result_codes.h" 20 #include "content/common/result_codes.h"
20 21
21 #if defined(OS_WIN) 22 #if defined(OS_WIN)
22 #include "base/file_path.h" 23 #include "base/file_path.h"
23 #include "chrome/common/sandbox_policy.h" 24 #include "chrome/common/sandbox_policy.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 #endif 230 #endif
230 process_.handle())); 231 process_.handle()));
231 process_.set_handle(base::kNullProcessHandle); 232 process_.set_handle(base::kNullProcessHandle);
232 } 233 }
233 234
234 void SetProcessBackgrounded(bool background) { 235 void SetProcessBackgrounded(bool background) {
235 DCHECK(!starting_); 236 DCHECK(!starting_);
236 process_.SetProcessBackgrounded(background); 237 process_.SetProcessBackgrounded(background);
237 } 238 }
238 239
240 // TODO(apatrick): Remove this ASAP. http://crbog.com/81449 shows that this is
241 // called before later calling null. Disable optimization to try and get more
242 // information about what happened here.
243 #if defined(OS_WIN)
244 #pragma optimize("", off)
245 #endif
246
239 static void TerminateInternal( 247 static void TerminateInternal(
240 #if defined(OS_LINUX) 248 #if defined(OS_LINUX)
241 bool zygote, 249 bool zygote,
242 #endif 250 #endif
243 base::ProcessHandle handle) { 251 base::ProcessHandle handle) {
244 base::Process process(handle); 252 base::Process process(handle);
245 // Client has gone away, so just kill the process. Using exit code 0 253 // Client has gone away, so just kill the process. Using exit code 0
246 // means that UMA won't treat this as a crash. 254 // means that UMA won't treat this as a crash.
247 process.Terminate(ResultCodes::NORMAL_EXIT); 255 process.Terminate(ResultCodes::NORMAL_EXIT);
248 // On POSIX, we must additionally reap the child. 256 // On POSIX, we must additionally reap the child.
249 #if defined(OS_POSIX) 257 #if defined(OS_POSIX)
250 #if defined(OS_LINUX) 258 #if defined(OS_LINUX)
251 if (zygote) { 259 if (zygote) {
252 // If the renderer was created via a zygote, we have to proxy the reaping 260 // If the renderer was created via a zygote, we have to proxy the reaping
253 // through the zygote process. 261 // through the zygote process.
254 ZygoteHost::GetInstance()->EnsureProcessTerminated(handle); 262 ZygoteHost::GetInstance()->EnsureProcessTerminated(handle);
255 } else 263 } else
256 #endif // OS_LINUX 264 #endif // OS_LINUX
257 { 265 {
258 ProcessWatcher::EnsureProcessTerminated(handle); 266 ProcessWatcher::EnsureProcessTerminated(handle);
259 } 267 }
260 #endif // OS_POSIX 268 #endif // OS_POSIX
261 process.Close(); 269 process.Close();
262 } 270 }
263 271
272 #if defined(OS_WIN)
273 #pragma optimize("", on)
274 #endif
275
264 Client* client_; 276 Client* client_;
265 BrowserThread::ID client_thread_id_; 277 BrowserThread::ID client_thread_id_;
266 base::Process process_; 278 base::Process process_;
267 bool starting_; 279 bool starting_;
268 // Controls whether the child process should be terminated on browser 280 // Controls whether the child process should be terminated on browser
269 // shutdown. Default behavior is to terminate the child. 281 // shutdown. Default behavior is to terminate the child.
270 bool terminate_child_on_shutdown_; 282 bool terminate_child_on_shutdown_;
271 283
272 #if defined(OS_LINUX) 284 #if defined(OS_LINUX)
273 bool zygote_; 285 bool zygote_;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 &ChildProcessLauncher::Context::SetProcessBackgrounded, 356 &ChildProcessLauncher::Context::SetProcessBackgrounded,
345 background)); 357 background));
346 } 358 }
347 359
348 void ChildProcessLauncher::SetTerminateChildOnShutdown( 360 void ChildProcessLauncher::SetTerminateChildOnShutdown(
349 bool terminate_on_shutdown) { 361 bool terminate_on_shutdown) {
350 if (context_) 362 if (context_)
351 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); 363 context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
352 } 364 }
353 365
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698