Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: mojo/public/cpp/bindings/lib/router.cc

Issue 273233002: Mojo cpp bindings: add support for validating incoming messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 namespace mojo { 7 namespace mojo {
8 namespace internal { 8 namespace internal {
9 9
10 // ---------------------------------------------------------------------------- 10 // ----------------------------------------------------------------------------
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 bool Router::HandleIncomingMessageThunk::AcceptWithResponder( 56 bool Router::HandleIncomingMessageThunk::AcceptWithResponder(
57 Message* message, 57 Message* message,
58 MessageReceiver* responder) { 58 MessageReceiver* responder) {
59 assert(false); // not reached! 59 assert(false); // not reached!
60 return false; 60 return false;
61 } 61 }
62 62
63 // ---------------------------------------------------------------------------- 63 // ----------------------------------------------------------------------------
64 64
65 Router::Router(ScopedMessagePipeHandle message_pipe, MojoAsyncWaiter* waiter) 65 Router::Router(ScopedMessagePipeHandle message_pipe,
66 : connector_(message_pipe.Pass(), waiter), 66 FilterChain validators,
67 MojoAsyncWaiter* waiter)
68 : thunk_(this),
69 validators_(validators.Pass()),
darin (slow to review) 2014/05/14 06:51:51 s/validators/filters/
yzshen1 2014/05/14 08:14:03 Done.
70 connector_(message_pipe.Pass(), waiter),
67 weak_self_(this), 71 weak_self_(this),
68 incoming_receiver_(NULL), 72 incoming_receiver_(NULL),
69 thunk_(this),
70 next_request_id_(0) { 73 next_request_id_(0) {
71 connector_.set_incoming_receiver(&thunk_); 74 validators_.set_sink(&thunk_);
75 connector_.set_incoming_receiver(validators_.GetHead());
darin (slow to review) 2014/05/14 06:51:51 maybe set_sink and GetHead could be combined since
yzshen1 2014/05/14 08:14:03 FilterChain was implemented to work correctly even
72 } 76 }
73 77
74 Router::~Router() { 78 Router::~Router() {
75 weak_self_.set_value(NULL); 79 weak_self_.set_value(NULL);
76 80
77 for (ResponderMap::const_iterator i = responders_.begin(); 81 for (ResponderMap::const_iterator i = responders_.begin();
78 i != responders_.end(); ++i) { 82 i != responders_.end(); ++i) {
79 delete i->second; 83 delete i->second;
80 } 84 }
81 } 85 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // OK to drop message on the floor. 138 // OK to drop message on the floor.
135 } 139 }
136 140
137 return false; 141 return false;
138 } 142 }
139 143
140 // ---------------------------------------------------------------------------- 144 // ----------------------------------------------------------------------------
141 145
142 } // namespace internal 146 } // namespace internal
143 } // namespace mojo 147 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698