| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/public/cpp/bindings/lib/sync_handle_watcher.h" | 5 #include "mojo/public/cpp/bindings/sync_handle_watcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace mojo { | 9 namespace mojo { |
| 10 namespace internal { | |
| 11 | 10 |
| 12 SyncHandleWatcher::SyncHandleWatcher( | 11 SyncHandleWatcher::SyncHandleWatcher( |
| 13 const Handle& handle, | 12 const Handle& handle, |
| 14 MojoHandleSignals handle_signals, | 13 MojoHandleSignals handle_signals, |
| 15 const SyncHandleRegistry::HandleCallback& callback) | 14 const SyncHandleRegistry::HandleCallback& callback) |
| 16 : handle_(handle), | 15 : handle_(handle), |
| 17 handle_signals_(handle_signals), | 16 handle_signals_(handle_signals), |
| 18 callback_(callback), | 17 callback_(callback), |
| 19 registered_(false), | 18 registered_(false), |
| 20 register_request_count_(0), | 19 register_request_count_(0), |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void SyncHandleWatcher::DecrementRegisterCount() { | 66 void SyncHandleWatcher::DecrementRegisterCount() { |
| 68 DCHECK_GT(register_request_count_, 0u); | 67 DCHECK_GT(register_request_count_, 0u); |
| 69 | 68 |
| 70 register_request_count_--; | 69 register_request_count_--; |
| 71 if (register_request_count_ == 0 && registered_) { | 70 if (register_request_count_ == 0 && registered_) { |
| 72 registry_->UnregisterHandle(handle_); | 71 registry_->UnregisterHandle(handle_); |
| 73 registered_ = false; | 72 registered_ = false; |
| 74 } | 73 } |
| 75 } | 74 } |
| 76 | 75 |
| 77 } // namespace internal | |
| 78 } // namespace mojo | 76 } // namespace mojo |
| OLD | NEW |