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

Side by Side Diff: Source/bindings/v8/custom/V8Uint16ArrayCustom.h

Issue 19230002: Use V8 implementation of TypedArrays and DataView in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Extracted tests for huge arrays and disabled them Created 7 years, 5 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
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN Y
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN Y
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O N
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 */
25
26 #ifndef V8Uint16ArrayCustom_h
27 #define V8Uint16ArrayCustom_h
28
29 #include "bindings/v8/custom/V8TypedArrayCustom.h"
30 #include "wtf/Uint16Array.h"
31
32 namespace WebCore {
33
34 template<>
35 class TypedArrayTraits<Uint16Array> {
36 public:
37 typedef v8::Uint16Array V8Type;
38
39 static bool IsInstance(v8::Handle<v8::Value> value)
40 {
41 return value->IsUint16Array();
42 }
43
44 static size_t length(v8::Handle<v8::Uint16Array> value)
45 {
46 return value->Length();
47 }
48
49 static size_t length(Uint16Array* array)
50 {
51 return array->length();
52 }
53 };
54
55 typedef V8TypedArray<Uint16Array> V8Uint16Array;
56
57 template<>
58 class WrapperTypeTraits<Uint16Array> : public TypedArrayWrapperTraits<Uint16Arra y> { };
59
60
61 inline v8::Handle<v8::Object> wrap(Uint16Array* impl, v8::Handle<v8::Object> cre ationContext, v8::Isolate* isolate)
62 {
63 return V8TypedArray<Uint16Array>::wrap(impl, creationContext, isolate);
64 }
65
66 inline v8::Handle<v8::Value> toV8(Uint16Array* impl, v8::Handle<v8::Object> crea tionContext, v8::Isolate* isolate)
67 {
68 return V8TypedArray<Uint16Array>::toV8(impl, creationContext, isolate);
69 }
70
71 inline v8::Handle<v8::Value> toV8ForMainWorld(Uint16Array* impl, v8::Handle<v8:: Object> creationContext, v8::Isolate* isolate)
72 {
73 return V8TypedArray<Uint16Array>::toV8ForMainWorld(impl, creationContext, is olate);
74 }
75
76 template<class HolderContainer, class Wrappable>
77 inline v8::Handle<v8::Value> toV8Fast(Uint16Array* impl, const HolderContainer& container, Wrappable* wrappable)
78 {
79 return V8TypedArray<Uint16Array>::toV8Fast(impl, container, wrappable);
80 }
81
82 template<class HolderContainer, class Wrappable>
83 inline v8::Handle<v8::Value> toV8FastForMainWorld(Uint16Array* impl, const Holde rContainer& container, Wrappable* wrappable)
84 {
85 return V8TypedArray<Uint16Array>::toV8FastForMainWorld(impl, container, wrap pable);
86 }
87
88 template<class HolderContainer, class Wrappable>
89 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Uint16Array > impl , const HolderContainer& container, Wrappable* wrappable)
90 {
91 return toV8FastForMainWorld(impl.get(), container, wrappable);
92 }
93
94
95 template<class HolderContainer, class Wrappable>
96 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< Uint16Array > impl, const Hold erContainer& container, Wrappable* wrappable)
97 {
98 return toV8Fast(impl.get(), container, wrappable);
99 }
100
101 inline v8::Handle<v8::Value> toV8(PassRefPtr< Uint16Array > impl, v8::Handle<v8: :Object> creationContext, v8::Isolate* isolate)
102 {
103 return toV8(impl.get(), creationContext, isolate);
104 }
105
106 } // namespace WebCore
107
108 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698