| Index: mojo/public/cpp/bindings/lib/serialization_context.cc
|
| diff --git a/mojo/public/cpp/bindings/lib/serialization_util.cc b/mojo/public/cpp/bindings/lib/serialization_context.cc
|
| similarity index 58%
|
| copy from mojo/public/cpp/bindings/lib/serialization_util.cc
|
| copy to mojo/public/cpp/bindings/lib/serialization_context.cc
|
| index 4624ff8baa1dc75fbdca51a897c4c64f44ba1662..f0cf730f1a4491af9e6f495f54082e0747379d2a 100644
|
| --- a/mojo/public/cpp/bindings/lib/serialization_util.cc
|
| +++ b/mojo/public/cpp/bindings/lib/serialization_context.cc
|
| @@ -1,61 +1,18 @@
|
| -// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// 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 "mojo/public/cpp/bindings/lib/serialization_util.h"
|
| -
|
| -#include <stddef.h>
|
| -#include <stdint.h>
|
| +#include "mojo/public/cpp/bindings/lib/serialization_context.h"
|
|
|
| #include <limits>
|
|
|
| #include "base/logging.h"
|
| +#include "mojo/public/cpp/bindings/lib/multiplex_router.h"
|
| +#include "mojo/public/cpp/system/core.h"
|
|
|
| namespace mojo {
|
| namespace internal {
|
|
|
| -namespace {
|
| -
|
| -const size_t kAlignment = 8;
|
| -
|
| -template <typename T>
|
| -T AlignImpl(T t) {
|
| - return t + (kAlignment - (t % kAlignment)) % kAlignment;
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| -size_t Align(size_t size) {
|
| - return AlignImpl(size);
|
| -}
|
| -
|
| -char* AlignPointer(char* ptr) {
|
| - return reinterpret_cast<char*>(AlignImpl(reinterpret_cast<uintptr_t>(ptr)));
|
| -}
|
| -
|
| -bool IsAligned(const void* ptr) {
|
| - return !(reinterpret_cast<uintptr_t>(ptr) % kAlignment);
|
| -}
|
| -
|
| -void EncodePointer(const void* ptr, uint64_t* offset) {
|
| - if (!ptr) {
|
| - *offset = 0;
|
| - return;
|
| - }
|
| -
|
| - const char* p_obj = reinterpret_cast<const char*>(ptr);
|
| - const char* p_slot = reinterpret_cast<const char*>(offset);
|
| - DCHECK(p_obj > p_slot);
|
| -
|
| - *offset = static_cast<uint64_t>(p_obj - p_slot);
|
| -}
|
| -
|
| -const void* DecodePointerRaw(const uint64_t* offset) {
|
| - if (!*offset)
|
| - return nullptr;
|
| - return reinterpret_cast<const char*>(offset) + *offset;
|
| -}
|
| -
|
| SerializedHandleVector::SerializedHandleVector() {}
|
|
|
| SerializedHandleVector::~SerializedHandleVector() {
|
|
|