| 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 { |
| 11 namespace win { | 11 namespace win { |
| 12 | 12 |
| 13 //----------------------------------------------------------------------------- | 13 //----------------------------------------------------------------------------- |
| 14 | 14 |
| 15 ObjectWatcher::ObjectWatcher() | 15 ObjectWatcher::ObjectWatcher() |
| 16 : weak_factory_(this), | 16 : object_(NULL), |
| 17 object_(NULL), | |
| 18 wait_object_(NULL), | 17 wait_object_(NULL), |
| 19 origin_loop_(NULL) { | 18 origin_loop_(NULL), |
| 19 weak_factory_(this) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 ObjectWatcher::~ObjectWatcher() { | 22 ObjectWatcher::~ObjectWatcher() { |
| 23 StopWatching(); | 23 StopWatching(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool ObjectWatcher::StartWatching(HANDLE object, Delegate* delegate) { | 26 bool ObjectWatcher::StartWatching(HANDLE object, Delegate* delegate) { |
| 27 CHECK(delegate); | 27 CHECK(delegate); |
| 28 if (wait_object_) { | 28 if (wait_object_) { |
| 29 NOTREACHED() << "Already watching an object"; | 29 NOTREACHED() << "Already watching an object"; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 void ObjectWatcher::WillDestroyCurrentMessageLoop() { | 104 void ObjectWatcher::WillDestroyCurrentMessageLoop() { |
| 105 // Need to shutdown the watch so that we don't try to access the MessageLoop | 105 // Need to shutdown the watch so that we don't try to access the MessageLoop |
| 106 // after this point. | 106 // after this point. |
| 107 StopWatching(); | 107 StopWatching(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace win | 110 } // namespace win |
| 111 } // namespace base | 111 } // namespace base |
| OLD | NEW |