Index: mojo/public/cpp/bindings/lib/serialization_util.h |
diff --git a/mojo/public/cpp/bindings/lib/serialization_util.h b/mojo/public/cpp/bindings/lib/serialization_util.h |
index c5533939a55ced5c175f38f6288f315a3b2c7132..56f5e761daffe43fbfc99ce09092a00612206a47 100644 |
--- a/mojo/public/cpp/bindings/lib/serialization_util.h |
+++ b/mojo/public/cpp/bindings/lib/serialization_util.h |
@@ -2,27 +2,25 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
-#define MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
+#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ |
+#define MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ |
#include <stddef.h> |
#include <stdint.h> |
#include <queue> |
-#include <vector> |
+#include "base/logging.h" |
#include "base/macros.h" |
-#include "base/memory/ref_counted.h" |
#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" |
#include "mojo/public/cpp/bindings/interface_ptr.h" |
#include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
-#include "mojo/public/cpp/system/core.h" |
+#include "mojo/public/cpp/bindings/lib/serialization_context.h" |
#include "mojo/public/cpp/system/handle.h" |
namespace mojo { |
namespace internal { |
-struct SerializationContext; |
class MultiplexRouter; |
size_t Align(size_t size); |
@@ -86,54 +84,6 @@ inline void AssociatedInterfaceDataToPtrInfo( |
output->set_version(input->version); |
} |
-// A container for handles during serialization/deserialization. |
-class SerializedHandleVector { |
- public: |
- SerializedHandleVector(); |
- ~SerializedHandleVector(); |
- |
- size_t size() const { return handles_.size(); } |
- |
- // Adds a handle to the handle list and returns its index for encoding. |
- Handle_Data AddHandle(mojo::Handle handle); |
- |
- // Takes a handle from the list of serialized handle data. |
- mojo::Handle TakeHandle(const Handle_Data& encoded_handle); |
- |
- // Takes a handle from the list of serialized handle data and returns it in |
- // |*out_handle| as a specific scoped handle type. |
- template <typename T> |
- ScopedHandleBase<T> TakeHandleAs(const Handle_Data& encoded_handle) { |
- return MakeScopedHandle(T(TakeHandle(encoded_handle).value())); |
- } |
- |
- // Swaps all owned handles out with another Handle vector. |
- void Swap(std::vector<mojo::Handle>* other); |
- |
- private: |
- // Handles are owned by this object. |
- std::vector<mojo::Handle> handles_; |
- |
- DISALLOW_COPY_AND_ASSIGN(SerializedHandleVector); |
-}; |
- |
-// Context information for serialization/deserialization routines. |
-struct SerializationContext { |
- SerializationContext(); |
- explicit SerializationContext(scoped_refptr<MultiplexRouter> in_router); |
- |
- ~SerializationContext(); |
- |
- // Used to serialize/deserialize associated interface pointers and requests. |
- scoped_refptr<MultiplexRouter> router; |
- |
- // Opaque context pointers returned by StringTraits::SetUpContext(). |
- std::unique_ptr<std::queue<void*>> custom_contexts; |
- |
- // Stashes handles encoded in a message by index. |
- SerializedHandleVector handles; |
-}; |
- |
template <typename T> |
inline void InterfacePointerToData(InterfacePtr<T> input, |
Interface_Data* output, |
@@ -263,4 +213,4 @@ ReturnType CallWithContext(ReturnType (*f)(ParamType), |
} // namespace internal |
} // namespace mojo |
-#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_BINDINGS_SERIALIZATION_H_ |
+#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_SERIALIZATION_UTIL_H_ |