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

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

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month 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. 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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if (v8buffer->IsExternal()) { 49 if (v8buffer->IsExternal()) {
50 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); 50 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object);
51 RELEASE_ASSERT(wrapperTypeInfo); 51 RELEASE_ASSERT(wrapperTypeInfo);
52 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); 52 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink);
53 return toScriptWrappable(object)->toImpl<TestArrayBuffer>(); 53 return toScriptWrappable(object)->toImpl<TestArrayBuffer>();
54 } 54 }
55 55
56 // Transfer the ownership of the allocated memory to an ArrayBuffer without 56 // Transfer the ownership of the allocated memory to an ArrayBuffer without
57 // copying. 57 // copying.
58 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); 58 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize();
59 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength() , WTF::ArrayBufferContents::NotShared); 59 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength() , WTF::ArrayBufferContents::NotShared, WTF::ArrayBufferContents::CrashIfOutOfMem ory_DEPRECATED);
60 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents); 60 RefPtr<TestArrayBuffer> buffer = TestArrayBuffer::create(contents);
61 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I solate::GetCurrent(), buffer->wrapperTypeInfo(), object); 61 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I solate::GetCurrent(), buffer->wrapperTypeInfo(), object);
62 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); 62 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object);
63 63
64 return buffer.get(); 64 return buffer.get();
65 } 65 }
66 66
67 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo cal<v8::Value> value) 67 TestArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Lo cal<v8::Value> value)
68 { 68 {
69 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0; 69 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0;
70 } 70 }
71 71
72 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable) 72 void V8ArrayBuffer::refObject(ScriptWrappable* scriptWrappable)
73 { 73 {
74 scriptWrappable->toImpl<TestArrayBuffer>()->ref(); 74 scriptWrappable->toImpl<TestArrayBuffer>()->ref();
75 } 75 }
76 76
77 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable) 77 void V8ArrayBuffer::derefObject(ScriptWrappable* scriptWrappable)
78 { 78 {
79 scriptWrappable->toImpl<TestArrayBuffer>()->deref(); 79 scriptWrappable->toImpl<TestArrayBuffer>()->deref();
80 } 80 }
81 81
82 } // namespace blink 82 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/templates/interface.cpp ('k') | third_party/WebKit/Source/core/dom/DOMArrayBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698