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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/common/bindings_support_impl.cc
diff --git a/mojo/common/bindings_support_impl.cc b/mojo/common/bindings_support_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff040db550dd7374344e1d512d83ae0ba7ba8b7a
--- /dev/null
+++ b/mojo/common/bindings_support_impl.cc
@@ -0,0 +1,49 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/common/bindings_support_impl.h"
+
+#include "base/bind.h"
+#include "mojo/common/handle_watcher.h"
+
+namespace mojo {
+namespace common {
+namespace {
+
+void CallOnHandleReady(HandleWatcher* watcher,
+ BindingsSupport::AsyncWaitCallback* callback,
+ MojoResult result) {
+ delete watcher;
+ callback->OnHandleReady(result);
+}
+
+} // namespace
+
+BindingsSupportImpl::BindingsSupportImpl() {
+}
+
+BindingsSupportImpl::~BindingsSupportImpl() {
+}
sky 2013/11/08 16:44:02 Is there a expectation that deleting BindingsSuppo
+
+BindingsSupport::AsyncWaitID BindingsSupportImpl::AsyncWait(
+ Handle handle,
+ MojoWaitFlags flags,
+ AsyncWaitCallback* callback) {
+ HandleWatcher* watcher = new HandleWatcher();
+
+ // TODO(darin): Standardize on mojo::Handle instead of MojoHandle?
+ watcher->Start(handle.value,
+ flags,
+ MOJO_DEADLINE_INDEFINITE,
+ base::Bind(&CallOnHandleReady, watcher, callback));
+ return watcher;
+}
+
+void BindingsSupportImpl::CancelWait(AsyncWaitID async_wait_id) {
+ 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
+ delete watcher;
+}
+
+} // namespace common
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698