Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/common/bindings_support_impl.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "mojo/common/handle_watcher.h" | |
| 9 | |
| 10 namespace mojo { | |
| 11 namespace common { | |
| 12 namespace { | |
| 13 | |
| 14 void CallOnHandleReady(HandleWatcher* watcher, | |
| 15 BindingsSupport::AsyncWaitCallback* callback, | |
| 16 MojoResult result) { | |
| 17 delete watcher; | |
| 18 callback->OnHandleReady(result); | |
| 19 } | |
| 20 | |
| 21 } // namespace | |
| 22 | |
| 23 BindingsSupportImpl::BindingsSupportImpl() { | |
| 24 } | |
| 25 | |
| 26 BindingsSupportImpl::~BindingsSupportImpl() { | |
| 27 } | |
|
sky
2013/11/08 16:44:02
Is there a expectation that deleting BindingsSuppo
| |
| 28 | |
| 29 BindingsSupport::AsyncWaitID BindingsSupportImpl::AsyncWait( | |
| 30 Handle handle, | |
| 31 MojoWaitFlags flags, | |
| 32 AsyncWaitCallback* callback) { | |
| 33 HandleWatcher* watcher = new HandleWatcher(); | |
| 34 | |
| 35 // TODO(darin): Standardize on mojo::Handle instead of MojoHandle? | |
| 36 watcher->Start(handle.value, | |
| 37 flags, | |
| 38 MOJO_DEADLINE_INDEFINITE, | |
| 39 base::Bind(&CallOnHandleReady, watcher, callback)); | |
| 40 return watcher; | |
| 41 } | |
| 42 | |
| 43 void BindingsSupportImpl::CancelWait(AsyncWaitID async_wait_id) { | |
| 44 HandleWatcher* watcher = static_cast<HandleWatcher*>(async_wait_id); | |
|
sky
2013/11/08 16:44:02
I'm surprised you don't need reinterpret_cast here
| |
| 45 delete watcher; | |
| 46 } | |
| 47 | |
| 48 } // namespace common | |
| 49 } // namespace mojo | |
| OLD | NEW |