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

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

Issue 231483002: Mojo: Log an error on the remote message pipe leak condition.[1] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/system/remote_message_pipe_unittest.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 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 void Channel::Shutdown() { 57 void Channel::Shutdown() {
58 DCHECK(creation_thread_checker_.CalledOnValidThread()); 58 DCHECK(creation_thread_checker_.CalledOnValidThread());
59 59
60 base::AutoLock locker(lock_); 60 base::AutoLock locker(lock_);
61 DCHECK(raw_channel_.get()); 61 DCHECK(raw_channel_.get());
62 raw_channel_->Shutdown(); 62 raw_channel_->Shutdown();
63 raw_channel_.reset(); 63 raw_channel_.reset();
64 64
65 // TODO(vtl): Should I clear |local_id_to_endpoint_info_map_|? Or assert that 65 // This should not occur, but it probably mostly results in leaking;
66 // it's empty? 66 // (Explicitly clearing the |local_id_to_endpoint_info_map_| would likely put
67 // things in an inconsistent state, which is worse. Note that if the map is
68 // nonempty, we probably won't be destroyed, since the endpoints have a
69 // reference to us.)
70 LOG_IF(ERROR, local_id_to_endpoint_info_map_.empty())
71 << "Channel shutting down with endpoints still attached";
72 // TODO(vtl): This currently blows up, but the fix will be nontrivial.
73 // crbug.com/360081
74 //DCHECK(local_id_to_endpoint_info_map_.empty());
67 } 75 }
68 76
69 MessageInTransit::EndpointId Channel::AttachMessagePipeEndpoint( 77 MessageInTransit::EndpointId Channel::AttachMessagePipeEndpoint(
70 scoped_refptr<MessagePipe> message_pipe, unsigned port) { 78 scoped_refptr<MessagePipe> message_pipe, unsigned port) {
71 DCHECK(port == 0 || port == 1); 79 DCHECK(port == 0 || port == 1);
72 // Note: This assertion must *not* be done under |lock_|. 80 // Note: This assertion must *not* be done under |lock_|.
73 DCHECK_EQ(message_pipe->GetType(port), MessagePipeEndpoint::kTypeProxy); 81 DCHECK_EQ(message_pipe->GetType(port), MessagePipeEndpoint::kTypeProxy);
74 82
75 MessageInTransit::EndpointId local_id; 83 MessageInTransit::EndpointId local_id;
76 { 84 {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 LOG(WARNING) << error_message; 291 LOG(WARNING) << error_message;
284 } 292 }
285 293
286 void Channel::HandleLocalError(const base::StringPiece& error_message) { 294 void Channel::HandleLocalError(const base::StringPiece& error_message) {
287 // TODO(vtl): Is this how we really want to handle this? 295 // TODO(vtl): Is this how we really want to handle this?
288 LOG(WARNING) << error_message; 296 LOG(WARNING) << error_message;
289 } 297 }
290 298
291 } // namespace system 299 } // namespace system
292 } // namespace mojo 300 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/remote_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698