| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/mojo/MojoHandle.h" | 5 #include "core/mojo/MojoHandle.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" | 7 #include "bindings/core/v8/ArrayBufferOrArrayBufferView.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | |
| 9 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
| 10 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
| 11 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| 12 #include "core/mojo/MojoCreateSharedBufferResult.h" | 11 #include "core/mojo/MojoCreateSharedBufferResult.h" |
| 13 #include "core/mojo/MojoDiscardDataOptions.h" | 12 #include "core/mojo/MojoDiscardDataOptions.h" |
| 14 #include "core/mojo/MojoDuplicateBufferHandleOptions.h" | 13 #include "core/mojo/MojoDuplicateBufferHandleOptions.h" |
| 15 #include "core/mojo/MojoMapBufferResult.h" | 14 #include "core/mojo/MojoMapBufferResult.h" |
| 16 #include "core/mojo/MojoReadDataOptions.h" | 15 #include "core/mojo/MojoReadDataOptions.h" |
| 17 #include "core/mojo/MojoReadDataResult.h" | 16 #include "core/mojo/MojoReadDataResult.h" |
| 18 #include "core/mojo/MojoReadMessageFlags.h" | 17 #include "core/mojo/MojoReadMessageFlags.h" |
| 19 #include "core/mojo/MojoReadMessageResult.h" | 18 #include "core/mojo/MojoReadMessageResult.h" |
| 20 #include "core/mojo/MojoWatcher.h" | 19 #include "core/mojo/MojoWatcher.h" |
| 21 #include "core/mojo/MojoWriteDataOptions.h" | 20 #include "core/mojo/MojoWriteDataOptions.h" |
| 22 #include "core/mojo/MojoWriteDataResult.h" | 21 #include "core/mojo/MojoWriteDataResult.h" |
| 22 #include "platform/bindings/ScriptState.h" |
| 23 | 23 |
| 24 // Mojo messages typically do not contain many handles. In fact most | 24 // Mojo messages typically do not contain many handles. In fact most |
| 25 // messages do not contain any handle. An inline capacity of 4 should avoid | 25 // messages do not contain any handle. An inline capacity of 4 should avoid |
| 26 // heap allocation in vast majority of cases. | 26 // heap allocation in vast majority of cases. |
| 27 static const size_t kHandleVectorInlineCapacity = 4; | 27 static const size_t kHandleVectorInlineCapacity = 4; |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 MojoHandle* MojoHandle::Create(mojo::ScopedHandle handle) { | 31 MojoHandle* MojoHandle::Create(mojo::ScopedHandle handle) { |
| 32 return new MojoHandle(std::move(handle)); | 32 return new MojoHandle(std::move(handle)); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 mojo::Handle handle; | 206 mojo::Handle handle; |
| 207 MojoResult result = MojoDuplicateBufferHandle(handle_->value(), &options, | 207 MojoResult result = MojoDuplicateBufferHandle(handle_->value(), &options, |
| 208 handle.mutable_value()); | 208 handle.mutable_value()); |
| 209 result_dict.setResult(result); | 209 result_dict.setResult(result); |
| 210 if (result == MOJO_RESULT_OK) { | 210 if (result == MOJO_RESULT_OK) { |
| 211 result_dict.setHandle(MojoHandle::Create(mojo::MakeScopedHandle(handle))); | 211 result_dict.setHandle(MojoHandle::Create(mojo::MakeScopedHandle(handle))); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |