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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "modules/canvas2d/BaseRenderingContext2D.h" 5 #include "modules/canvas2d/BaseRenderingContext2D.h"
6 6
7 #include "bindings/core/v8/ExceptionMessages.h" 7 #include "bindings/core/v8/ExceptionMessages.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 9 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
10 #include "core/css/parser/CSSParser.h" 10 #include "core/css/parser/CSSParser.h"
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 exceptionState.throwRangeError("Out of memory at ImageData creation" ); 1203 exceptionState.throwRangeError("Out of memory at ImageData creation" );
1204 return result; 1204 return result;
1205 } 1205 }
1206 1206
1207 WTF::ArrayBufferContents contents; 1207 WTF::ArrayBufferContents contents;
1208 if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) { 1208 if (!buffer->getImageData(Unmultiplied, imageDataRect, contents)) {
1209 exceptionState.throwRangeError("Out of memory at ImageData creation"); 1209 exceptionState.throwRangeError("Out of memory at ImageData creation");
1210 return nullptr; 1210 return nullptr;
1211 } 1211 }
1212 1212
1213 RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(contents); 1213 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents);
1214 return ImageData::create( 1214 return ImageData::create(
1215 imageDataRect.size(), 1215 imageDataRect.size(),
1216 DOMUint8ClampedArray::create(arrayBuffer, 0, arrayBuffer->byteLength())) ; 1216 DOMUint8ClampedArray::create(arrayBuffer, 0, arrayBuffer->byteLength())) ;
1217 } 1217 }
1218 1218
1219 void BaseRenderingContext2D::putImageData(ImageData* data, double dx, double dy, ExceptionState& exceptionState) 1219 void BaseRenderingContext2D::putImageData(ImageData* data, double dx, double dy, ExceptionState& exceptionState)
1220 { 1220 {
1221 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), exceptionSta te); 1221 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), exceptionSta te);
1222 } 1222 }
1223 1223
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 1366
1367 imageBuffer()->willOverwriteCanvas(); 1367 imageBuffer()->willOverwriteCanvas();
1368 } 1368 }
1369 1369
1370 DEFINE_TRACE(BaseRenderingContext2D) 1370 DEFINE_TRACE(BaseRenderingContext2D)
1371 { 1371 {
1372 visitor->trace(m_stateStack); 1372 visitor->trace(m_stateStack);
1373 } 1373 }
1374 1374
1375 } // namespace blink 1375 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698