| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "mojo/public/cpp/bindings/lib/serialization_util.h" | 5 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| 6 | 6 |
| 7 namespace mojo { | 7 namespace mojo { |
| 8 namespace internal { | 8 namespace internal { |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 const size_t kAlignment = 8; | 12 const size_t kAlignment = 8; |
| 13 | 13 |
| 14 template <typename T> | 14 template <typename T> |
| 15 T AlignImpl(T t) { | 15 T AlignImpl(T t) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 36 return; | 36 return; |
| 37 } | 37 } |
| 38 | 38 |
| 39 const char* p_obj = reinterpret_cast<const char*>(ptr); | 39 const char* p_obj = reinterpret_cast<const char*>(ptr); |
| 40 const char* p_slot = reinterpret_cast<const char*>(offset); | 40 const char* p_slot = reinterpret_cast<const char*>(offset); |
| 41 DCHECK(p_obj > p_slot); | 41 DCHECK(p_obj > p_slot); |
| 42 | 42 |
| 43 *offset = static_cast<uint64_t>(p_obj - p_slot); | 43 *offset = static_cast<uint64_t>(p_obj - p_slot); |
| 44 } | 44 } |
| 45 | 45 |
| 46 const void* DecodePointerRaw(const uint64_t* offset) { | |
| 47 if (!*offset) | |
| 48 return nullptr; | |
| 49 return reinterpret_cast<const char*>(offset) + *offset; | |
| 50 } | |
| 51 | |
| 52 } // namespace internal | 46 } // namespace internal |
| 53 } // namespace mojo | 47 } // namespace mojo |
| OLD | NEW |