OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 { | 43 { |
44 DEFINE_STATIC_LOCAL(V8ArrayBufferDeallocationObserver, deallocationObserver,
()); | 44 DEFINE_STATIC_LOCAL(V8ArrayBufferDeallocationObserver, deallocationObserver,
()); |
45 return &deallocationObserver; | 45 return &deallocationObserver; |
46 } | 46 } |
47 | 47 |
48 const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { | 48 const WrapperTypeInfo V8ArrayBuffer::wrapperTypeInfo = { |
49 gin::kEmbedderBlink, | 49 gin::kEmbedderBlink, |
50 0, | 50 0, |
51 V8ArrayBuffer::refObject, | 51 V8ArrayBuffer::refObject, |
52 V8ArrayBuffer::derefObject, | 52 V8ArrayBuffer::derefObject, |
53 V8ArrayBuffer::createPersistentHandle, | 53 V8ArrayBuffer::trace, |
54 0, 0, 0, 0, 0, 0, | 54 0, 0, 0, 0, 0, 0, |
55 WrapperTypeInfo::WrapperTypeObjectPrototype, | 55 WrapperTypeInfo::WrapperTypeObjectPrototype, |
56 WrapperTypeInfo::ObjectClassId, | 56 WrapperTypeInfo::ObjectClassId, |
57 WrapperTypeInfo::Independent, | 57 WrapperTypeInfo::Independent, |
58 WrapperTypeInfo::RefCountedObject | 58 WrapperTypeInfo::RefCountedObject |
59 }; | 59 }; |
60 | 60 |
61 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) | 61 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) |
62 { | 62 { |
63 return value->IsArrayBuffer(); | 63 return value->IsArrayBuffer(); |
64 } | 64 } |
65 | 65 |
66 void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) | 66 void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) |
67 { | 67 { |
68 toImpl(internalPointer)->ref(); | 68 toImpl(internalPointer)->ref(); |
69 } | 69 } |
70 | 70 |
71 void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) | 71 void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) |
72 { | 72 { |
73 toImpl(internalPointer)->deref(); | 73 toImpl(internalPointer)->deref(); |
74 } | 74 } |
75 | 75 |
76 WrapperPersistentNode* V8ArrayBuffer::createPersistentHandle(ScriptWrappableBase
* internalPointer) | |
77 { | |
78 ASSERT_NOT_REACHED(); | |
79 return 0; | |
80 } | |
81 | |
82 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl
, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 76 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl
, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
83 { | 77 { |
84 ASSERT(impl.get()); | 78 ASSERT(impl.get()); |
85 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); | 79 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); |
86 | 80 |
87 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(),
impl->byteLength()); | 81 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(),
impl->byteLength()); |
88 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTem
plate()); | 82 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTem
plate()); |
89 | 83 |
90 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn
fo, wrapper, isolate); | 84 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn
fo, wrapper, isolate); |
91 return wrapper; | 85 return wrapper; |
(...skipping 22 matching lines...) Expand all Loading... |
114 return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toImpl(v8
::Handle<v8::Object>::Cast(value)) : 0; | 108 return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toImpl(v8
::Handle<v8::Object>::Cast(value)) : 0; |
115 } | 109 } |
116 | 110 |
117 template<> | 111 template<> |
118 v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) | 112 v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) |
119 { | 113 { |
120 return toV8(impl, creationContext, isolate); | 114 return toV8(impl, creationContext, isolate); |
121 } | 115 } |
122 | 116 |
123 } // namespace blink | 117 } // namespace blink |
OLD | NEW |