OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/connector.h" | 5 #include "mojo/public/cpp/bindings/connector.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "mojo/public/cpp/bindings/lib/sync_handle_watcher.h" | 15 #include "mojo/public/cpp/bindings/sync_handle_watcher.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace internal { | |
19 | 18 |
20 namespace { | 19 namespace { |
21 | 20 |
22 // Similar to base::AutoLock, except that it does nothing if |lock| passed into | 21 // Similar to base::AutoLock, except that it does nothing if |lock| passed into |
23 // the constructor is null. | 22 // the constructor is null. |
24 class MayAutoLock { | 23 class MayAutoLock { |
25 public: | 24 public: |
26 explicit MayAutoLock(base::Lock* lock) : lock_(lock) { | 25 explicit MayAutoLock(base::Lock* lock) : lock_(lock) { |
27 if (lock_) | 26 if (lock_) |
28 lock_->Acquire(); | 27 lock_->Acquire(); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 345 |
347 void Connector::EnsureSyncWatcherExists() { | 346 void Connector::EnsureSyncWatcherExists() { |
348 if (sync_watcher_) | 347 if (sync_watcher_) |
349 return; | 348 return; |
350 sync_watcher_.reset(new SyncHandleWatcher( | 349 sync_watcher_.reset(new SyncHandleWatcher( |
351 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, | 350 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, |
352 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, | 351 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, |
353 base::Unretained(this)))); | 352 base::Unretained(this)))); |
354 } | 353 } |
355 | 354 |
356 } // namespace internal | |
357 } // namespace mojo | 355 } // namespace mojo |
OLD | NEW |