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

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

Issue 1885663002: EDK: Add implementation of data pipe producer write 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 (dispatchers && dispatchers->empty())); 133 (dispatchers && dispatchers->empty()));
134 134
135 MutexLocker locker(&mutex_); 135 MutexLocker locker(&mutex_);
136 if (is_closed_) 136 if (is_closed_)
137 return MOJO_RESULT_INVALID_ARGUMENT; 137 return MOJO_RESULT_INVALID_ARGUMENT;
138 138
139 return ReadMessageImplNoLock(bytes, num_bytes, dispatchers, num_dispatchers, 139 return ReadMessageImplNoLock(bytes, num_bytes, dispatchers, num_dispatchers,
140 flags); 140 flags);
141 } 141 }
142 142
143 MojoResult Dispatcher::SetDataPipeProducerOptions(
144 UserPointer<const MojoDataPipeProducerOptions> options) {
145 MutexLocker locker(&mutex_);
146 if (is_closed_)
147 return MOJO_RESULT_INVALID_ARGUMENT;
148
149 return SetDataPipeProducerOptionsImplNoLock(options);
150 }
151
152 MojoResult Dispatcher::GetDataPipeProducerOptions(
153 UserPointer<MojoDataPipeProducerOptions> options,
154 uint32_t options_num_bytes) {
155 MutexLocker locker(&mutex_);
156 if (is_closed_)
157 return MOJO_RESULT_INVALID_ARGUMENT;
158
159 return GetDataPipeProducerOptionsImplNoLock(options, options_num_bytes);
160 }
161
143 MojoResult Dispatcher::WriteData(UserPointer<const void> elements, 162 MojoResult Dispatcher::WriteData(UserPointer<const void> elements,
144 UserPointer<uint32_t> num_bytes, 163 UserPointer<uint32_t> num_bytes,
145 MojoWriteDataFlags flags) { 164 MojoWriteDataFlags flags) {
146 MutexLocker locker(&mutex_); 165 MutexLocker locker(&mutex_);
147 if (is_closed_) 166 if (is_closed_)
148 return MOJO_RESULT_INVALID_ARGUMENT; 167 return MOJO_RESULT_INVALID_ARGUMENT;
149 168
150 return WriteDataImplNoLock(elements, num_bytes, flags); 169 return WriteDataImplNoLock(elements, num_bytes, flags);
151 } 170 }
152 171
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 UserPointer<uint32_t> /*num_bytes*/, 338 UserPointer<uint32_t> /*num_bytes*/,
320 DispatcherVector* /*dispatchers*/, 339 DispatcherVector* /*dispatchers*/,
321 uint32_t* /*num_dispatchers*/, 340 uint32_t* /*num_dispatchers*/,
322 MojoReadMessageFlags /*flags*/) { 341 MojoReadMessageFlags /*flags*/) {
323 mutex_.AssertHeld(); 342 mutex_.AssertHeld();
324 DCHECK(!is_closed_); 343 DCHECK(!is_closed_);
325 // By default, not supported. Only needed for message pipe dispatchers. 344 // By default, not supported. Only needed for message pipe dispatchers.
326 return MOJO_RESULT_INVALID_ARGUMENT; 345 return MOJO_RESULT_INVALID_ARGUMENT;
327 } 346 }
328 347
348 MojoResult Dispatcher::SetDataPipeProducerOptionsImplNoLock(
349 UserPointer<const MojoDataPipeProducerOptions> /*options*/) {
350 mutex_.AssertHeld();
351 DCHECK(!is_closed_);
352 return MOJO_RESULT_INVALID_ARGUMENT;
353 }
354
355 MojoResult Dispatcher::GetDataPipeProducerOptionsImplNoLock(
356 UserPointer<MojoDataPipeProducerOptions> /*options*/,
357 uint32_t /*options_num_bytes*/) {
358 mutex_.AssertHeld();
359 DCHECK(!is_closed_);
360 return MOJO_RESULT_INVALID_ARGUMENT;
361 }
362
329 MojoResult Dispatcher::WriteDataImplNoLock(UserPointer<const void> /*elements*/, 363 MojoResult Dispatcher::WriteDataImplNoLock(UserPointer<const void> /*elements*/,
330 UserPointer<uint32_t> /*num_bytes*/, 364 UserPointer<uint32_t> /*num_bytes*/,
331 MojoWriteDataFlags /*flags*/) { 365 MojoWriteDataFlags /*flags*/) {
332 mutex_.AssertHeld(); 366 mutex_.AssertHeld();
333 DCHECK(!is_closed_); 367 DCHECK(!is_closed_);
334 // By default, not supported. Only needed for data pipe dispatchers. 368 // By default, not supported. Only needed for data pipe dispatchers.
335 return MOJO_RESULT_INVALID_ARGUMENT; 369 return MOJO_RESULT_INVALID_ARGUMENT;
336 } 370 }
337 371
338 MojoResult Dispatcher::BeginWriteDataImplNoLock( 372 MojoResult Dispatcher::BeginWriteDataImplNoLock(
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // DispatcherTransport --------------------------------------------------------- 575 // DispatcherTransport ---------------------------------------------------------
542 576
543 void DispatcherTransport::End() { 577 void DispatcherTransport::End() {
544 DCHECK(dispatcher_); 578 DCHECK(dispatcher_);
545 dispatcher_->mutex_.Unlock(); 579 dispatcher_->mutex_.Unlock();
546 dispatcher_ = nullptr; 580 dispatcher_ = nullptr;
547 } 581 }
548 582
549 } // namespace system 583 } // namespace system
550 } // namespace mojo 584 } // 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