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

Side by Side Diff: mojo/common/bindings_support_impl.cc

Issue 62773003: Mojo: Add BindingsSupportImpl on top of HandleWatcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows fix. Created 7 years, 1 month 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698