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

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

Issue 2536323002: Mojo C++ bindings: fix [D]CHECKs in MultiplexRouter and SyncHandleRegistry. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/sync_handle_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/multiplex_router.h" 5 #include "mojo/public/cpp/bindings/lib/multiplex_router.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 sync_message_tasks_.clear(); 329 sync_message_tasks_.clear();
330 tasks_.clear(); 330 tasks_.clear();
331 331
332 for (auto iter = endpoints_.begin(); iter != endpoints_.end();) { 332 for (auto iter = endpoints_.begin(); iter != endpoints_.end();) {
333 InterfaceEndpoint* endpoint = iter->second.get(); 333 InterfaceEndpoint* endpoint = iter->second.get();
334 // Increment the iterator before calling UpdateEndpointStateMayRemove() 334 // Increment the iterator before calling UpdateEndpointStateMayRemove()
335 // because it may remove the corresponding value from the map. 335 // because it may remove the corresponding value from the map.
336 ++iter; 336 ++iter;
337 337
338 DCHECK(endpoint->closed()); 338 if (!endpoint->closed()) {
339 UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED); 339 // This happens when a NotifyPeerEndpointClosed message been received, but
340 // (1) the interface ID hasn't been used to create local endpoint handle;
341 // and (2) a NotifyEndpointClosedBeforeSent hasn't been received.
342 DCHECK(!endpoint->client());
343 DCHECK(endpoint->peer_closed());
344 UpdateEndpointStateMayRemove(endpoint, ENDPOINT_CLOSED);
345 } else {
346 UpdateEndpointStateMayRemove(endpoint, PEER_ENDPOINT_CLOSED);
347 }
340 } 348 }
341 349
342 DCHECK(endpoints_.empty()); 350 DCHECK(endpoints_.empty());
343 } 351 }
344 352
345 void MultiplexRouter::SetMasterInterfaceName(const std::string& name) { 353 void MultiplexRouter::SetMasterInterfaceName(const std::string& name) {
346 DCHECK(thread_checker_.CalledOnValidThread()); 354 DCHECK(thread_checker_.CalledOnValidThread());
347 header_validator_->SetDescription(name + " [master] MessageHeaderValidator"); 355 header_validator_->SetDescription(name + " [master] MessageHeaderValidator");
348 control_message_handler_.SetDescription( 356 control_message_handler_.SetDescription(
349 name + " [master] PipeControlMessageHandler"); 357 name + " [master] PipeControlMessageHandler");
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 912
905 void MultiplexRouter::AssertLockAcquired() { 913 void MultiplexRouter::AssertLockAcquired() {
906 #if DCHECK_IS_ON() 914 #if DCHECK_IS_ON()
907 if (lock_) 915 if (lock_)
908 lock_->AssertAcquired(); 916 lock_->AssertAcquired();
909 #endif 917 #endif
910 } 918 }
911 919
912 } // namespace internal 920 } // namespace internal
913 } // namespace mojo 921 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/sync_handle_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698