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

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

Issue 423583002: Convert WriteData...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 (dispatchers && dispatchers->empty())); 129 (dispatchers && dispatchers->empty()));
130 130
131 base::AutoLock locker(lock_); 131 base::AutoLock locker(lock_);
132 if (is_closed_) 132 if (is_closed_)
133 return MOJO_RESULT_INVALID_ARGUMENT; 133 return MOJO_RESULT_INVALID_ARGUMENT;
134 134
135 return ReadMessageImplNoLock(bytes, num_bytes, dispatchers, num_dispatchers, 135 return ReadMessageImplNoLock(bytes, num_bytes, dispatchers, num_dispatchers,
136 flags); 136 flags);
137 } 137 }
138 138
139 MojoResult Dispatcher::WriteData(const void* elements, 139 MojoResult Dispatcher::WriteData(UserPointer<const void> elements,
140 uint32_t* num_bytes, 140 UserPointer<uint32_t> num_bytes,
141 MojoWriteDataFlags flags) { 141 MojoWriteDataFlags flags) {
142 base::AutoLock locker(lock_); 142 base::AutoLock locker(lock_);
143 if (is_closed_) 143 if (is_closed_)
144 return MOJO_RESULT_INVALID_ARGUMENT; 144 return MOJO_RESULT_INVALID_ARGUMENT;
145 145
146 return WriteDataImplNoLock(elements, num_bytes, flags); 146 return WriteDataImplNoLock(elements, num_bytes, flags);
147 } 147 }
148 148
149 MojoResult Dispatcher::BeginWriteData(UserPointer<void*> buffer, 149 MojoResult Dispatcher::BeginWriteData(UserPointer<void*> buffer,
150 UserPointer<uint32_t> buffer_num_bytes, 150 UserPointer<uint32_t> buffer_num_bytes,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 UserPointer<uint32_t> /*num_bytes*/, 270 UserPointer<uint32_t> /*num_bytes*/,
271 DispatcherVector* /*dispatchers*/, 271 DispatcherVector* /*dispatchers*/,
272 uint32_t* /*num_dispatchers*/, 272 uint32_t* /*num_dispatchers*/,
273 MojoReadMessageFlags /*flags*/) { 273 MojoReadMessageFlags /*flags*/) {
274 lock_.AssertAcquired(); 274 lock_.AssertAcquired();
275 DCHECK(!is_closed_); 275 DCHECK(!is_closed_);
276 // By default, not supported. Only needed for message pipe dispatchers. 276 // By default, not supported. Only needed for message pipe dispatchers.
277 return MOJO_RESULT_INVALID_ARGUMENT; 277 return MOJO_RESULT_INVALID_ARGUMENT;
278 } 278 }
279 279
280 MojoResult Dispatcher::WriteDataImplNoLock(const void* /*elements*/, 280 MojoResult Dispatcher::WriteDataImplNoLock(UserPointer<const void> /*elements*/,
281 uint32_t* /*num_bytes*/, 281 UserPointer<uint32_t> /*num_bytes*/,
282 MojoWriteDataFlags /*flags*/) { 282 MojoWriteDataFlags /*flags*/) {
283 lock_.AssertAcquired(); 283 lock_.AssertAcquired();
284 DCHECK(!is_closed_); 284 DCHECK(!is_closed_);
285 // By default, not supported. Only needed for data pipe dispatchers. 285 // By default, not supported. Only needed for data pipe dispatchers.
286 return MOJO_RESULT_INVALID_ARGUMENT; 286 return MOJO_RESULT_INVALID_ARGUMENT;
287 } 287 }
288 288
289 MojoResult Dispatcher::BeginWriteDataImplNoLock( 289 MojoResult Dispatcher::BeginWriteDataImplNoLock(
290 UserPointer<void*> /*buffer*/, 290 UserPointer<void*> /*buffer*/,
291 UserPointer<uint32_t> /*buffer_num_bytes*/, 291 UserPointer<uint32_t> /*buffer_num_bytes*/,
(...skipping 163 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