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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/process_util.cc
diff --git a/base/process_util.cc b/base/process_util.cc
index 9979dfa07b1b06ee9d8aca814da04907200f077d..4d401788d730372922beba264267ebe38bedda67 100644
--- a/base/process_util.cc
+++ b/base/process_util.cc
@@ -76,4 +76,25 @@ NamedProcessIterator::NamedProcessIterator(
NamedProcessIterator::~NamedProcessIterator() {
}
+#if defined(RENDERER_CLEAN_EXIT)
+base::subtle::Atomic32 exit_counter;
+
+extern void clean_exit(int return_value)
Markus (顧孟勤) 2012/03/28 23:07:56 This function should be marked as __attribute__((n
+{
+ base::subtle::Atomic32 new_exit_counter;
+ new_exit_counter = base::subtle::
+ Barrier_AtomicIncrement(&exit_counter, (base::subtle::Atomic32)1);
+ if (new_exit_counter == 1)
+ {
+ fprintf(stderr, "Renderer process exiting.\n");
Markus (顧孟勤) 2012/03/28 23:07:56 If you plan on calling clean_exit() from a signal
+ exit(return_value);
+ }
+ else
+ {
+ fprintf(stderr, "Another renderer thread already called exit!.\n");
+ 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
+ }
+}
+#endif // defined(RENDERER_CLEAN_EXIT)
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698