OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/router.h" | 5 #include "mojo/public/cpp/bindings/lib/router.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "mojo/public/cpp/environment/logging.h" | 10 #include "mojo/public/cpp/environment/logging.h" |
10 | 11 |
11 namespace mojo { | 12 namespace mojo { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // ---------------------------------------------------------------------------- | 15 // ---------------------------------------------------------------------------- |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool Router::HandleIncomingMessageThunk::Accept(Message* message) { | 73 bool Router::HandleIncomingMessageThunk::Accept(Message* message) { |
73 return router_->HandleIncomingMessage(message); | 74 return router_->HandleIncomingMessage(message); |
74 } | 75 } |
75 | 76 |
76 // ---------------------------------------------------------------------------- | 77 // ---------------------------------------------------------------------------- |
77 | 78 |
78 Router::Router(ScopedMessagePipeHandle message_pipe, | 79 Router::Router(ScopedMessagePipeHandle message_pipe, |
79 FilterChain filters, | 80 FilterChain filters, |
80 const MojoAsyncWaiter* waiter) | 81 const MojoAsyncWaiter* waiter) |
81 : thunk_(this), | 82 : thunk_(this), |
82 filters_(filters.Pass()), | 83 filters_(std::move(filters)), |
83 connector_(message_pipe.Pass(), Connector::SINGLE_THREADED_SEND, waiter), | 84 connector_(std::move(message_pipe), |
| 85 Connector::SINGLE_THREADED_SEND, |
| 86 waiter), |
84 weak_self_(this), | 87 weak_self_(this), |
85 incoming_receiver_(nullptr), | 88 incoming_receiver_(nullptr), |
86 next_request_id_(0), | 89 next_request_id_(0), |
87 testing_mode_(false) { | 90 testing_mode_(false) { |
88 filters_.SetSink(&thunk_); | 91 filters_.SetSink(&thunk_); |
89 connector_.set_incoming_receiver(filters_.GetHead()); | 92 connector_.set_incoming_receiver(filters_.GetHead()); |
90 } | 93 } |
91 | 94 |
92 Router::~Router() { | 95 Router::~Router() { |
93 weak_self_.set_value(nullptr); | 96 weak_self_.set_value(nullptr); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return false; | 158 return false; |
156 | 159 |
157 return incoming_receiver_->Accept(message); | 160 return incoming_receiver_->Accept(message); |
158 } | 161 } |
159 } | 162 } |
160 | 163 |
161 // ---------------------------------------------------------------------------- | 164 // ---------------------------------------------------------------------------- |
162 | 165 |
163 } // namespace internal | 166 } // namespace internal |
164 } // namespace mojo | 167 } // namespace mojo |
OLD | NEW |