| 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, | |
| 54 0, 0, 0, 0, 0, 0, | 53 0, 0, 0, 0, 0, 0, |
| 55 WrapperTypeInfo::WrapperTypeObjectPrototype, | 54 WrapperTypeInfo::WrapperTypeObjectPrototype, |
| 56 WrapperTypeInfo::ObjectClassId, | 55 WrapperTypeInfo::ObjectClassId, |
| 57 WrapperTypeInfo::Independent, | 56 WrapperTypeInfo::Independent, |
| 58 WrapperTypeInfo::RefCountedObject | |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) | 59 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) |
| 62 { | 60 { |
| 63 return value->IsArrayBuffer(); | 61 return value->IsArrayBuffer(); |
| 64 } | 62 } |
| 65 | 63 |
| 66 void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) | 64 void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) |
| 67 { | 65 { |
| 68 fromInternalPointer(internalPointer)->ref(); | 66 fromInternalPointer(internalPointer)->ref(); |
| 69 } | 67 } |
| 70 | 68 |
| 71 void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) | 69 void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) |
| 72 { | 70 { |
| 73 fromInternalPointer(internalPointer)->deref(); | 71 fromInternalPointer(internalPointer)->deref(); |
| 74 } | 72 } |
| 75 | 73 |
| 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) | 74 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl
, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 83 { | 75 { |
| 84 ASSERT(impl.get()); | 76 ASSERT(impl.get()); |
| 85 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); | 77 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); |
| 86 | 78 |
| 87 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(),
impl->byteLength()); | 79 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(),
impl->byteLength()); |
| 88 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTem
plate()); | 80 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTem
plate()); |
| 89 | 81 |
| 90 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn
fo, wrapper, isolate); | 82 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn
fo, wrapper, isolate); |
| 91 return wrapper; | 83 return wrapper; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 114 return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toNative(
v8::Handle<v8::Object>::Cast(value)) : 0; | 106 return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toNative(
v8::Handle<v8::Object>::Cast(value)) : 0; |
| 115 } | 107 } |
| 116 | 108 |
| 117 template<> | 109 template<> |
| 118 v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) | 110 v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) |
| 119 { | 111 { |
| 120 return toV8(impl, creationContext, isolate); | 112 return toV8(impl, creationContext, isolate); |
| 121 } | 113 } |
| 122 | 114 |
| 123 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |