OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/scoped_interface_endpoint_handle.h" | 5 #include "mojo/public/cpp/bindings/lib/scoped_interface_endpoint_handle.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" | 8 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 ScopedInterfaceEndpointHandle::ScopedInterfaceEndpointHandle() | 13 ScopedInterfaceEndpointHandle::ScopedInterfaceEndpointHandle() |
14 : ScopedInterfaceEndpointHandle(kInvalidInterfaceId, true, nullptr) {} | 14 : ScopedInterfaceEndpointHandle(kInvalidInterfaceId, true, nullptr) {} |
15 | 15 |
16 ScopedInterfaceEndpointHandle::ScopedInterfaceEndpointHandle( | 16 ScopedInterfaceEndpointHandle::ScopedInterfaceEndpointHandle( |
17 InterfaceId id, | 17 InterfaceId id, |
18 bool is_local, | 18 bool is_local, |
19 scoped_refptr<MultiplexRouter> router) | 19 scoped_refptr<MultiplexRouter> router) |
20 : id_(id), is_local_(is_local), router_(router.Pass()) { | 20 : id_(id), is_local_(is_local), router_(std::move(router)) { |
21 DCHECK(!IsValidInterfaceId(id) || router_); | 21 DCHECK(!IsValidInterfaceId(id) || router_); |
22 } | 22 } |
23 | 23 |
24 ScopedInterfaceEndpointHandle::ScopedInterfaceEndpointHandle( | 24 ScopedInterfaceEndpointHandle::ScopedInterfaceEndpointHandle( |
25 ScopedInterfaceEndpointHandle&& other) | 25 ScopedInterfaceEndpointHandle&& other) |
26 : id_(other.id_), is_local_(other.is_local_) { | 26 : id_(other.id_), is_local_(other.is_local_) { |
27 router_.swap(other.router_); | 27 router_.swap(other.router_); |
28 other.id_ = kInvalidInterfaceId; | 28 other.id_ = kInvalidInterfaceId; |
29 } | 29 } |
30 | 30 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 id_ = kInvalidInterfaceId; | 64 id_ = kInvalidInterfaceId; |
65 is_local_ = true; | 65 is_local_ = true; |
66 router_ = nullptr; | 66 router_ = nullptr; |
67 | 67 |
68 return result; | 68 return result; |
69 } | 69 } |
70 | 70 |
71 } // namespace internal | 71 } // namespace internal |
72 } // namespace mojo | 72 } // namespace mojo |
OLD | NEW |