From 1c4947ffee0b7f5672737b542eb6adf466fcb223 Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Thu, 15 Jan 2009 22:25:11 +0000 Subject: WaitableEvent is the replacement for Windows events. Previously in the code, a HANDLE from CreateEvent was used for signaling, both within a process and across processes. WaitableEvent is the cross platform replacement for this. To convert: * HANDLE -> base::WaitableEvent* * ScopedHandle -> scoped_ptr * CreateEvent -> new base::WaitableEvent * SetEvent -> base::WaitableEvent::Signal * ResetEvent -> base::WaitableEvent::Reset * ObjectWatcher -> base::WaitableEventWatcher * WaitForMultipleObjects -> static base::WaitableEvent::WaitMany ObjectWatcher remains for Windows specific code. WaitableEventWatcher has an identical interface save, * It uses WaitableEvents, not HANDLEs * It returns void from StartWatching and StopWatcher, rather than errors. System internal errors are fatal to the address space IMPORTANT: There are semantic differences between the different platforms. WaitableEvents on Windows are implemented on top of events. Windows events work across process and this is used mostly for modal dialog support. Windows events can be duplicated with DuplicateHandle. On other platforms, WaitableEvent works only within a single process. In the future we shall have to replace the current uses of cross-process events with IPCs. BEWARE: HANDLE, on Windows, is a void *. Since any pointer type coerces to void *, you can pass a WaitableEvent * where a HANDLE is expected without any build-time errors. Review URL: http://codereview.chromium.org/16554 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8126 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_shutdown.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'chrome/browser/browser_shutdown.cc') diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index e192688..e0417fa 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -9,6 +9,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "base/time.h" +#include "base/waitable_event.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/first_run.h" #include "chrome/browser/jankometer.h" @@ -86,7 +87,7 @@ void Shutdown() { DCHECK(g_browser_process); // Notifies we are going away. - ::SetEvent(g_browser_process->shutdown_event()); + g_browser_process->shutdown_event()->Signal(); PluginService* plugin_service = PluginService::GetInstance(); if (plugin_service) { -- cgit v1.1