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

Side by Side Diff: Source/bindings/v8/custom/V8Int8ArrayCustom.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 V8Int8ArrayCustom_h
27 #define V8Int8ArrayCustom_h
28
29 #include "bindings/v8/custom/V8TypedArrayCustom.h"
30 #include "wtf/Int8Array.h"
31
32 namespace WebCore {
33
34 template<>
35 class TypedArrayTraits<Int8Array> {
36 public:
37 typedef v8::Int8Array V8Type;
38
39 static bool IsInstance(v8::Handle<v8::Value> value)
40 {
41 return value->IsInt8Array();
42 }
43
44 static size_t length(v8::Handle<v8::Int8Array> value)
45 {
46 return value->Length();
47 }
48
49 static size_t length(Int8Array* array)
50 {
51 return array->length();
52 }
53 };
54
55 typedef V8TypedArray<Int8Array> V8Int8Array;
56
57 template<>
58 class WrapperTypeTraits<Int8Array> : public TypedArrayWrapperTraits<Int8Array> { };
59
60
61 inline v8::Handle<v8::Object> wrap(Int8Array* impl, v8::Handle<v8::Object> creat ionContext, v8::Isolate* isolate)
62 {
63 return V8TypedArray<Int8Array>::wrap(impl, creationContext, isolate);
64 }
65
66 inline v8::Handle<v8::Value> toV8(Int8Array* impl, v8::Handle<v8::Object> creati onContext, v8::Isolate* isolate)
67 {
68 return V8TypedArray<Int8Array>::toV8(impl, creationContext, isolate);
69 }
70
71 inline v8::Handle<v8::Value> toV8ForMainWorld(Int8Array* impl, v8::Handle<v8::Ob ject> creationContext, v8::Isolate* isolate)
72 {
73 return V8TypedArray<Int8Array>::toV8ForMainWorld(impl, creationContext, isol ate);
74 }
75
76 template<class HolderContainer, class Wrappable>
77 inline v8::Handle<v8::Value> toV8Fast(Int8Array* impl, const HolderContainer& co ntainer, Wrappable* wrappable)
78 {
79 return V8TypedArray<Int8Array>::toV8Fast(impl, container, wrappable);
80 }
81
82 template<class HolderContainer, class Wrappable>
83 inline v8::Handle<v8::Value> toV8FastForMainWorld(Int8Array* impl, const HolderC ontainer& container, Wrappable* wrappable)
84 {
85 return V8TypedArray<Int8Array>::toV8FastForMainWorld(impl, container, wrappa ble);
86 }
87
88 template<class HolderContainer, class Wrappable>
89 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< Int8Array > 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< Int8Array > impl, const Holder Container& container, Wrappable* wrappable)
97 {
98 return toV8Fast(impl.get(), container, wrappable);
99 }
100
101 inline v8::Handle<v8::Value> toV8(PassRefPtr< Int8Array > impl, v8::Handle<v8::O bject> 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