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

Unified Diff: chrome/common/child_process.cc

Issue 16554: WaitableEvent (Closed)
Patch Set: Addresssing darin's comments (round 2) Created 11 years, 11 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
« no previous file with comments | « chrome/common/child_process.h ('k') | chrome/common/common.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/child_process.cc
diff --git a/chrome/common/child_process.cc b/chrome/common/child_process.cc
index 979418f346ddef9acabf031bf1dc92a3808ae936..539d8a33903f8e1cc2561bb3df4af20077f47254 100644
--- a/chrome/common/child_process.cc
+++ b/chrome/common/child_process.cc
@@ -10,13 +10,14 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/string_util.h"
+#include "base/waitable_event.h"
#include "chrome/common/chrome_switches.h"
#include "webkit/glue/webkit_glue.h"
ChildProcess* ChildProcess::child_process_;
MessageLoop* ChildProcess::main_thread_loop_;
static base::AtomicRefCount ref_count;
-HANDLE ChildProcess::shutdown_event_;
+base::WaitableEvent* ChildProcess::shutdown_event_;
ChildProcess::ChildProcess() {
@@ -51,7 +52,7 @@ void ChildProcess::OnFinalRelease() {
main_thread_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
-HANDLE ChildProcess::GetShutDownEvent() {
+base::WaitableEvent* ChildProcess::GetShutDownEvent() {
return shutdown_event_;
}
@@ -74,7 +75,7 @@ bool ChildProcess::GlobalInit(const std::wstring &channel_name,
main_thread_loop_ = MessageLoop::current();
// An event that will be signalled when we shutdown.
- shutdown_event_ = CreateEvent(NULL, TRUE, FALSE, NULL);
+ shutdown_event_ = new base::WaitableEvent(true, false);
child_process_ = factory->Create(channel_name);
@@ -92,7 +93,7 @@ void ChildProcess::GlobalCleanup() {
// background threads.
// For example, in the renderer the RenderThread instances will be able to
// notice shutdown before the render process begins waiting for them to exit.
- SetEvent(shutdown_event_);
+ shutdown_event_->Signal();
// Destroy the child process first to force all background threads to
// terminate before we bring down other resources. (We null pointers
@@ -103,7 +104,7 @@ void ChildProcess::GlobalCleanup() {
main_thread_loop_ = NULL;
- CloseHandle(shutdown_event_);
+ delete shutdown_event_;
shutdown_event_ = NULL;
}
« no previous file with comments | « chrome/common/child_process.h ('k') | chrome/common/common.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698