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 "mojo/public/cpp/environment/logging.h" | 7 #include "mojo/public/cpp/environment/logging.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 namespace internal { | 10 namespace internal { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // ---------------------------------------------------------------------------- | 52 // ---------------------------------------------------------------------------- |
53 | 53 |
54 Router::Router(ScopedMessagePipeHandle message_pipe, | 54 Router::Router(ScopedMessagePipeHandle message_pipe, |
55 FilterChain filters, | 55 FilterChain filters, |
56 const MojoAsyncWaiter* waiter) | 56 const MojoAsyncWaiter* waiter) |
57 : thunk_(this), | 57 : thunk_(this), |
58 filters_(filters.Pass()), | 58 filters_(filters.Pass()), |
59 connector_(message_pipe.Pass(), waiter), | 59 connector_(message_pipe.Pass(), waiter), |
60 weak_self_(this), | 60 weak_self_(this), |
61 incoming_receiver_(NULL), | 61 incoming_receiver_(nullptr), |
62 next_request_id_(0), | 62 next_request_id_(0), |
63 testing_mode_(false) { | 63 testing_mode_(false) { |
64 filters_.SetSink(&thunk_); | 64 filters_.SetSink(&thunk_); |
65 connector_.set_incoming_receiver(filters_.GetHead()); | 65 connector_.set_incoming_receiver(filters_.GetHead()); |
66 } | 66 } |
67 | 67 |
68 Router::~Router() { | 68 Router::~Router() { |
69 weak_self_.set_value(NULL); | 69 weak_self_.set_value(nullptr); |
70 | 70 |
71 for (ResponderMap::const_iterator i = responders_.begin(); | 71 for (ResponderMap::const_iterator i = responders_.begin(); |
72 i != responders_.end(); ++i) { | 72 i != responders_.end(); ++i) { |
73 delete i->second; | 73 delete i->second; |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 bool Router::Accept(Message* message) { | 77 bool Router::Accept(Message* message) { |
78 MOJO_DCHECK(!message->has_flag(kMessageExpectsResponse)); | 78 MOJO_DCHECK(!message->has_flag(kMessageExpectsResponse)); |
79 return connector_.Accept(message); | 79 return connector_.Accept(message); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // OK to drop message on the floor. | 133 // OK to drop message on the floor. |
134 } | 134 } |
135 | 135 |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 // ---------------------------------------------------------------------------- | 139 // ---------------------------------------------------------------------------- |
140 | 140 |
141 } // namespace internal | 141 } // namespace internal |
142 } // namespace mojo | 142 } // namespace mojo |
OLD | NEW |