OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "bindings/core/v8/V8Binding.h" | 32 #include "bindings/core/v8/V8Binding.h" |
33 | 33 |
34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
35 #include "bindings/core/v8/V8AbstractEventListener.h" | 35 #include "bindings/core/v8/V8AbstractEventListener.h" |
36 #include "bindings/core/v8/V8ArrayBufferView.h" | |
36 #include "bindings/core/v8/V8BindingMacros.h" | 37 #include "bindings/core/v8/V8BindingMacros.h" |
37 #include "bindings/core/v8/V8Element.h" | 38 #include "bindings/core/v8/V8Element.h" |
38 #include "bindings/core/v8/V8EventTarget.h" | 39 #include "bindings/core/v8/V8EventTarget.h" |
39 #include "bindings/core/v8/V8NodeFilter.h" | 40 #include "bindings/core/v8/V8NodeFilter.h" |
40 #include "bindings/core/v8/V8NodeFilterCondition.h" | 41 #include "bindings/core/v8/V8NodeFilterCondition.h" |
41 #include "bindings/core/v8/V8ObjectConstructor.h" | 42 #include "bindings/core/v8/V8ObjectConstructor.h" |
42 #include "bindings/core/v8/V8Window.h" | 43 #include "bindings/core/v8/V8Window.h" |
43 #include "bindings/core/v8/V8WorkerGlobalScope.h" | 44 #include "bindings/core/v8/V8WorkerGlobalScope.h" |
44 #include "bindings/core/v8/V8XPathNSResolver.h" | 45 #include "bindings/core/v8/V8XPathNSResolver.h" |
45 #include "bindings/core/v8/WindowProxy.h" | 46 #include "bindings/core/v8/WindowProxy.h" |
46 #include "bindings/core/v8/WorkerScriptController.h" | 47 #include "bindings/core/v8/WorkerScriptController.h" |
47 #include "bindings/core/v8/custom/V8CustomXPathNSResolver.h" | 48 #include "bindings/core/v8/custom/V8CustomXPathNSResolver.h" |
48 #include "core/dom/Document.h" | 49 #include "core/dom/Document.h" |
49 #include "core/dom/Element.h" | 50 #include "core/dom/Element.h" |
51 #include "core/dom/FlexibleArrayBufferView.h" | |
50 #include "core/dom/NodeFilter.h" | 52 #include "core/dom/NodeFilter.h" |
51 #include "core/dom/QualifiedName.h" | 53 #include "core/dom/QualifiedName.h" |
52 #include "core/frame/LocalDOMWindow.h" | 54 #include "core/frame/LocalDOMWindow.h" |
53 #include "core/frame/LocalFrame.h" | 55 #include "core/frame/LocalFrame.h" |
54 #include "core/frame/Settings.h" | 56 #include "core/frame/Settings.h" |
55 #include "core/inspector/InspectorTraceEvents.h" | 57 #include "core/inspector/InspectorTraceEvents.h" |
56 #include "core/loader/FrameLoader.h" | 58 #include "core/loader/FrameLoader.h" |
57 #include "core/loader/FrameLoaderClient.h" | 59 #include "core/loader/FrameLoaderClient.h" |
58 #include "core/workers/WorkerGlobalScope.h" | 60 #include "core/workers/WorkerGlobalScope.h" |
59 #include "core/xml/XPathNSResolver.h" | 61 #include "core/xml/XPathNSResolver.h" |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 // exists on a prototype chain of v8Value. | 751 // exists on a prototype chain of v8Value. |
750 if (DOMWindow* window = toDOMWindow(isolate, value)) | 752 if (DOMWindow* window = toDOMWindow(isolate, value)) |
751 return static_cast<EventTarget*>(window); | 753 return static_cast<EventTarget*>(window); |
752 if (V8EventTarget::hasInstance(value, isolate)) { | 754 if (V8EventTarget::hasInstance(value, isolate)) { |
753 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); | 755 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(value); |
754 return toWrapperTypeInfo(object)->toEventTarget(object); | 756 return toWrapperTypeInfo(object)->toEventTarget(object); |
755 } | 757 } |
756 return 0; | 758 return 0; |
757 } | 759 } |
758 | 760 |
761 void toFlexibleArrayBufferView(v8::Isolate* isolate, v8::Handle<v8::Value> value , FlexibleArrayBufferView& result, void* storage) | |
762 { | |
763 if (!value->IsArrayBufferView()) | |
haraken
2015/07/30 20:34:43
Is this a valid situation? If not, we can change t
Michael Lippautz
2015/07/31 07:53:38
As far as I see, it should always be an ArrayBuffe
| |
764 return; | |
765 v8::Local<v8::ArrayBufferView> buffer = value.As<v8::ArrayBufferView>(); | |
766 if (!storage) { | |
767 result.setFull(V8ArrayBufferView::toImpl(buffer)); | |
768 return; | |
769 } | |
770 size_t length = buffer->ByteLength(); | |
771 buffer->CopyContents(storage, length); | |
772 result.setSmall(storage, length); | |
773 } | |
774 | |
759 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w orld) | 775 v8::Local<v8::Context> toV8Context(ExecutionContext* context, DOMWrapperWorld& w orld) |
760 { | 776 { |
761 ASSERT(context); | 777 ASSERT(context); |
762 if (context->isDocument()) { | 778 if (context->isDocument()) { |
763 if (LocalFrame* frame = toDocument(context)->frame()) | 779 if (LocalFrame* frame = toDocument(context)->frame()) |
764 return toV8Context(frame, world); | 780 return toV8Context(frame, world); |
765 } else if (context->isWorkerGlobalScope()) { | 781 } else if (context->isWorkerGlobalScope()) { |
766 if (WorkerScriptController* script = toWorkerGlobalScope(context)->scrip t()) { | 782 if (WorkerScriptController* script = toWorkerGlobalScope(context)->scrip t()) { |
767 if (script->scriptState()->contextIsValid()) | 783 if (script->scriptState()->contextIsValid()) |
768 return script->scriptState()->context(); | 784 return script->scriptState()->context(); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1004 v8::Local<v8::Value> data = info.Data(); | 1020 v8::Local<v8::Value> data = info.Data(); |
1005 ASSERT(data->IsExternal()); | 1021 ASSERT(data->IsExternal()); |
1006 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); | 1022 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); |
1007 if (!perContextData) | 1023 if (!perContextData) |
1008 return; | 1024 return; |
1009 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); | 1025 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); |
1010 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 1026 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
1011 } | 1027 } |
1012 | 1028 |
1013 } // namespace blink | 1029 } // namespace blink |
OLD | NEW |