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

Side by Side Diff: mojo/public/cpp/bindings/lib/bindings_serialization.h

Issue 1677753002: Mojo C++ bindings: InterfacePtr::PassInterface -> PassInterfaceHandle (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 template <typename T> 72 template <typename T>
73 inline void Decode(T* obj, std::vector<Handle>* handles) { 73 inline void Decode(T* obj, std::vector<Handle>* handles) {
74 DecodePointer(&obj->offset, &obj->ptr); 74 DecodePointer(&obj->offset, &obj->ptr);
75 if (obj->ptr) 75 if (obj->ptr)
76 obj->ptr->DecodePointersAndHandles(handles); 76 obj->ptr->DecodePointersAndHandles(handles);
77 } 77 }
78 78
79 template <typename T> 79 template <typename T>
80 inline void InterfacePointerToData(InterfacePtr<T> input, 80 inline void InterfacePointerToData(InterfacePtr<T> input,
81 Interface_Data* output) { 81 Interface_Data* output) {
82 InterfaceHandle<T> info = input.PassInterface(); 82 InterfaceHandle<T> info = input.PassInterfaceHandle();
83 output->handle = info.PassHandle().release(); 83 output->handle = info.PassHandle().release();
84 output->version = info.version(); 84 output->version = info.version();
85 } 85 }
86 86
87 template <typename T> 87 template <typename T>
88 inline void InterfaceDataToPointer(Interface_Data* input, 88 inline void InterfaceDataToPointer(Interface_Data* input,
89 InterfacePtr<T>* output) { 89 InterfacePtr<T>* output) {
90 output->Bind(InterfaceHandle<T>( 90 output->Bind(InterfaceHandle<T>(
91 MakeScopedHandle(FetchAndReset(&input->handle)), input->version)); 91 MakeScopedHandle(FetchAndReset(&input->handle)), input->version));
92 } 92 }
93 93
94 } // namespace internal 94 } // namespace internal
95 } // namespace mojo 95 } // namespace mojo
96 96
97 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ 97 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/interface_ptr.h ('k') | mojo/public/cpp/bindings/lib/interface_ptr_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698