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

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

Issue 2076263003: Plumb the handle signals state to Awakable::Awake(). (Closed) Base URL: https://github.com/domokit/mojo.git@work794_wait_set_4.2
Patch Set: Created 4 years, 6 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/waiter.h ('k') | mojo/edk/system/waiter_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/waiter.h" 5 #include "mojo/edk/system/waiter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/edk/platform/time_ticks.h" 8 #include "mojo/edk/platform/time_ticks.h"
9 9
10 using mojo::platform::GetTimeTicks; 10 using mojo::platform::GetTimeTicks;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 wait_remaining = deadline - elapsed; 84 wait_remaining = deadline - elapsed;
85 } 85 }
86 } 86 }
87 87
88 DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL); 88 DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
89 if (context) 89 if (context)
90 *context = awake_context_; 90 *context = awake_context_;
91 return awake_result_; 91 return awake_result_;
92 } 92 }
93 93
94 bool Waiter::Awake(MojoResult result, uint64_t context) { 94 bool Waiter::Awake(uint64_t context,
95 AwakeReason reason,
96 const HandleSignalsState& signals_state) {
95 MutexLocker locker(&mutex_); 97 MutexLocker locker(&mutex_);
96 98
97 if (awoken_) 99 if (awoken_)
98 return true; 100 return true;
99 101
100 awoken_ = true; 102 awoken_ = true;
101 awake_result_ = result; 103 awake_result_ = MojoResultForAwakeReason(reason);
102 awake_context_ = context; 104 awake_context_ = context;
103 cv_.Signal(); 105 cv_.Signal();
104 // |cv_.Wait()|/|cv_.WaitWithTimeout()| will return after |mutex_| is 106 // |cv_.Wait()|/|cv_.WaitWithTimeout()| will return after |mutex_| is
105 // released. 107 // released.
106 return true; 108 return true;
107 } 109 }
108 110
109 } // namespace system 111 } // namespace system
110 } // namespace mojo 112 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/waiter.h ('k') | mojo/edk/system/waiter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698