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

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

Issue 9936002: Added code so renderer would cleanly exit. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: git try Created 8 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
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/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/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/process_util.h" 14 #include "base/process_util.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "chrome/common/chrome_switches.h"
17 #include "content/common/chrome_descriptors.h" 18 #include "content/common/chrome_descriptors.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/content_browser_client.h" 20 #include "content/public/browser/content_browser_client.h"
20 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
21 #include "content/public/common/result_codes.h" 22 #include "content/public/common/result_codes.h"
22 23
23 #if defined(OS_WIN) 24 #if defined(OS_WIN)
24 #include "base/file_path.h" 25 #include "base/file_path.h"
25 #include "content/common/sandbox_policy.h" 26 #include "content/common/sandbox_policy.h"
26 #elif defined(OS_MACOSX) 27 #elif defined(OS_MACOSX)
(...skipping 15 matching lines...) Expand all
42 // parent class destructs, while still holding on to state that we need. 43 // parent class destructs, while still holding on to state that we need.
43 class ChildProcessLauncher::Context 44 class ChildProcessLauncher::Context
44 : public base::RefCountedThreadSafe<ChildProcessLauncher::Context> { 45 : public base::RefCountedThreadSafe<ChildProcessLauncher::Context> {
45 public: 46 public:
46 Context() 47 Context()
47 : client_(NULL), 48 : client_(NULL),
48 client_thread_id_(BrowserThread::UI), 49 client_thread_id_(BrowserThread::UI),
49 termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION), 50 termination_status_(base::TERMINATION_STATUS_NORMAL_TERMINATION),
50 exit_code_(content::RESULT_CODE_NORMAL_EXIT), 51 exit_code_(content::RESULT_CODE_NORMAL_EXIT),
51 starting_(true), 52 starting_(true),
52 terminate_child_on_shutdown_(true)
53 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 53 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
54 , zygote_(false) 54 zygote_(false)
55 #endif 55 #endif
56 { 56 {
57 terminate_child_on_shutdown_ = !CommandLine::ForCurrentProcess()->
58 HasSwitch(switches::kEnableRendererCleanExit);
57 } 59 }
58 60
59 void Launch( 61 void Launch(
60 #if defined(OS_WIN) 62 #if defined(OS_WIN)
61 const FilePath& exposed_dir, 63 const FilePath& exposed_dir,
62 #elif defined(OS_POSIX) 64 #elif defined(OS_POSIX)
63 bool use_zygote, 65 bool use_zygote,
64 const base::EnvironmentVector& environ, 66 const base::EnvironmentVector& environ,
65 int ipcfd, 67 int ipcfd,
66 #endif 68 #endif
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 base::Bind( 381 base::Bind(
380 &ChildProcessLauncher::Context::SetProcessBackgrounded, 382 &ChildProcessLauncher::Context::SetProcessBackgrounded,
381 GetHandle(), background)); 383 GetHandle(), background));
382 } 384 }
383 385
384 void ChildProcessLauncher::SetTerminateChildOnShutdown( 386 void ChildProcessLauncher::SetTerminateChildOnShutdown(
385 bool terminate_on_shutdown) { 387 bool terminate_on_shutdown) {
386 if (context_) 388 if (context_)
387 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); 389 context_->set_terminate_child_on_shutdown(terminate_on_shutdown);
388 } 390 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698