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

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

Issue 419973005: Convert WriteMessage...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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/dispatcher.h ('k') | mojo/system/dispatcher_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/dispatcher.h" 5 #include "mojo/system/dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/system/constants.h" 8 #include "mojo/system/constants.h"
9 #include "mojo/system/message_pipe_dispatcher.h" 9 #include "mojo/system/message_pipe_dispatcher.h"
10 #include "mojo/system/platform_handle_dispatcher.h" 10 #include "mojo/system/platform_handle_dispatcher.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 MojoResult Dispatcher::Close() { 99 MojoResult Dispatcher::Close() {
100 base::AutoLock locker(lock_); 100 base::AutoLock locker(lock_);
101 if (is_closed_) 101 if (is_closed_)
102 return MOJO_RESULT_INVALID_ARGUMENT; 102 return MOJO_RESULT_INVALID_ARGUMENT;
103 103
104 CloseNoLock(); 104 CloseNoLock();
105 return MOJO_RESULT_OK; 105 return MOJO_RESULT_OK;
106 } 106 }
107 107
108 MojoResult Dispatcher::WriteMessage( 108 MojoResult Dispatcher::WriteMessage(
109 const void* bytes, 109 UserPointer<const void> bytes,
110 uint32_t num_bytes, 110 uint32_t num_bytes,
111 std::vector<DispatcherTransport>* transports, 111 std::vector<DispatcherTransport>* transports,
112 MojoWriteMessageFlags flags) { 112 MojoWriteMessageFlags flags) {
113 DCHECK(!transports || (transports->size() > 0 && 113 DCHECK(!transports || (transports->size() > 0 &&
114 transports->size() < kMaxMessageNumHandles)); 114 transports->size() < kMaxMessageNumHandles));
115 115
116 base::AutoLock locker(lock_); 116 base::AutoLock locker(lock_);
117 if (is_closed_) 117 if (is_closed_)
118 return MOJO_RESULT_INVALID_ARGUMENT; 118 return MOJO_RESULT_INVALID_ARGUMENT;
119 119
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 249
250 void Dispatcher::CloseImplNoLock() { 250 void Dispatcher::CloseImplNoLock() {
251 lock_.AssertAcquired(); 251 lock_.AssertAcquired();
252 DCHECK(is_closed_); 252 DCHECK(is_closed_);
253 // This may not need to do anything. Dispatchers should override this to do 253 // This may not need to do anything. Dispatchers should override this to do
254 // any actual close-time cleanup necessary. 254 // any actual close-time cleanup necessary.
255 } 255 }
256 256
257 MojoResult Dispatcher::WriteMessageImplNoLock( 257 MojoResult Dispatcher::WriteMessageImplNoLock(
258 const void* /*bytes*/, 258 UserPointer<const void> /*bytes*/,
259 uint32_t /*num_bytes*/, 259 uint32_t /*num_bytes*/,
260 std::vector<DispatcherTransport>* /*transports*/, 260 std::vector<DispatcherTransport>* /*transports*/,
261 MojoWriteMessageFlags /*flags*/) { 261 MojoWriteMessageFlags /*flags*/) {
262 lock_.AssertAcquired(); 262 lock_.AssertAcquired();
263 DCHECK(!is_closed_); 263 DCHECK(!is_closed_);
264 // By default, not supported. Only needed for message pipe dispatchers. 264 // By default, not supported. Only needed for message pipe dispatchers.
265 return MOJO_RESULT_INVALID_ARGUMENT; 265 return MOJO_RESULT_INVALID_ARGUMENT;
266 } 266 }
267 267
268 MojoResult Dispatcher::ReadMessageImplNoLock( 268 MojoResult Dispatcher::ReadMessageImplNoLock(
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // DispatcherTransport --------------------------------------------------------- 455 // DispatcherTransport ---------------------------------------------------------
456 456
457 void DispatcherTransport::End() { 457 void DispatcherTransport::End() {
458 DCHECK(dispatcher_); 458 DCHECK(dispatcher_);
459 dispatcher_->lock_.Release(); 459 dispatcher_->lock_.Release();
460 dispatcher_ = NULL; 460 dispatcher_ = NULL;
461 } 461 }
462 462
463 } // namespace system 463 } // namespace system
464 } // namespace mojo 464 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/dispatcher.h ('k') | mojo/system/dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698