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

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

Issue 2100553002: Add Core methods for wait set. (Closed) Base URL: https://github.com/domokit/mojo.git@work790_wait_set_5.4
Patch Set: Created 4 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
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/wait_set_dispatcher.h » ('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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (is_closed_) 272 if (is_closed_)
273 return MOJO_RESULT_INVALID_ARGUMENT; 273 return MOJO_RESULT_INVALID_ARGUMENT;
274 274
275 return MapBufferImplNoLock(offset, num_bytes, flags, mapping); 275 return MapBufferImplNoLock(offset, num_bytes, flags, mapping);
276 } 276 }
277 277
278 // Note: The following three wait set methods don't lock |mutex_|, and leave 278 // Note: The following three wait set methods don't lock |mutex_|, and leave
279 // everything for |WaitSet...Impl()| to do. (We could just make these methods 279 // everything for |WaitSet...Impl()| to do. (We could just make these methods
280 // virtual, but we prefer to have a separate "impl" methods for consistency.) 280 // virtual, but we prefer to have a separate "impl" methods for consistency.)
281 MojoResult Dispatcher::WaitSetAdd( 281 MojoResult Dispatcher::WaitSetAdd(
282 UserPointer<const MojoWaitSetAddOptions> options,
283 RefPtr<Dispatcher>&& dispatcher, 282 RefPtr<Dispatcher>&& dispatcher,
284 MojoHandleSignals signals, 283 MojoHandleSignals signals,
285 uint64_t cookie) { 284 uint64_t cookie,
286 return WaitSetAddImpl(options, std::move(dispatcher), signals, cookie); 285 UserPointer<const MojoWaitSetAddOptions> options) {
286 return WaitSetAddImpl(std::move(dispatcher), signals, cookie, options);
287 } 287 }
288 288
289 MojoResult Dispatcher::WaitSetRemove(uint64_t cookie) { 289 MojoResult Dispatcher::WaitSetRemove(uint64_t cookie) {
290 return WaitSetRemoveImpl(cookie); 290 return WaitSetRemoveImpl(cookie);
291 } 291 }
292 292
293 MojoResult Dispatcher::WaitSetWait(MojoDeadline deadline, 293 MojoResult Dispatcher::WaitSetWait(MojoDeadline deadline,
294 UserPointer<uint32_t> num_results, 294 UserPointer<uint32_t> num_results,
295 UserPointer<MojoWaitSetResult> results, 295 UserPointer<MojoWaitSetResult> results,
296 UserPointer<uint32_t> max_results) { 296 UserPointer<uint32_t> max_results) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // By default, not supported. Only needed for buffer dispatchers. 504 // By default, not supported. Only needed for buffer dispatchers.
505 return MOJO_RESULT_INVALID_ARGUMENT; 505 return MOJO_RESULT_INVALID_ARGUMENT;
506 } 506 }
507 507
508 // Note that the following three methods are *not* called under |mutex_| and 508 // Note that the following three methods are *not* called under |mutex_| and
509 // |is_closed_| hasn't been checked. However, since we'll return 509 // |is_closed_| hasn't been checked. However, since we'll return
510 // |MOJO_RESULT_INVALID_ARGUMENT| regardless of the value of |is_closed_| (these 510 // |MOJO_RESULT_INVALID_ARGUMENT| regardless of the value of |is_closed_| (these
511 // methods are only needed for wait set dispatchers), we don't need to lock 511 // methods are only needed for wait set dispatchers), we don't need to lock
512 // |mutex_| and check |is_closed_|. 512 // |mutex_| and check |is_closed_|.
513 MojoResult Dispatcher::WaitSetAddImpl( 513 MojoResult Dispatcher::WaitSetAddImpl(
514 UserPointer<const MojoWaitSetAddOptions> /*options*/,
515 RefPtr<Dispatcher>&& /*dispatcher*/, 514 RefPtr<Dispatcher>&& /*dispatcher*/,
516 MojoHandleSignals /*signals*/, 515 MojoHandleSignals /*signals*/,
517 uint64_t /*cookie*/) { 516 uint64_t /*cookie*/,
517 UserPointer<const MojoWaitSetAddOptions> /*options*/) {
518 // See note above. 518 // See note above.
519 return MOJO_RESULT_INVALID_ARGUMENT; 519 return MOJO_RESULT_INVALID_ARGUMENT;
520 } 520 }
521 521
522 MojoResult Dispatcher::WaitSetRemoveImpl(uint64_t /*cookie*/) { 522 MojoResult Dispatcher::WaitSetRemoveImpl(uint64_t /*cookie*/) {
523 // See note above |WaitSetAddImpl()|. 523 // See note above |WaitSetAddImpl()|.
524 return MOJO_RESULT_INVALID_ARGUMENT; 524 return MOJO_RESULT_INVALID_ARGUMENT;
525 } 525 }
526 526
527 MojoResult Dispatcher::WaitSetWaitImpl( 527 MojoResult Dispatcher::WaitSetWaitImpl(
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // want to remove or weaken). 640 // want to remove or weaken).
641 MutexLocker locker(&mutex_); 641 MutexLocker locker(&mutex_);
642 #endif 642 #endif
643 643
644 return EndSerializeAndCloseImplNoLock(channel, destination, actual_size, 644 return EndSerializeAndCloseImplNoLock(channel, destination, actual_size,
645 platform_handles); 645 platform_handles);
646 } 646 }
647 647
648 } // namespace system 648 } // namespace system
649 } // namespace mojo 649 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/dispatcher.h ('k') | mojo/edk/system/wait_set_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698