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

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

Issue 1856113002: EDK: Add implementation of data pipe consumer read threshold stuff. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/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/edk/system/dispatcher.h" 5 #include "mojo/edk/system/dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/edk/system/configuration.h" 8 #include "mojo/edk/system/configuration.h"
9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) { 163 MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) {
164 MutexLocker locker(&mutex_); 164 MutexLocker locker(&mutex_);
165 if (is_closed_) 165 if (is_closed_)
166 return MOJO_RESULT_INVALID_ARGUMENT; 166 return MOJO_RESULT_INVALID_ARGUMENT;
167 167
168 return EndWriteDataImplNoLock(num_bytes_written); 168 return EndWriteDataImplNoLock(num_bytes_written);
169 } 169 }
170 170
171 MojoResult Dispatcher::SetDataPipeConsumerOptions(
172 UserPointer<const MojoDataPipeConsumerOptions> options) {
173 MutexLocker locker(&mutex_);
174 if (is_closed_)
175 return MOJO_RESULT_INVALID_ARGUMENT;
176
177 return SetDataPipeConsumerOptionsImplNoLock(options);
178 }
179
180 MojoResult Dispatcher::GetDataPipeConsumerOptions(
181 UserPointer<MojoDataPipeConsumerOptions> options,
182 uint32_t options_num_bytes) {
183 MutexLocker locker(&mutex_);
184 if (is_closed_)
185 return MOJO_RESULT_INVALID_ARGUMENT;
186
187 return GetDataPipeConsumerOptionsImplNoLock(options, options_num_bytes);
188 }
189
171 MojoResult Dispatcher::ReadData(UserPointer<void> elements, 190 MojoResult Dispatcher::ReadData(UserPointer<void> elements,
172 UserPointer<uint32_t> num_bytes, 191 UserPointer<uint32_t> num_bytes,
173 MojoReadDataFlags flags) { 192 MojoReadDataFlags flags) {
174 MutexLocker locker(&mutex_); 193 MutexLocker locker(&mutex_);
175 if (is_closed_) 194 if (is_closed_)
176 return MOJO_RESULT_INVALID_ARGUMENT; 195 return MOJO_RESULT_INVALID_ARGUMENT;
177 196
178 return ReadDataImplNoLock(elements, num_bytes, flags); 197 return ReadDataImplNoLock(elements, num_bytes, flags);
179 } 198 }
180 199
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 354
336 MojoResult Dispatcher::ReadDataImplNoLock(UserPointer<void> /*elements*/, 355 MojoResult Dispatcher::ReadDataImplNoLock(UserPointer<void> /*elements*/,
337 UserPointer<uint32_t> /*num_bytes*/, 356 UserPointer<uint32_t> /*num_bytes*/,
338 MojoReadDataFlags /*flags*/) { 357 MojoReadDataFlags /*flags*/) {
339 mutex_.AssertHeld(); 358 mutex_.AssertHeld();
340 DCHECK(!is_closed_); 359 DCHECK(!is_closed_);
341 // By default, not supported. Only needed for data pipe dispatchers. 360 // By default, not supported. Only needed for data pipe dispatchers.
342 return MOJO_RESULT_INVALID_ARGUMENT; 361 return MOJO_RESULT_INVALID_ARGUMENT;
343 } 362 }
344 363
364 MojoResult Dispatcher::SetDataPipeConsumerOptionsImplNoLock(
365 UserPointer<const MojoDataPipeConsumerOptions> /*options*/) {
366 mutex_.AssertHeld();
367 DCHECK(!is_closed_);
368 return MOJO_RESULT_INVALID_ARGUMENT;
369 }
370
371 MojoResult Dispatcher::GetDataPipeConsumerOptionsImplNoLock(
372 UserPointer<MojoDataPipeConsumerOptions> /*options*/,
373 uint32_t /*options_num_bytes*/) {
374 mutex_.AssertHeld();
375 DCHECK(!is_closed_);
376 return MOJO_RESULT_INVALID_ARGUMENT;
377 }
378
345 MojoResult Dispatcher::BeginReadDataImplNoLock( 379 MojoResult Dispatcher::BeginReadDataImplNoLock(
346 UserPointer<const void*> /*buffer*/, 380 UserPointer<const void*> /*buffer*/,
347 UserPointer<uint32_t> /*buffer_num_bytes*/, 381 UserPointer<uint32_t> /*buffer_num_bytes*/,
348 MojoReadDataFlags /*flags*/) { 382 MojoReadDataFlags /*flags*/) {
349 mutex_.AssertHeld(); 383 mutex_.AssertHeld();
350 DCHECK(!is_closed_); 384 DCHECK(!is_closed_);
351 // By default, not supported. Only needed for data pipe dispatchers. 385 // By default, not supported. Only needed for data pipe dispatchers.
352 return MOJO_RESULT_INVALID_ARGUMENT; 386 return MOJO_RESULT_INVALID_ARGUMENT;
353 } 387 }
354 388
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // DispatcherTransport --------------------------------------------------------- 541 // DispatcherTransport ---------------------------------------------------------
508 542
509 void DispatcherTransport::End() { 543 void DispatcherTransport::End() {
510 DCHECK(dispatcher_); 544 DCHECK(dispatcher_);
511 dispatcher_->mutex_.Unlock(); 545 dispatcher_->mutex_.Unlock();
512 dispatcher_ = nullptr; 546 dispatcher_ = nullptr;
513 } 547 }
514 548
515 } // namespace system 549 } // namespace system
516 } // namespace mojo 550 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698