OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/win/object_watcher.h" | 5 #include "base/win/object_watcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 weak_factory_.InvalidateWeakPtrs(); | 72 weak_factory_.InvalidateWeakPtrs(); |
73 object_ = NULL; | 73 object_ = NULL; |
74 wait_object_ = NULL; | 74 wait_object_ = NULL; |
75 | 75 |
76 MessageLoop::current()->RemoveDestructionObserver(this); | 76 MessageLoop::current()->RemoveDestructionObserver(this); |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 HANDLE ObjectWatcher::GetWatchedObject() { | 80 bool ObjectWatcher::IsWatching() const { |
| 81 return object_ != NULL; |
| 82 } |
| 83 |
| 84 HANDLE ObjectWatcher::GetWatchedObject() const { |
81 return object_; | 85 return object_; |
82 } | 86 } |
83 | 87 |
84 // static | 88 // static |
85 void CALLBACK ObjectWatcher::DoneWaiting(void* param, BOOLEAN timed_out) { | 89 void CALLBACK ObjectWatcher::DoneWaiting(void* param, BOOLEAN timed_out) { |
86 DCHECK(!timed_out); | 90 DCHECK(!timed_out); |
87 | 91 |
88 // The destructor blocks on any callbacks that are in flight, so we know that | 92 // The destructor blocks on any callbacks that are in flight, so we know that |
89 // that is always a pointer to a valid ObjectWater. | 93 // that is always a pointer to a valid ObjectWater. |
90 ObjectWatcher* that = static_cast<ObjectWatcher*>(param); | 94 ObjectWatcher* that = static_cast<ObjectWatcher*>(param); |
(...skipping 11 matching lines...) Expand all Loading... |
102 } | 106 } |
103 | 107 |
104 void ObjectWatcher::WillDestroyCurrentMessageLoop() { | 108 void ObjectWatcher::WillDestroyCurrentMessageLoop() { |
105 // Need to shutdown the watch so that we don't try to access the MessageLoop | 109 // Need to shutdown the watch so that we don't try to access the MessageLoop |
106 // after this point. | 110 // after this point. |
107 StopWatching(); | 111 StopWatching(); |
108 } | 112 } |
109 | 113 |
110 } // namespace win | 114 } // namespace win |
111 } // namespace base | 115 } // namespace base |
OLD | NEW |