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

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

Issue 336313007: Mojo: Rename MOJO_WAIT_FLAG_... -> MOJO_HANDLE_SIGNAL_.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/system/core_unittest.cc ('k') | mojo/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/system/data_pipe.h" 5 #include "mojo/system/data_pipe.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 rv = MOJO_RESULT_INVALID_ARGUMENT; 161 rv = MOJO_RESULT_INVALID_ARGUMENT;
162 producer_two_phase_max_num_bytes_written_ = 0; 162 producer_two_phase_max_num_bytes_written_ = 0;
163 } else { 163 } else {
164 rv = ProducerEndWriteDataImplNoLock(num_bytes_written); 164 rv = ProducerEndWriteDataImplNoLock(num_bytes_written);
165 } 165 }
166 // Two-phase write ended even on failure. 166 // Two-phase write ended even on failure.
167 DCHECK(!producer_in_two_phase_write_no_lock()); 167 DCHECK(!producer_in_two_phase_write_no_lock());
168 // If we're now writable, we *became* writable (since we weren't writable 168 // If we're now writable, we *became* writable (since we weren't writable
169 // during the two-phase write), so awake producer waiters. 169 // during the two-phase write), so awake producer waiters.
170 WaitFlagsState new_producer_state = ProducerGetWaitFlagsStateNoLock(); 170 WaitFlagsState new_producer_state = ProducerGetWaitFlagsStateNoLock();
171 if (new_producer_state.satisfies(MOJO_WAIT_FLAG_WRITABLE)) 171 if (new_producer_state.satisfies(MOJO_HANDLE_SIGNAL_WRITABLE))
172 AwakeProducerWaitersForStateChangeNoLock(new_producer_state); 172 AwakeProducerWaitersForStateChangeNoLock(new_producer_state);
173 WaitFlagsState new_consumer_state = ConsumerGetWaitFlagsStateNoLock(); 173 WaitFlagsState new_consumer_state = ConsumerGetWaitFlagsStateNoLock();
174 if (!new_consumer_state.equals(old_consumer_state)) 174 if (!new_consumer_state.equals(old_consumer_state))
175 AwakeConsumerWaitersForStateChangeNoLock(new_consumer_state); 175 AwakeConsumerWaitersForStateChangeNoLock(new_consumer_state);
176 return rv; 176 return rv;
177 } 177 }
178 178
179 MojoResult DataPipe::ProducerAddWaiter(Waiter* waiter, 179 MojoResult DataPipe::ProducerAddWaiter(Waiter* waiter,
180 MojoHandleSignals signals, 180 MojoHandleSignals signals,
181 uint32_t context) { 181 uint32_t context) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 rv = MOJO_RESULT_INVALID_ARGUMENT; 313 rv = MOJO_RESULT_INVALID_ARGUMENT;
314 consumer_two_phase_max_num_bytes_read_ = 0; 314 consumer_two_phase_max_num_bytes_read_ = 0;
315 } else { 315 } else {
316 rv = ConsumerEndReadDataImplNoLock(num_bytes_read); 316 rv = ConsumerEndReadDataImplNoLock(num_bytes_read);
317 } 317 }
318 // Two-phase read ended even on failure. 318 // Two-phase read ended even on failure.
319 DCHECK(!consumer_in_two_phase_read_no_lock()); 319 DCHECK(!consumer_in_two_phase_read_no_lock());
320 // If we're now readable, we *became* readable (since we weren't readable 320 // If we're now readable, we *became* readable (since we weren't readable
321 // during the two-phase read), so awake consumer waiters. 321 // during the two-phase read), so awake consumer waiters.
322 WaitFlagsState new_consumer_state = ConsumerGetWaitFlagsStateNoLock(); 322 WaitFlagsState new_consumer_state = ConsumerGetWaitFlagsStateNoLock();
323 if (new_consumer_state.satisfies(MOJO_WAIT_FLAG_READABLE)) 323 if (new_consumer_state.satisfies(MOJO_HANDLE_SIGNAL_READABLE))
324 AwakeConsumerWaitersForStateChangeNoLock(new_consumer_state); 324 AwakeConsumerWaitersForStateChangeNoLock(new_consumer_state);
325 WaitFlagsState new_producer_state = ProducerGetWaitFlagsStateNoLock(); 325 WaitFlagsState new_producer_state = ProducerGetWaitFlagsStateNoLock();
326 if (!new_producer_state.equals(old_producer_state)) 326 if (!new_producer_state.equals(old_producer_state))
327 AwakeProducerWaitersForStateChangeNoLock(new_producer_state); 327 AwakeProducerWaitersForStateChangeNoLock(new_producer_state);
328 return rv; 328 return rv;
329 } 329 }
330 330
331 MojoResult DataPipe::ConsumerAddWaiter(Waiter* waiter, 331 MojoResult DataPipe::ConsumerAddWaiter(Waiter* waiter,
332 MojoHandleSignals signals, 332 MojoHandleSignals signals,
333 uint32_t context) { 333 uint32_t context) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 void DataPipe::AwakeConsumerWaitersForStateChangeNoLock( 392 void DataPipe::AwakeConsumerWaitersForStateChangeNoLock(
393 const WaitFlagsState& new_consumer_state) { 393 const WaitFlagsState& new_consumer_state) {
394 lock_.AssertAcquired(); 394 lock_.AssertAcquired();
395 if (!has_local_consumer_no_lock()) 395 if (!has_local_consumer_no_lock())
396 return; 396 return;
397 consumer_waiter_list_->AwakeWaitersForStateChange(new_consumer_state); 397 consumer_waiter_list_->AwakeWaitersForStateChange(new_consumer_state);
398 } 398 }
399 399
400 } // namespace system 400 } // namespace system
401 } // namespace mojo 401 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/core_unittest.cc ('k') | mojo/system/dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698