| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/edk/system/shared_buffer_dispatcher.h" | 5 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 *result = MOJO_RESULT_OK; | 92 *result = MOJO_RESULT_OK; |
| 93 return CreateInternal(std::move(shared_buffer)); | 93 return CreateInternal(std::move(shared_buffer)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 Dispatcher::Type SharedBufferDispatcher::GetType() const { | 96 Dispatcher::Type SharedBufferDispatcher::GetType() const { |
| 97 return Type::SHARED_BUFFER; | 97 return Type::SHARED_BUFFER; |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool SharedBufferDispatcher::SupportsEntrypointClass( |
| 101 EntrypointClass entrypoint_class) const { |
| 102 return (entrypoint_class == EntrypointClass::BUFFER); |
| 103 } |
| 104 |
| 100 // static | 105 // static |
| 101 RefPtr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize( | 106 RefPtr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize( |
| 102 Channel* channel, | 107 Channel* channel, |
| 103 const void* source, | 108 const void* source, |
| 104 size_t size, | 109 size_t size, |
| 105 std::vector<ScopedPlatformHandle>* platform_handles) { | 110 std::vector<ScopedPlatformHandle>* platform_handles) { |
| 106 DCHECK(channel); | 111 DCHECK(channel); |
| 107 | 112 |
| 108 if (size != sizeof(SerializedSharedBufferDispatcher)) { | 113 if (size != sizeof(SerializedSharedBufferDispatcher)) { |
| 109 LOG(ERROR) << "Invalid serialized shared buffer dispatcher (bad size)"; | 114 LOG(ERROR) << "Invalid serialized shared buffer dispatcher (bad size)"; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 platform_handles->push_back(std::move(platform_handle)); | 321 platform_handles->push_back(std::move(platform_handle)); |
| 317 *actual_size = sizeof(SerializedSharedBufferDispatcher); | 322 *actual_size = sizeof(SerializedSharedBufferDispatcher); |
| 318 | 323 |
| 319 shared_buffer_ = nullptr; | 324 shared_buffer_ = nullptr; |
| 320 | 325 |
| 321 return true; | 326 return true; |
| 322 } | 327 } |
| 323 | 328 |
| 324 } // namespace system | 329 } // namespace system |
| 325 } // namespace mojo | 330 } // namespace mojo |
| OLD | NEW |