| OLD | NEW |
| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 HandleSignalsState Dispatcher::GetHandleSignalsState() const { | 300 HandleSignalsState Dispatcher::GetHandleSignalsState() const { |
| 301 MutexLocker locker(&mutex_); | 301 MutexLocker locker(&mutex_); |
| 302 if (is_closed_) | 302 if (is_closed_) |
| 303 return HandleSignalsState(); | 303 return HandleSignalsState(); |
| 304 | 304 |
| 305 return GetHandleSignalsStateImplNoLock(); | 305 return GetHandleSignalsStateImplNoLock(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 MojoResult Dispatcher::AddAwakable(Awakable* awakable, | 308 MojoResult Dispatcher::AddAwakable(Awakable* awakable, |
| 309 uint64_t context, | 309 uint64_t context, |
| 310 bool force, | 310 bool persistent, |
| 311 MojoHandleSignals signals, | 311 MojoHandleSignals signals, |
| 312 HandleSignalsState* signals_state) { | 312 HandleSignalsState* signals_state) { |
| 313 MutexLocker locker(&mutex_); | 313 MutexLocker locker(&mutex_); |
| 314 if (is_closed_) { | 314 if (is_closed_) { |
| 315 if (signals_state) | 315 if (signals_state) |
| 316 *signals_state = HandleSignalsState(); | 316 *signals_state = HandleSignalsState(); |
| 317 return MOJO_RESULT_INVALID_ARGUMENT; | 317 return MOJO_RESULT_INVALID_ARGUMENT; |
| 318 } | 318 } |
| 319 | 319 |
| 320 return AddAwakableImplNoLock(awakable, context, force, signals, | 320 return AddAwakableImplNoLock(awakable, context, persistent, signals, |
| 321 signals_state); | 321 signals_state); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void Dispatcher::RemoveAwakable(bool match_context, | 324 void Dispatcher::RemoveAwakable(bool match_context, |
| 325 Awakable* awakable, | 325 Awakable* awakable, |
| 326 uint64_t context, | 326 uint64_t context, |
| 327 HandleSignalsState* signals_state) { | 327 HandleSignalsState* signals_state) { |
| 328 MutexLocker locker(&mutex_); | 328 MutexLocker locker(&mutex_); |
| 329 if (is_closed_) { | 329 if (is_closed_) { |
| 330 if (signals_state) | 330 if (signals_state) |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 mutex_.AssertHeld(); | 537 mutex_.AssertHeld(); |
| 538 DCHECK(!is_closed_); | 538 DCHECK(!is_closed_); |
| 539 // By default, waiting isn't supported. Only dispatchers that can be waited on | 539 // By default, waiting isn't supported. Only dispatchers that can be waited on |
| 540 // will do something nontrivial. | 540 // will do something nontrivial. |
| 541 return HandleSignalsState(); | 541 return HandleSignalsState(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 MojoResult Dispatcher::AddAwakableImplNoLock( | 544 MojoResult Dispatcher::AddAwakableImplNoLock( |
| 545 Awakable* /*awakable*/, | 545 Awakable* /*awakable*/, |
| 546 uint64_t /*context*/, | 546 uint64_t /*context*/, |
| 547 bool /*force*/, | 547 bool /*persistent*/, |
| 548 MojoHandleSignals /*signals*/, | 548 MojoHandleSignals /*signals*/, |
| 549 HandleSignalsState* signals_state) { | 549 HandleSignalsState* signals_state) { |
| 550 mutex_.AssertHeld(); | 550 mutex_.AssertHeld(); |
| 551 DCHECK(!is_closed_); | 551 DCHECK(!is_closed_); |
| 552 // By default, waiting isn't supported. Only dispatchers that can be waited on | 552 // By default, waiting isn't supported. Only dispatchers that can be waited on |
| 553 // will do something nontrivial. | 553 // will do something nontrivial. |
| 554 if (signals_state) | 554 if (signals_state) |
| 555 *signals_state = HandleSignalsState(); | 555 *signals_state = HandleSignalsState(); |
| 556 return MOJO_RESULT_FAILED_PRECONDITION; | 556 return MOJO_RESULT_FAILED_PRECONDITION; |
| 557 } | 557 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |