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

Unified Diff: cc/ipc/single_release_callback_struct_traits.cc

Issue 2686833003: CopyOutputResult must have a working release callback when received over mojo (Closed)
Patch Set: c Created 3 years, 10 months 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
« no previous file with comments | « cc/ipc/single_release_callback_struct_traits.h ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/single_release_callback_struct_traits.cc
diff --git a/cc/ipc/single_release_callback_struct_traits.cc b/cc/ipc/single_release_callback_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c47ff4c9da4308ecf8f262e02220a114ac20c14b
--- /dev/null
+++ b/cc/ipc/single_release_callback_struct_traits.cc
@@ -0,0 +1,30 @@
+// Copyright 2016 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 "cc/ipc/single_release_callback_struct_traits.h"
+#include "cc/ipc/texture_mailbox_releaser.mojom.h"
+
+namespace mojo {
+
+// static
+cc::mojom::TextureMailboxReleaserPtr
+StructTraits<cc::mojom::SingleReleaseCallbackDataView,
+ std::unique_ptr<cc::SingleReleaseCallback>>::
+ releaser(const std::unique_ptr<cc::SingleReleaseCallback>& callback) {
+ auto result = callback->ptr_holder_->TakePtr();
danakj 2017/02/08 23:24:17 It seems like we're being tied to the c++ types to
Saman Sami 2017/02/09 16:30:01 In struct traits, when serializing, a mojo pointer
Saman Sami 2017/02/09 16:52:25 However, note that having a method like TakePtr th
+ callback->ptr_holder_.reset();
+ return result;
+}
+
+// static
+bool StructTraits<cc::mojom::SingleReleaseCallbackDataView,
+ std::unique_ptr<cc::SingleReleaseCallback>>::
+ Read(cc::mojom::SingleReleaseCallbackDataView data,
+ std::unique_ptr<cc::SingleReleaseCallback>* out) {
+ auto releaser = data.TakeReleaser<cc::mojom::TextureMailboxReleaserPtr>();
+ *out = cc::SingleReleaseCallback::Create(std::move(releaser));
+ return true;
+}
+
+} // namespace mojo
« no previous file with comments | « cc/ipc/single_release_callback_struct_traits.h ('k') | cc/ipc/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698