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

Side by Side Diff: mojo/system/channel.cc

Issue 612183002: Mojo: Remove MessagePipe::OnRemove(); instead just use MessagePipe::Close(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 2 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 | mojo/system/message_pipe.h » ('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 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/system/channel.h" 5 #include "mojo/system/channel.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // We need to deal with it outside the lock. 67 // We need to deal with it outside the lock.
68 std::swap(to_destroy, local_id_to_endpoint_map_); 68 std::swap(to_destroy, local_id_to_endpoint_map_);
69 } 69 }
70 70
71 size_t num_live = 0; 71 size_t num_live = 0;
72 size_t num_zombies = 0; 72 size_t num_zombies = 0;
73 for (IdToEndpointMap::iterator it = to_destroy.begin(); 73 for (IdToEndpointMap::iterator it = to_destroy.begin();
74 it != to_destroy.end(); 74 it != to_destroy.end();
75 ++it) { 75 ++it) {
76 if (it->second->state_ == ChannelEndpoint::STATE_NORMAL) { 76 if (it->second->state_ == ChannelEndpoint::STATE_NORMAL) {
77 it->second->message_pipe_->OnRemove(it->second->port_); 77 it->second->message_pipe_->Close(it->second->port_);
78 num_live++; 78 num_live++;
79 } else { 79 } else {
80 DCHECK(!it->second->message_pipe_.get()); 80 DCHECK(!it->second->message_pipe_.get());
81 num_zombies++; 81 num_zombies++;
82 } 82 }
83 it->second->DetachFromChannel(); 83 it->second->DetachFromChannel();
84 } 84 }
85 DVLOG_IF(2, num_live || num_zombies) << "Shut down Channel with " << num_live 85 DVLOG_IF(2, num_live || num_zombies) << "Shut down Channel with " << num_live
86 << " live endpoints and " << num_zombies 86 << " live endpoints and " << num_zombies
87 << " zombies"; 87 << " zombies";
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 MessageInTransit::kSubtypeChannelRemoveMessagePipeEndpointAck, 486 MessageInTransit::kSubtypeChannelRemoveMessagePipeEndpointAck,
487 local_id, 487 local_id,
488 remote_id)) { 488 remote_id)) {
489 HandleLocalError(base::StringPrintf( 489 HandleLocalError(base::StringPrintf(
490 "Failed to send message to remove remote message pipe endpoint ack " 490 "Failed to send message to remove remote message pipe endpoint ack "
491 "(local ID %u, remote ID %u)", 491 "(local ID %u, remote ID %u)",
492 static_cast<unsigned>(local_id), 492 static_cast<unsigned>(local_id),
493 static_cast<unsigned>(remote_id))); 493 static_cast<unsigned>(remote_id)));
494 } 494 }
495 495
496 message_pipe->OnRemove(port); 496 message_pipe->Close(port);
497 497
498 return true; 498 return true;
499 } 499 }
500 500
501 bool Channel::SendControlMessage(MessageInTransit::Subtype subtype, 501 bool Channel::SendControlMessage(MessageInTransit::Subtype subtype,
502 MessageInTransit::EndpointId local_id, 502 MessageInTransit::EndpointId local_id,
503 MessageInTransit::EndpointId remote_id) { 503 MessageInTransit::EndpointId remote_id) {
504 DVLOG(2) << "Sending channel control message: subtype " << subtype 504 DVLOG(2) << "Sending channel control message: subtype " << subtype
505 << ", local ID " << local_id << ", remote ID " << remote_id; 505 << ", local ID " << local_id << ", remote ID " << remote_id;
506 scoped_ptr<MessageInTransit> message(new MessageInTransit( 506 scoped_ptr<MessageInTransit> message(new MessageInTransit(
(...skipping 13 matching lines...) Expand all
520 // TODO(vtl): Is this how we really want to handle this? 520 // TODO(vtl): Is this how we really want to handle this?
521 // Sometimes we'll want to propagate the error back to the message pipe 521 // Sometimes we'll want to propagate the error back to the message pipe
522 // (endpoint), and notify it that the remote is (effectively) closed. 522 // (endpoint), and notify it that the remote is (effectively) closed.
523 // Sometimes we'll want to kill the channel (and notify all the endpoints that 523 // Sometimes we'll want to kill the channel (and notify all the endpoints that
524 // their remotes are dead. 524 // their remotes are dead.
525 LOG(WARNING) << error_message; 525 LOG(WARNING) << error_message;
526 } 526 }
527 527
528 } // namespace system 528 } // namespace system
529 } // namespace mojo 529 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698