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

Side by Side Diff: ipc/ipc_mojo_bootstrap.cc

Issue 2656573004: ChannelAssociatedGroupController: expect that endpoints may not be in closed state during destructi… (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ipc/ipc_mojo_bootstrap.h" 5 #include "ipc/ipc_mojo_bootstrap.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 }; 477 };
478 478
479 ~ChannelAssociatedGroupController() override { 479 ~ChannelAssociatedGroupController() override {
480 DCHECK(!connector_); 480 DCHECK(!connector_);
481 481
482 base::AutoLock locker(lock_); 482 base::AutoLock locker(lock_);
483 for (auto iter = endpoints_.begin(); iter != endpoints_.end();) { 483 for (auto iter = endpoints_.begin(); iter != endpoints_.end();) {
484 Endpoint* endpoint = iter->second.get(); 484 Endpoint* endpoint = iter->second.get();
485 ++iter; 485 ++iter;
486 486
487 DCHECK(endpoint->closed()); 487 if (!endpoint->closed()) {
488 MarkPeerClosedAndMaybeRemove(endpoint); 488 // This happens when a NotifyPeerEndpointClosed message been received,
489 // but (1) the interface ID hasn't been used to create local endpoint
490 // handle; and (2) a NotifyEndpointClosedBeforeSent hasn't been
491 // received.
492 DCHECK(!endpoint->client());
493 DCHECK(endpoint->peer_closed());
494 MarkClosedAndMaybeRemove(endpoint);
495 } else {
496 MarkPeerClosedAndMaybeRemove(endpoint);
497 }
489 } 498 }
490 499
491 DCHECK(endpoints_.empty()); 500 DCHECK(endpoints_.empty());
492 } 501 }
493 502
494 bool SendMessage(mojo::Message* message) { 503 bool SendMessage(mojo::Message* message) {
495 if (task_runner_->BelongsToCurrentThread()) { 504 if (task_runner_->BelongsToCurrentThread()) {
496 DCHECK(thread_checker_.CalledOnValidThread()); 505 DCHECK(thread_checker_.CalledOnValidThread());
497 if (!connector_ || paused_) { 506 if (!connector_ || paused_) {
498 outgoing_messages_.emplace_back(std::move(*message)); 507 outgoing_messages_.emplace_back(std::move(*message));
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 Channel::Mode mode, 877 Channel::Mode mode,
869 Delegate* delegate, 878 Delegate* delegate,
870 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { 879 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
871 return base::MakeUnique<MojoBootstrapImpl>( 880 return base::MakeUnique<MojoBootstrapImpl>(
872 std::move(handle), delegate, 881 std::move(handle), delegate,
873 new ChannelAssociatedGroupController(mode == Channel::MODE_SERVER, 882 new ChannelAssociatedGroupController(mode == Channel::MODE_SERVER,
874 ipc_task_runner)); 883 ipc_task_runner));
875 } 884 }
876 885
877 } // namespace IPC 886 } // namespace IPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698