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

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

Issue 621153003: Move mojo edk into mojo/edk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix checkdeps Created 6 years, 2 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/system/simple_dispatcher.h ('k') | mojo/system/simple_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/system/simple_dispatcher.h"
6
7 #include "base/logging.h"
8
9 namespace mojo {
10 namespace system {
11
12 SimpleDispatcher::SimpleDispatcher() {
13 }
14
15 SimpleDispatcher::~SimpleDispatcher() {
16 }
17
18 void SimpleDispatcher::HandleSignalsStateChangedNoLock() {
19 lock().AssertAcquired();
20 waiter_list_.AwakeWaitersForStateChange(GetHandleSignalsStateImplNoLock());
21 }
22
23 void SimpleDispatcher::CancelAllWaitersNoLock() {
24 lock().AssertAcquired();
25 waiter_list_.CancelAllWaiters();
26 }
27
28 MojoResult SimpleDispatcher::AddWaiterImplNoLock(
29 Waiter* waiter,
30 MojoHandleSignals signals,
31 uint32_t context,
32 HandleSignalsState* signals_state) {
33 lock().AssertAcquired();
34
35 HandleSignalsState state(GetHandleSignalsStateImplNoLock());
36 if (state.satisfies(signals)) {
37 if (signals_state)
38 *signals_state = state;
39 return MOJO_RESULT_ALREADY_EXISTS;
40 }
41 if (!state.can_satisfy(signals)) {
42 if (signals_state)
43 *signals_state = state;
44 return MOJO_RESULT_FAILED_PRECONDITION;
45 }
46
47 waiter_list_.AddWaiter(waiter, signals, context);
48 return MOJO_RESULT_OK;
49 }
50
51 void SimpleDispatcher::RemoveWaiterImplNoLock(
52 Waiter* waiter,
53 HandleSignalsState* signals_state) {
54 lock().AssertAcquired();
55 waiter_list_.RemoveWaiter(waiter);
56 if (signals_state)
57 *signals_state = GetHandleSignalsStateImplNoLock();
58 }
59
60 } // namespace system
61 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/simple_dispatcher.h ('k') | mojo/system/simple_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698