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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp

Issue 2414333003: WebMessaging: Send transferable ArrayBuffers by copy-and-neuter semantics (Closed)
Patch Set: remake Created 4 years, 2 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 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 // clang-format off 7 // clang-format off
8 #include "V8TestObject.h" 8 #include "V8TestObject.h"
9 9
10 #include "bindings/core/v8/AnyCallbackFunctionOptionalAnyArg.h" 10 #include "bindings/core/v8/AnyCallbackFunctionOptionalAnyArg.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "bindings/core/v8/V8TestInterfaceEmpty.h" 60 #include "bindings/core/v8/V8TestInterfaceEmpty.h"
61 #include "bindings/core/v8/V8TestInterfaceGarbageCollected.h" 61 #include "bindings/core/v8/V8TestInterfaceGarbageCollected.h"
62 #include "bindings/core/v8/V8TestNode.h" 62 #include "bindings/core/v8/V8TestNode.h"
63 #include "bindings/core/v8/V8TestObject.h" 63 #include "bindings/core/v8/V8TestObject.h"
64 #include "bindings/core/v8/V8Uint8Array.h" 64 #include "bindings/core/v8/V8Uint8Array.h"
65 #include "bindings/core/v8/V8Window.h" 65 #include "bindings/core/v8/V8Window.h"
66 #include "bindings/core/v8/V8XPathNSResolver.h" 66 #include "bindings/core/v8/V8XPathNSResolver.h"
67 #include "bindings/core/v8/VoidCallbackFunction.h" 67 #include "bindings/core/v8/VoidCallbackFunction.h"
68 #include "core/HTMLNames.h" 68 #include "core/HTMLNames.h"
69 #include "core/dom/ClassCollection.h" 69 #include "core/dom/ClassCollection.h"
70 #include "core/dom/DOMArrayBufferBase.h"
70 #include "core/dom/Document.h" 71 #include "core/dom/Document.h"
71 #include "core/dom/FlexibleArrayBufferView.h" 72 #include "core/dom/FlexibleArrayBufferView.h"
72 #include "core/dom/TagCollection.h" 73 #include "core/dom/TagCollection.h"
73 #include "core/dom/custom/V0CustomElementProcessingStack.h" 74 #include "core/dom/custom/V0CustomElementProcessingStack.h"
74 #include "core/frame/Deprecation.h" 75 #include "core/frame/Deprecation.h"
75 #include "core/frame/LocalFrame.h" 76 #include "core/frame/LocalFrame.h"
76 #include "core/frame/UseCounter.h" 77 #include "core/frame/UseCounter.h"
77 #include "core/html/HTMLCollection.h" 78 #include "core/html/HTMLCollection.h"
78 #include "core/html/HTMLDataListOptionsCollection.h" 79 #include "core/html/HTMLDataListOptionsCollection.h"
79 #include "core/html/HTMLFormControlsCollection.h" 80 #include "core/html/HTMLFormControlsCollection.h"
(...skipping 11453 matching lines...) Expand 10 before | Expand all | Expand 10 after
11533 TestObjectV8Internal::perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodF orMainWorld(info); 11534 TestObjectV8Internal::perWorldBindingsVoidMethodTestInterfaceEmptyArgMethodF orMainWorld(info);
11534 } 11535 }
11535 11536
11536 static void postMessageImpl(const char* interfaceName, TestObject* instance, con st v8::FunctionCallbackInfo<v8::Value>& info) 11537 static void postMessageImpl(const char* interfaceName, TestObject* instance, con st v8::FunctionCallbackInfo<v8::Value>& info)
11537 { 11538 {
11538 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, interfaceName, "postMessage"); 11539 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, interfaceName, "postMessage");
11539 if (UNLIKELY(info.Length() < 1)) { 11540 if (UNLIKELY(info.Length() < 1)) {
11540 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 11541 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
11541 return; 11542 return;
11542 } 11543 }
11544
11543 Transferables transferables; 11545 Transferables transferables;
11544 if (info.Length() > 1) { 11546 if (info.Length() > 1) {
11545 const int transferablesArgIndex = 1; 11547 const int transferablesArgIndex = 1;
11546 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info [transferablesArgIndex], transferablesArgIndex, transferables, exceptionState)) { 11548 if (!SerializedScriptValue::extractTransferables(info.GetIsolate(), info [transferablesArgIndex], transferablesArgIndex, transferables, exceptionState)) {
11547 return; 11549 return;
11548 } 11550 }
11549 } 11551 }
11550 RefPtr<SerializedScriptValue> message = SerializedScriptValue::serialize(inf o.GetIsolate(), info[0], &transferables, nullptr, exceptionState); 11552
11551 if (exceptionState.hadException()) 11553 RefPtr<SerializedScriptValue> message;
11552 return; 11554 if (instance->canTransferArrayBuffer()) {
11555 // This instance supports sending array buffers by move semantics.
11556 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], & transferables, nullptr, exceptionState);
11557 if (exceptionState.hadException())
11558 return;
11559 } else {
11560 // This instance doesn't support sending array buffers by move
11561 // semantics. Emulate it by copy-and-neuter semantics that sends array
11562 // buffers by copy semantics and then neuters the original array
haraken 2016/10/19 09:49:28 Just to confirm: Your intention is to NOT copy the
nhiroki 2016/10/19 12:51:53 No. My intention is to copy-transfer the array buf
haraken 2016/10/19 15:40:46 I'm a bit confused. You're ignoring the return va
nhiroki 2016/10/20 07:44:02 SerializedScriptValue::serialize() copies the arra
11563 // buffers.
11564
11565 // Clear transferable array buffers so that the serializer can handle
11566 // them by copy semantics.
11567 ArrayBufferArray transferableArrayBuffers = transferables.arrayBuffers;
11568 transferables.arrayBuffers.clear();
11569 message = SerializedScriptValue::serialize(info.GetIsolate(), info[0], & transferables, nullptr, exceptionState);
11570 if (exceptionState.hadException())
11571 return;
11572
11573 // Neuter the original array buffers on the sender context.
11574 SerializedScriptValue::transferArrayBufferContents(info.GetIsolate(), tr ansferableArrayBuffers, exceptionState);
11575 if (exceptionState.hadException())
11576 return;
11577 }
11578
11553 // FIXME: Only pass context/exceptionState if instance really requires it. 11579 // FIXME: Only pass context/exceptionState if instance really requires it.
11554 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); 11580 ExecutionContext* context = currentExecutionContext(info.GetIsolate());
11555 instance->postMessage(context, message.release(), transferables.messagePorts , exceptionState); 11581 instance->postMessage(context, message.release(), transferables.messagePorts , exceptionState);
11556 } 11582 }
11557 11583
11558 static void postMessageMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 11584 static void postMessageMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
11559 { 11585 {
11560 postMessageImpl("TestObject", V8TestObject::toImpl(info.Holder()), info); 11586 postMessageImpl("TestObject", V8TestObject::toImpl(info.Holder()), info);
11561 } 11587 }
11562 11588
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after
14072 if (!scriptStateInUserScript) 14098 if (!scriptStateInUserScript)
14073 return false; 14099 return false;
14074 14100
14075 ScriptState::Scope scope(scriptState); 14101 ScriptState::Scope scope(scriptState);
14076 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 14102 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
14077 ExceptionState exceptionState(ExceptionState::SetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ; 14103 ExceptionState exceptionState(ExceptionState::SetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ;
14078 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "enumForPrivateScript", holder, v8String(scriptState-> isolate(), cppValue)); 14104 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "enumForPrivateScript", holder, v8String(scriptState-> isolate(), cppValue));
14079 } 14105 }
14080 14106
14081 } // namespace blink 14107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698