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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/V8ArrayBuffer.cpp

Issue 2719883004: Adds support for ArrayBufferContents with external buffer. (Closed)
Patch Set: renames ScopedData -> DataHandle Created 3 years, 9 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
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. 5 // This file has been auto-generated by code_generator_v8.py.
6 // DO NOT MODIFY! 6 // DO NOT MODIFY!
7 7
8 // This file has been generated from the Jinja2 template in 8 // This file has been generated from the Jinja2 template in
9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl 9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (v8buffer->IsExternal()) { 57 if (v8buffer->IsExternal()) {
58 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); 58 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object);
59 CHECK(wrapperTypeInfo); 59 CHECK(wrapperTypeInfo);
60 CHECK_EQ(wrapperTypeInfo->ginEmbedder, gin::kEmbedderBlink); 60 CHECK_EQ(wrapperTypeInfo->ginEmbedder, gin::kEmbedderBlink);
61 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); 61 return toScriptWrappable(object)->toImpl<TestArrayBuffer>();
62 } 62 }
63 63
64 // Transfer the ownership of the allocated memory to an ArrayBuffer without 64 // Transfer the ownership of the allocated memory to an ArrayBuffer without
65 // copying. 65 // copying.
66 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); 66 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize();
67 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), WTF::ArrayBufferContents::NotShared); 67 WTF::ArrayBufferContents::DataHandle data(v8Contents.Data(), WTF::ArrayBufferC ontents::freeMemory);
68 WTF::ArrayBufferContents contents(std::move(data), v8Contents.ByteLength(), WT F::ArrayBufferContents::NotShared);
68 TestArrayBuffer* buffer = TestArrayBuffer::create(contents); 69 TestArrayBuffer* buffer = TestArrayBuffer::create(contents);
69 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::Iso late::GetCurrent(), buffer->wrapperTypeInfo(), object); 70 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::Iso late::GetCurrent(), buffer->wrapperTypeInfo(), object);
70 DCHECK(associatedWrapper == object); 71 DCHECK(associatedWrapper == object);
71 72
72 return buffer; 73 return buffer;
73 } 74 }
74 75
75 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo cal<v8::Value> value) { 76 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo cal<v8::Value> value) {
76 return value->IsArrayBuffer() ? toImpl(v8::Local<v8::Object>::Cast(value)) : n ullptr; 77 return value->IsArrayBuffer() ? toImpl(v8::Local<v8::Object>::Cast(value)) : n ullptr;
77 } 78 }
78 79
79 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698