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

Side by Side Diff: mojo/public/cpp/bindings/lib/connector.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/connector.h" 5 #include "mojo/public/cpp/bindings/lib/connector.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 bool receiver_result = false; 259 bool receiver_result = false;
260 260
261 // Detect if |this| was destroyed during message dispatch. Allow for the 261 // Detect if |this| was destroyed during message dispatch. Allow for the
262 // possibility of re-entering ReadMore() through message dispatch. 262 // possibility of re-entering ReadMore() through message dispatch.
263 base::WeakPtr<Connector> weak_self = weak_self_; 263 base::WeakPtr<Connector> weak_self = weak_self_;
264 264
265 Message message; 265 Message message;
266 const MojoResult rv = ReadMessage(message_pipe_.get(), &message); 266 const MojoResult rv = ReadMessage(message_pipe_.get(), &message);
267 *read_result = rv; 267 *read_result = rv;
268 268
269 if (rv == MOJO_RESULT_OK) { 269 if (rv == MOJO_RESULT_OK && incoming_receiver_) {
270 receiver_result = 270 receiver_result = incoming_receiver_->Accept(&message);
271 incoming_receiver_ && incoming_receiver_->Accept(&message); 271 if (!receiver_result)
272 message.NotifyBadMessage(interface_name_);
yzshen1 2016/06/11 00:10:59 For multiplex router, we may get here because of m
Ken Rockot(use gerrit already) 2016/06/11 21:48:30 Ah right. It's a bit more complicated than this to
272 } 273 }
273 274
274 if (!weak_self) 275 if (!weak_self)
275 return false; 276 return false;
276 277
277 if (rv == MOJO_RESULT_SHOULD_WAIT) 278 if (rv == MOJO_RESULT_SHOULD_WAIT)
278 return true; 279 return true;
279 280
280 if (rv != MOJO_RESULT_OK) { 281 if (rv != MOJO_RESULT_OK) {
281 HandleError(rv != MOJO_RESULT_FAILED_PRECONDITION, false); 282 HandleError(rv != MOJO_RESULT_FAILED_PRECONDITION, false);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (sync_watcher_) 348 if (sync_watcher_)
348 return; 349 return;
349 sync_watcher_.reset(new SyncHandleWatcher( 350 sync_watcher_.reset(new SyncHandleWatcher(
350 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE, 351 message_pipe_.get(), MOJO_HANDLE_SIGNAL_READABLE,
351 base::Bind(&Connector::OnSyncHandleWatcherHandleReady, 352 base::Bind(&Connector::OnSyncHandleWatcherHandleReady,
352 base::Unretained(this)))); 353 base::Unretained(this))));
353 } 354 }
354 355
355 } // namespace internal 356 } // namespace internal
356 } // namespace mojo 357 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698