| 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 "V8ArrayBuffer.h" | 8 #include "V8ArrayBuffer.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/DOMArrayBufferDeallocationObserver.h" | 16 #include "core/dom/DOMArrayBufferDeallocationObserver.h" |
| 16 #include "core/dom/Document.h" | 17 #include "core/dom/Document.h" |
| 17 #include "platform/RuntimeEnabledFeatures.h" | 18 #include "platform/RuntimeEnabledFeatures.h" |
| 18 #include "platform/TraceEvent.h" | 19 #include "platform/TraceEvent.h" |
| 19 #include "wtf/GetPtr.h" | 20 #include "wtf/GetPtr.h" |
| 20 #include "wtf/RefPtr.h" | 21 #include "wtf/RefPtr.h" |
| 21 | 22 |
| 22 namespace blink { | 23 namespace blink { |
| 23 | 24 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 40 if (v8buffer->IsExternal()) { | 41 if (v8buffer->IsExternal()) { |
| 41 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); | 42 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); |
| 42 RELEASE_ASSERT(wrapperTypeInfo); | 43 RELEASE_ASSERT(wrapperTypeInfo); |
| 43 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); | 44 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); |
| 44 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); | 45 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 // Transfer the ownership of the allocated memory to an ArrayBuffer without | 48 // Transfer the ownership of the allocated memory to an ArrayBuffer without |
| 48 // copying. | 49 // copying. |
| 49 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); | 50 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); |
| 50 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, 0); | 51 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, WTF::ArrayBufferContents::NotShared, 0); |
| 51 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); | 52 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); |
| 52 // Since this transfer doesn't allocate new memory, do not call | 53 // Since this transfer doesn't allocate new memory, do not call |
| 53 // DOMArrayBufferDeallocationObserver::blinkAllocatedMemory. | 54 // DOMArrayBufferDeallocationObserver::blinkAllocatedMemory. |
| 54 buffer->buffer()->setDeallocationObserverWithoutAllocationNotification( | 55 buffer->buffer()->setDeallocationObserverWithoutAllocationNotification( |
| 55 DOMArrayBufferDeallocationObserver::instance()); | 56 DOMArrayBufferDeallocationObserver::instance()); |
| 56 buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeI
nfo(), object); | 57 buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeI
nfo(), object); |
| 57 | 58 |
| 58 return buffer.get(); | 59 return buffer.get(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo
cal<v8::Value> value) | 62 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo
cal<v8::Value> value) |
| 62 { | 63 { |
| 63 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; | 64 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : 0; |
| 64 } | 65 } |
| 65 | 66 |
| 66 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) | 67 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) |
| 67 { | 68 { |
| 68 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); | 69 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) | 72 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) |
| 72 { | 73 { |
| 73 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); | 74 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); |
| 74 } | 75 } |
| 75 | 76 |
| 76 } // namespace blink | 77 } // namespace blink |
| OLD | NEW |