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