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

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

Issue 411253011: Convert BeginWriteData...() to use the new user pointer handling (see r285350). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 MojoResult Dispatcher::WriteData(const void* elements, 139 MojoResult Dispatcher::WriteData(const void* elements,
140 uint32_t* num_bytes, 140 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(void** buffer, 149 MojoResult Dispatcher::BeginWriteData(UserPointer<void*> buffer,
150 uint32_t* buffer_num_bytes, 150 UserPointer<uint32_t> buffer_num_bytes,
151 MojoWriteDataFlags flags) { 151 MojoWriteDataFlags flags) {
152 base::AutoLock locker(lock_); 152 base::AutoLock locker(lock_);
153 if (is_closed_) 153 if (is_closed_)
154 return MOJO_RESULT_INVALID_ARGUMENT; 154 return MOJO_RESULT_INVALID_ARGUMENT;
155 155
156 return BeginWriteDataImplNoLock(buffer, buffer_num_bytes, flags); 156 return BeginWriteDataImplNoLock(buffer, buffer_num_bytes, flags);
157 } 157 }
158 158
159 MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) { 159 MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) {
160 base::AutoLock locker(lock_); 160 base::AutoLock locker(lock_);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 MojoResult Dispatcher::WriteDataImplNoLock(const void* /*elements*/, 279 MojoResult Dispatcher::WriteDataImplNoLock(const void* /*elements*/,
280 uint32_t* /*num_bytes*/, 280 uint32_t* /*num_bytes*/,
281 MojoWriteDataFlags /*flags*/) { 281 MojoWriteDataFlags /*flags*/) {
282 lock_.AssertAcquired(); 282 lock_.AssertAcquired();
283 DCHECK(!is_closed_); 283 DCHECK(!is_closed_);
284 // By default, not supported. Only needed for data pipe dispatchers. 284 // By default, not supported. Only needed for data pipe dispatchers.
285 return MOJO_RESULT_INVALID_ARGUMENT; 285 return MOJO_RESULT_INVALID_ARGUMENT;
286 } 286 }
287 287
288 MojoResult Dispatcher::BeginWriteDataImplNoLock(void** /*buffer*/, 288 MojoResult Dispatcher::BeginWriteDataImplNoLock(
289 uint32_t* /*buffer_num_bytes*/, 289 UserPointer<void*> /*buffer*/,
290 MojoWriteDataFlags /*flags*/) { 290 UserPointer<uint32_t> /*buffer_num_bytes*/,
291 MojoWriteDataFlags /*flags*/) {
291 lock_.AssertAcquired(); 292 lock_.AssertAcquired();
292 DCHECK(!is_closed_); 293 DCHECK(!is_closed_);
293 // By default, not supported. Only needed for data pipe dispatchers. 294 // By default, not supported. Only needed for data pipe dispatchers.
294 return MOJO_RESULT_INVALID_ARGUMENT; 295 return MOJO_RESULT_INVALID_ARGUMENT;
295 } 296 }
296 297
297 MojoResult Dispatcher::EndWriteDataImplNoLock(uint32_t /*num_bytes_written*/) { 298 MojoResult Dispatcher::EndWriteDataImplNoLock(uint32_t /*num_bytes_written*/) {
298 lock_.AssertAcquired(); 299 lock_.AssertAcquired();
299 DCHECK(!is_closed_); 300 DCHECK(!is_closed_);
300 // By default, not supported. Only needed for data pipe dispatchers. 301 // By default, not supported. Only needed for data pipe dispatchers.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // DispatcherTransport --------------------------------------------------------- 453 // DispatcherTransport ---------------------------------------------------------
453 454
454 void DispatcherTransport::End() { 455 void DispatcherTransport::End() {
455 DCHECK(dispatcher_); 456 DCHECK(dispatcher_);
456 dispatcher_->lock_.Release(); 457 dispatcher_->lock_.Release();
457 dispatcher_ = NULL; 458 dispatcher_ = NULL;
458 } 459 }
459 460
460 } // namespace system 461 } // namespace system
461 } // namespace mojo 462 } // 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