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

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

Issue 231353002: Make mojo_system static and mojo_system_impl a component, never use both (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the mac loader path dependencies 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 | « mojo/system/message_pipe.h ('k') | mojo/system/simple_dispatcher.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/message_pipe.h" 5 #include "mojo/system/message_pipe.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/system/channel.h" 8 #include "mojo/system/channel.h"
9 #include "mojo/system/local_message_pipe_endpoint.h" 9 #include "mojo/system/local_message_pipe_endpoint.h"
10 #include "mojo/system/message_in_transit.h" 10 #include "mojo/system/message_in_transit.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 // The destination port need not be open, unlike the source port. 175 // The destination port need not be open, unlike the source port.
176 if (!endpoints_[port].get()) 176 if (!endpoints_[port].get())
177 return MOJO_RESULT_FAILED_PRECONDITION; 177 return MOJO_RESULT_FAILED_PRECONDITION;
178 178
179 if (transports) { 179 if (transports) {
180 DCHECK(!message->dispatchers()); 180 DCHECK(!message->dispatchers());
181 181
182 // You're not allowed to send either handle to a message pipe over the 182 // You're not allowed to send either handle to a message pipe over the
183 // message pipe, so check for this. (The case of trying to write a handle to 183 // message pipe, so check for this. (The case of trying to write a handle to
184 // itself is taken care of by |CoreImpl|. That case kind of makes sense, but 184 // itself is taken care of by |Core|. That case kind of makes sense, but
185 // leads to complications if, e.g., both sides try to do the same thing with 185 // leads to complications if, e.g., both sides try to do the same thing with
186 // their respective handles simultaneously. The other case, of trying to 186 // their respective handles simultaneously. The other case, of trying to
187 // write the peer handle to a handle, doesn't make sense -- since no handle 187 // write the peer handle to a handle, doesn't make sense -- since no handle
188 // will be available to read the message from.) 188 // will be available to read the message from.)
189 for (size_t i = 0; i < transports->size(); i++) { 189 for (size_t i = 0; i < transports->size(); i++) {
190 if (!(*transports)[i].is_valid()) 190 if (!(*transports)[i].is_valid())
191 continue; 191 continue;
192 if ((*transports)[i].GetType() == Dispatcher::kTypeMessagePipe) { 192 if ((*transports)[i].GetType() == Dispatcher::kTypeMessagePipe) {
193 MessagePipeDispatcherTransport mp_transport((*transports)[i]); 193 MessagePipeDispatcherTransport mp_transport((*transports)[i]);
194 if (mp_transport.GetMessagePipe() == this) { 194 if (mp_transport.GetMessagePipe() == this) {
195 // The other case should have been disallowed by |CoreImpl|. (Note: 195 // The other case should have been disallowed by |Core|. (Note: |port|
196 // |port| is the peer port of the handle given to |WriteMessage()|.) 196 // is the peer port of the handle given to |WriteMessage()|.)
197 DCHECK_EQ(mp_transport.GetPort(), port); 197 DCHECK_EQ(mp_transport.GetPort(), port);
198 return MOJO_RESULT_INVALID_ARGUMENT; 198 return MOJO_RESULT_INVALID_ARGUMENT;
199 } 199 }
200 } 200 }
201 } 201 }
202 202
203 // Clone the dispatchers and attach them to the message. (This must be done 203 // Clone the dispatchers and attach them to the message. (This must be done
204 // as a separate loop, since we want to leave the dispatchers alone on 204 // as a separate loop, since we want to leave the dispatchers alone on
205 // failure.) 205 // failure.)
206 scoped_ptr<std::vector<scoped_refptr<Dispatcher> > > 206 scoped_ptr<std::vector<scoped_refptr<Dispatcher> > >
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 276 }
277 } 277 }
278 278
279 LOG(WARNING) << "Unrecognized MessagePipe control message subtype " 279 LOG(WARNING) << "Unrecognized MessagePipe control message subtype "
280 << message->subtype(); 280 << message->subtype();
281 return MOJO_RESULT_UNKNOWN; 281 return MOJO_RESULT_UNKNOWN;
282 } 282 }
283 283
284 } // namespace system 284 } // namespace system
285 } // namespace mojo 285 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe.h ('k') | mojo/system/simple_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698