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 // 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 #include "config.h" | 7 #include "config.h" |
8 #include "V8DataView.h" | 8 #include "V8DataView.h" |
9 | 9 |
10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
11 #include "bindings/core/v8/V8ArrayBuffer.h" | 11 #include "bindings/core/v8/V8ArrayBuffer.h" |
12 #include "bindings/core/v8/V8DOMConfiguration.h" | 12 #include "bindings/core/v8/V8DOMConfiguration.h" |
13 #include "bindings/core/v8/V8ObjectConstructor.h" | 13 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 14 #include "bindings/core/v8/V8SharedArrayBuffer.h" |
14 #include "core/dom/ContextFeatures.h" | 15 #include "core/dom/ContextFeatures.h" |
15 #include "core/dom/Document.h" | 16 #include "core/dom/Document.h" |
16 #include "platform/RuntimeEnabledFeatures.h" | 17 #include "platform/RuntimeEnabledFeatures.h" |
17 #include "platform/TraceEvent.h" | 18 #include "platform/TraceEvent.h" |
18 #include "wtf/GetPtr.h" | 19 #include "wtf/GetPtr.h" |
19 #include "wtf/RefPtr.h" | 20 #include "wtf/RefPtr.h" |
20 | 21 |
21 namespace blink { | 22 namespace blink { |
22 | 23 |
23 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial | 24 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv
ial |
(...skipping 18 matching lines...) Expand all Loading... |
42 } | 43 } |
43 | 44 |
44 TestDataView* V8DataView::toImpl(v8::Local<v8::Object> object) | 45 TestDataView* V8DataView::toImpl(v8::Local<v8::Object> object) |
45 { | 46 { |
46 ASSERT(object->IsDataView()); | 47 ASSERT(object->IsDataView()); |
47 ScriptWrappable* scriptWrappable = toScriptWrappable(object); | 48 ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
48 if (scriptWrappable) | 49 if (scriptWrappable) |
49 return scriptWrappable->toImpl<TestDataView>(); | 50 return scriptWrappable->toImpl<TestDataView>(); |
50 | 51 |
51 v8::Local<v8::DataView> v8View = object.As<v8::DataView>(); | 52 v8::Local<v8::DataView> v8View = object.As<v8::DataView>(); |
52 RefPtr<TestDataView> typedArray = TestDataView::create(V8ArrayBuffer::toImpl
(v8View->Buffer()), v8View->ByteOffset(), v8View->ByteLength()); | 53 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); |
| 54 RefPtr<TestDataView> typedArray; |
| 55 if (arrayBuffer->IsArrayBuffer()) { |
| 56 typedArray = TestDataView::create(V8ArrayBuffer::toImpl(arrayBuffer), v8
View->ByteOffset(), v8View->ByteLength()); |
| 57 } else if (arrayBuffer->IsSharedArrayBuffer()) { |
| 58 typedArray = TestDataView::create(V8SharedArrayBuffer::toImpl(arrayBuffe
r), v8View->ByteOffset(), v8View->ByteLength()); |
| 59 } else { |
| 60 ASSERT_NOT_REACHED(); |
| 61 } |
53 typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrap
perTypeInfo(), object); | 62 typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrap
perTypeInfo(), object); |
54 | 63 |
55 return typedArray->toImpl<TestDataView>(); | 64 return typedArray->toImpl<TestDataView>(); |
56 } | 65 } |
57 | 66 |
58 TestDataView* V8DataView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8
::Value> value) | 67 TestDataView* V8DataView::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8
::Value> value) |
59 { | 68 { |
60 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; | 69 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; |
61 } | 70 } |
62 | 71 |
63 void V8DataView::refObject(ScriptWrappable* scriptWrappable) | 72 void V8DataView::refObject(ScriptWrappable* scriptWrappable) |
64 { | 73 { |
65 scriptWrappable->toImpl<TestDataView>()->ref(); | 74 scriptWrappable->toImpl<TestDataView>()->ref(); |
66 } | 75 } |
67 | 76 |
68 void V8DataView::derefObject(ScriptWrappable* scriptWrappable) | 77 void V8DataView::derefObject(ScriptWrappable* scriptWrappable) |
69 { | 78 { |
70 scriptWrappable->toImpl<TestDataView>()->deref(); | 79 scriptWrappable->toImpl<TestDataView>()->deref(); |
71 } | 80 } |
72 | 81 |
73 } // namespace blink | 82 } // namespace blink |
OLD | NEW |