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/core.h" | 5 #include "mojo/edk/system/core.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 { | 371 { |
372 base::AutoLock lock(handles_lock_); | 372 base::AutoLock lock(handles_lock_); |
373 MojoResult rv = handles_.GetAndRemoveDispatcher(handle, &dispatcher); | 373 MojoResult rv = handles_.GetAndRemoveDispatcher(handle, &dispatcher); |
374 if (rv != MOJO_RESULT_OK) | 374 if (rv != MOJO_RESULT_OK) |
375 return rv; | 375 return rv; |
376 } | 376 } |
377 dispatcher->Close(); | 377 dispatcher->Close(); |
378 return MOJO_RESULT_OK; | 378 return MOJO_RESULT_OK; |
379 } | 379 } |
380 | 380 |
| 381 MojoResult Core::QueryHandleSignalsState( |
| 382 MojoHandle handle, |
| 383 MojoHandleSignalsState* signals_state) { |
| 384 RequestContext request_context; |
| 385 scoped_refptr<Dispatcher> dispatcher = GetDispatcher(handle); |
| 386 if (!dispatcher || !signals_state) |
| 387 return MOJO_RESULT_INVALID_ARGUMENT; |
| 388 *signals_state = dispatcher->GetHandleSignalsState(); |
| 389 return MOJO_RESULT_OK; |
| 390 } |
| 391 |
381 MojoResult Core::Wait(MojoHandle handle, | 392 MojoResult Core::Wait(MojoHandle handle, |
382 MojoHandleSignals signals, | 393 MojoHandleSignals signals, |
383 MojoDeadline deadline, | 394 MojoDeadline deadline, |
384 MojoHandleSignalsState* signals_state) { | 395 MojoHandleSignalsState* signals_state) { |
385 RequestContext request_context; | 396 RequestContext request_context; |
386 uint32_t unused = static_cast<uint32_t>(-1); | 397 uint32_t unused = static_cast<uint32_t>(-1); |
387 HandleSignalsState hss; | 398 HandleSignalsState hss; |
388 MojoResult rv = WaitManyInternal(&handle, &signals, 1, deadline, &unused, | 399 MojoResult rv = WaitManyInternal(&handle, &signals, 1, deadline, &unused, |
389 signals_state ? &hss : nullptr); | 400 signals_state ? &hss : nullptr); |
390 if (rv != MOJO_RESULT_INVALID_ARGUMENT && signals_state) | 401 if (rv != MOJO_RESULT_INVALID_ARGUMENT && signals_state) |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 std::unique_ptr<NodeController> node_controller) { | 1199 std::unique_ptr<NodeController> node_controller) { |
1189 // It's OK to leak this reference. At this point we know the IO loop is still | 1200 // It's OK to leak this reference. At this point we know the IO loop is still |
1190 // running, and we know the NodeController will observe its eventual | 1201 // running, and we know the NodeController will observe its eventual |
1191 // destruction. This tells the NodeController to delete itself when that | 1202 // destruction. This tells the NodeController to delete itself when that |
1192 // happens. | 1203 // happens. |
1193 node_controller.release()->DestroyOnIOThreadShutdown(); | 1204 node_controller.release()->DestroyOnIOThreadShutdown(); |
1194 } | 1205 } |
1195 | 1206 |
1196 } // namespace edk | 1207 } // namespace edk |
1197 } // namespace mojo | 1208 } // namespace mojo |
OLD | NEW |