| 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 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer( | 75 scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer( |
| 76 platform_support->CreateSharedBuffer(static_cast<size_t>(num_bytes))); | 76 platform_support->CreateSharedBuffer(static_cast<size_t>(num_bytes))); |
| 77 if (!shared_buffer) | 77 if (!shared_buffer) |
| 78 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 78 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
| 79 | 79 |
| 80 *result = new SharedBufferDispatcher(shared_buffer); | 80 *result = new SharedBufferDispatcher(shared_buffer); |
| 81 return MOJO_RESULT_OK; | 81 return MOJO_RESULT_OK; |
| 82 } | 82 } |
| 83 | 83 |
| 84 Dispatcher::Type SharedBufferDispatcher::GetType() const { | 84 Dispatcher::Type SharedBufferDispatcher::GetType() const { |
| 85 return kTypeSharedBuffer; | 85 return Type::SHARED_BUFFER; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 scoped_refptr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize( | 89 scoped_refptr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize( |
| 90 Channel* channel, | 90 Channel* channel, |
| 91 const void* source, | 91 const void* source, |
| 92 size_t size, | 92 size_t size, |
| 93 embedder::PlatformHandleVector* platform_handles) { | 93 embedder::PlatformHandleVector* platform_handles) { |
| 94 DCHECK(channel); | 94 DCHECK(channel); |
| 95 | 95 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 platform_handles->push_back(platform_handle.release()); | 267 platform_handles->push_back(platform_handle.release()); |
| 268 *actual_size = sizeof(SerializedSharedBufferDispatcher); | 268 *actual_size = sizeof(SerializedSharedBufferDispatcher); |
| 269 | 269 |
| 270 shared_buffer_ = nullptr; | 270 shared_buffer_ = nullptr; |
| 271 | 271 |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace system | 275 } // namespace system |
| 276 } // namespace mojo | 276 } // namespace mojo |
| OLD | NEW |