| OLD | NEW |
| 1 // Copyright (c) 2012 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 #ifndef BASE_WIN_OBJECT_WATCHER_H_ | 5 #ifndef BASE_WIN_OBJECT_WATCHER_H_ |
| 6 #define BASE_WIN_OBJECT_WATCHER_H_ | 6 #define BASE_WIN_OBJECT_WATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/debug/stack_trace.h" | |
| 14 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 15 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 16 | 15 |
| 17 namespace base { | 16 namespace base { |
| 18 namespace win { | 17 namespace win { |
| 19 | 18 |
| 20 // A class that provides a means to asynchronously wait for a Windows object to | 19 // A class that provides a means to asynchronously wait for a Windows object to |
| 21 // become signaled. It is an abstraction around RegisterWaitForSingleObject | 20 // become signaled. It is an abstraction around RegisterWaitForSingleObject |
| 22 // that provides a notification callback, OnObjectSignaled, that runs back on | 21 // that provides a notification callback, OnObjectSignaled, that runs back on |
| 23 // the origin thread (i.e., the thread that called StartWatching). | 22 // the origin thread (i.e., the thread that called StartWatching). |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // MessageLoop::DestructionObserver implementation: | 86 // MessageLoop::DestructionObserver implementation: |
| 88 virtual void WillDestroyCurrentMessageLoop(); | 87 virtual void WillDestroyCurrentMessageLoop(); |
| 89 | 88 |
| 90 // Internal state. | 89 // Internal state. |
| 91 WeakPtrFactory<ObjectWatcher> weak_factory_; | 90 WeakPtrFactory<ObjectWatcher> weak_factory_; |
| 92 Closure callback_; | 91 Closure callback_; |
| 93 HANDLE object_; // The object being watched | 92 HANDLE object_; // The object being watched |
| 94 HANDLE wait_object_; // Returned by RegisterWaitForSingleObject | 93 HANDLE wait_object_; // Returned by RegisterWaitForSingleObject |
| 95 MessageLoop* origin_loop_; // Used to get back to the origin thread | 94 MessageLoop* origin_loop_; // Used to get back to the origin thread |
| 96 | 95 |
| 97 // For debugging crbug.com/121086. | |
| 98 base::debug::StackTrace stack_trace_; | |
| 99 | |
| 100 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); | 96 DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); |
| 101 }; | 97 }; |
| 102 | 98 |
| 103 } // namespace win | 99 } // namespace win |
| 104 } // namespace base | 100 } // namespace base |
| 105 | 101 |
| 106 #endif // BASE_OBJECT_WATCHER_H_ | 102 #endif // BASE_OBJECT_WATCHER_H_ |
| OLD | NEW |