Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/Source/core/mojo/MojoHandle.cpp

Issue 2811863002: Move ScriptState::GetExecutionContext (Part 4) (Closed)
Patch Set: Fix Document.cpp Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 8 #include "bindings/core/v8/ScriptState.h"
9 #include "core/dom/DOMArrayBuffer.h" 9 #include "core/dom/DOMArrayBuffer.h"
10 #include "core/dom/DOMArrayBufferView.h" 10 #include "core/dom/DOMArrayBufferView.h"
11 #include "core/dom/ExecutionContext.h"
11 #include "core/mojo/MojoCreateSharedBufferResult.h" 12 #include "core/mojo/MojoCreateSharedBufferResult.h"
12 #include "core/mojo/MojoDiscardDataOptions.h" 13 #include "core/mojo/MojoDiscardDataOptions.h"
13 #include "core/mojo/MojoDuplicateBufferHandleOptions.h" 14 #include "core/mojo/MojoDuplicateBufferHandleOptions.h"
14 #include "core/mojo/MojoMapBufferResult.h" 15 #include "core/mojo/MojoMapBufferResult.h"
15 #include "core/mojo/MojoReadDataOptions.h" 16 #include "core/mojo/MojoReadDataOptions.h"
16 #include "core/mojo/MojoReadDataResult.h" 17 #include "core/mojo/MojoReadDataResult.h"
17 #include "core/mojo/MojoReadMessageFlags.h" 18 #include "core/mojo/MojoReadMessageFlags.h"
18 #include "core/mojo/MojoReadMessageResult.h" 19 #include "core/mojo/MojoReadMessageResult.h"
19 #include "core/mojo/MojoWatcher.h" 20 #include "core/mojo/MojoWatcher.h"
20 #include "core/mojo/MojoWriteDataOptions.h" 21 #include "core/mojo/MojoWriteDataOptions.h"
(...skipping 14 matching lines...) Expand all
35 : handle_(std::move(handle)) {} 36 : handle_(std::move(handle)) {}
36 37
37 void MojoHandle::close() { 38 void MojoHandle::close() {
38 handle_.reset(); 39 handle_.reset();
39 } 40 }
40 41
41 MojoWatcher* MojoHandle::watch(ScriptState* script_state, 42 MojoWatcher* MojoHandle::watch(ScriptState* script_state,
42 const MojoHandleSignals& signals, 43 const MojoHandleSignals& signals,
43 MojoWatchCallback* callback) { 44 MojoWatchCallback* callback) {
44 return MojoWatcher::Create(handle_.get(), signals, callback, 45 return MojoWatcher::Create(handle_.get(), signals, callback,
45 script_state->GetExecutionContext()); 46 ExecutionContext::From(script_state));
46 } 47 }
47 48
48 MojoResult MojoHandle::writeMessage( 49 MojoResult MojoHandle::writeMessage(
49 ArrayBufferOrArrayBufferView& buffer, 50 ArrayBufferOrArrayBufferView& buffer,
50 const HeapVector<Member<MojoHandle>>& handles) { 51 const HeapVector<Member<MojoHandle>>& handles) {
51 // MojoWriteMessage takes ownership of the handles, so release them here. 52 // MojoWriteMessage takes ownership of the handles, so release them here.
52 Vector<::MojoHandle, kHandleVectorInlineCapacity> raw_handles(handles.size()); 53 Vector<::MojoHandle, kHandleVectorInlineCapacity> raw_handles(handles.size());
53 std::transform( 54 std::transform(
54 handles.begin(), handles.end(), raw_handles.begin(), 55 handles.begin(), handles.end(), raw_handles.begin(),
55 [](MojoHandle* handle) { return handle->handle_.release().value(); }); 56 [](MojoHandle* handle) { return handle->handle_.release().value(); });
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 mojo::Handle handle; 206 mojo::Handle handle;
206 MojoResult result = MojoDuplicateBufferHandle(handle_->value(), &options, 207 MojoResult result = MojoDuplicateBufferHandle(handle_->value(), &options,
207 handle.mutable_value()); 208 handle.mutable_value());
208 result_dict.setResult(result); 209 result_dict.setResult(result);
209 if (result == MOJO_RESULT_OK) { 210 if (result == MOJO_RESULT_OK) {
210 result_dict.setHandle(MojoHandle::Create(mojo::MakeScopedHandle(handle))); 211 result_dict.setHandle(MojoHandle::Create(mojo::MakeScopedHandle(handle)));
211 } 212 }
212 } 213 }
213 214
214 } // namespace blink 215 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698