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

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

Issue 2043713004: Mojo: Add NotifyBadMessage API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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
OLDNEW
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/interface_endpoint_client.h" 5 #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 sync_responses_.erase(iter); 249 sync_responses_.erase(iter);
250 } 250 }
251 251
252 // Return true means that we take ownership of |responder|. 252 // Return true means that we take ownership of |responder|.
253 return true; 253 return true;
254 } 254 }
255 255
256 bool InterfaceEndpointClient::HandleIncomingMessage(Message* message) { 256 bool InterfaceEndpointClient::HandleIncomingMessage(Message* message) {
257 DCHECK(thread_checker_.CalledOnValidThread()); 257 DCHECK(thread_checker_.CalledOnValidThread());
258 258
259 return payload_validator_->Accept(message); 259 if (!payload_validator_->Accept(message)) {
260 message->NotifyBadMessage(interface_name_);
yzshen1 2016/06/11 00:10:59 If you think it is useful, we can also record the
261 return false;
262 }
263
264 return true;
260 } 265 }
261 266
262 void InterfaceEndpointClient::NotifyError() { 267 void InterfaceEndpointClient::NotifyError() {
263 DCHECK(thread_checker_.CalledOnValidThread()); 268 DCHECK(thread_checker_.CalledOnValidThread());
264 269
265 if (encountered_error_) 270 if (encountered_error_)
266 return; 271 return;
267 encountered_error_ = true; 272 encountered_error_ = true;
268 error_handler_.Run(); 273 error_handler_.Run();
269 } 274 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } else { 308 } else {
304 if (!incoming_receiver_) 309 if (!incoming_receiver_)
305 return false; 310 return false;
306 311
307 return incoming_receiver_->Accept(message); 312 return incoming_receiver_->Accept(message);
308 } 313 }
309 } 314 }
310 315
311 } // namespace internal 316 } // namespace internal
312 } // namespace mojo 317 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698