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

Side by Side Diff: mojo/edk/system/message_pipe_dispatcher.cc

Issue 2052553002: Add Core::ReplaceHandleWithReducedRights(). (Closed) Base URL: https://github.com/domokit/mojo.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
« no previous file with comments | « mojo/edk/system/handle_transport.h ('k') | 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 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/edk/system/message_pipe_dispatcher.h" 5 #include "mojo/edk/system/message_pipe_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/edk/system/configuration.h" 10 #include "mojo/edk/system/configuration.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 port_ = kInvalidPort; 137 port_ = kInvalidPort;
138 } 138 }
139 139
140 RefPtr<Dispatcher> 140 RefPtr<Dispatcher>
141 MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock( 141 MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock(
142 MessagePipe* message_pipe, 142 MessagePipe* message_pipe,
143 unsigned port) { 143 unsigned port) {
144 mutex().AssertHeld(); 144 mutex().AssertHeld();
145 145
146 // "We" are being sent over our peer. 146 // "We" are being sent over our peer.
147 // If |message_pipe| is null, the |if| condition below should be false.
148 DCHECK(message_pipe_.get());
147 if (message_pipe == message_pipe_.get()) { 149 if (message_pipe == message_pipe_.get()) {
148 // A message pipe dispatcher can't be sent over itself (this should be 150 // A message pipe dispatcher can't be sent over itself (this should be
149 // disallowed by |Core|). Note that |port| is the destination port. 151 // disallowed by |Core|). Note that |port| is the destination port.
150 DCHECK_EQ(port, port_); 152 DCHECK_EQ(port, port_);
151 // In this case, |message_pipe_|'s mutex should already be held! 153 // In this case, |message_pipe_|'s mutex should already be held!
152 message_pipe_->CancelAllStateNoLock(port_); 154 message_pipe_->CancelAllStateNoLock(port_);
153 } else { 155 } else {
154 CancelAllStateNoLock(); 156 CancelAllStateNoLock();
155 } 157 }
156 158
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 235
234 bool rv = message_pipe_->EndSerialize(port_, channel, destination, 236 bool rv = message_pipe_->EndSerialize(port_, channel, destination,
235 actual_size, platform_handles); 237 actual_size, platform_handles);
236 message_pipe_ = nullptr; 238 message_pipe_ = nullptr;
237 port_ = kInvalidPort; 239 port_ = kInvalidPort;
238 return rv; 240 return rv;
239 } 241 }
240 242
241 } // namespace system 243 } // namespace system
242 } // namespace mojo 244 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/handle_transport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698