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

Side by Side Diff: base/process_util.cc

Issue 9837053: Added code for renderer to cleanly exit. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added a more descriptive message. 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) 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 "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 namespace base { 7 namespace base {
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 ProcessEntry::ProcessEntry() : pid_(0), ppid_(0), gid_(0) {} 10 ProcessEntry::ProcessEntry() : pid_(0), ppid_(0), gid_(0) {}
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (executable_name_.size() > 15) { 69 if (executable_name_.size() > 15) {
70 executable_name_ = FilePath::StringType(executable_name_, 70 executable_name_ = FilePath::StringType(executable_name_,
71 executable_name_.size() - 15, 15); 71 executable_name_.size() - 15, 15);
72 } 72 }
73 #endif 73 #endif
74 } 74 }
75 75
76 NamedProcessIterator::~NamedProcessIterator() { 76 NamedProcessIterator::~NamedProcessIterator() {
77 } 77 }
78 78
79 #if defined(RENDERER_CLEAN_EXIT)
80 base::subtle::Atomic32 exit_counter;
81
82 extern void clean_exit(int return_value)
Markus (顧孟勤) 2012/03/28 23:07:56 This function should be marked as __attribute__((n
83 {
84 base::subtle::Atomic32 new_exit_counter;
85 new_exit_counter = base::subtle::
86 Barrier_AtomicIncrement(&exit_counter, (base::subtle::Atomic32)1);
87 if (new_exit_counter == 1)
88 {
89 fprintf(stderr, "Renderer process exiting.\n");
Markus (顧孟勤) 2012/03/28 23:07:56 If you plan on calling clean_exit() from a signal
90 exit(return_value);
91 }
92 else
93 {
94 fprintf(stderr, "Another renderer thread already called exit!.\n");
95 fprintf(stderr, "Not calling exit() myself.\n");
Markus (顧孟勤) 2012/03/28 23:07:56 I don't think you ever want to return from this fu
96 }
97 }
98 #endif // defined(RENDERER_CLEAN_EXIT)
99
79 } // namespace base 100 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698