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

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

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 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 #include "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/fetch/MemoryCache.h" 8 #include "core/fetch/MemoryCache.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/ImageBitmap.h" 10 #include "core/frame/ImageBitmap.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 NonThrowableExceptionState exceptionState; 582 NonThrowableExceptionState exceptionState;
583 Element* sourceCanvasElement = 583 Element* sourceCanvasElement =
584 document().createElement("canvas", exceptionState); 584 document().createElement("canvas", exceptionState);
585 EXPECT_FALSE(exceptionState.hadException()); 585 EXPECT_FALSE(exceptionState.hadException());
586 HTMLCanvasElement* sourceCanvas = 586 HTMLCanvasElement* sourceCanvas =
587 static_cast<HTMLCanvasElement*>(sourceCanvasElement); 587 static_cast<HTMLCanvasElement*>(sourceCanvasElement);
588 IntSize sourceSize( 588 IntSize sourceSize(
589 10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio); 589 10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio);
590 std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface = 590 std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface =
591 wrapUnique(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); 591 makeUnique<UnacceleratedImageBufferSurface>(sourceSize, NonOpaque);
592 sourceCanvas->createImageBufferUsingSurfaceForTesting( 592 sourceCanvas->createImageBufferUsingSurfaceForTesting(
593 std::move(sourceSurface)); 593 std::move(sourceSurface));
594 594
595 const ImageBitmapOptions defaultOptions; 595 const ImageBitmapOptions defaultOptions;
596 Optional<IntRect> cropRect = IntRect(IntPoint(0, 0), sourceSize); 596 Optional<IntRect> cropRect = IntRect(IntPoint(0, 0), sourceSize);
597 // Go through an ImageBitmap to avoid triggering a display list fallback 597 // Go through an ImageBitmap to avoid triggering a display list fallback
598 ImageBitmap* sourceImageBitmap = 598 ImageBitmap* sourceImageBitmap =
599 ImageBitmap::create(sourceCanvas, cropRect, defaultOptions); 599 ImageBitmap::create(sourceCanvas, cropRect, defaultOptions);
600 600
601 context2d()->drawImage(canvasElement().getExecutionContext(), 601 context2d()->drawImage(canvasElement().getExecutionContext(),
(...skipping 15 matching lines...) Expand all
617 617
618 NonThrowableExceptionState exceptionState; 618 NonThrowableExceptionState exceptionState;
619 Element* sourceCanvasElement = 619 Element* sourceCanvasElement =
620 document().createElement("canvas", exceptionState); 620 document().createElement("canvas", exceptionState);
621 EXPECT_FALSE(exceptionState.hadException()); 621 EXPECT_FALSE(exceptionState.hadException());
622 HTMLCanvasElement* sourceCanvas = 622 HTMLCanvasElement* sourceCanvas =
623 static_cast<HTMLCanvasElement*>(sourceCanvasElement); 623 static_cast<HTMLCanvasElement*>(sourceCanvasElement);
624 IntSize sourceSize( 624 IntSize sourceSize(
625 10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio + 1); 625 10, 10 * ExpensiveCanvasHeuristicParameters::ExpensiveImageSizeRatio + 1);
626 std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface = 626 std::unique_ptr<UnacceleratedImageBufferSurface> sourceSurface =
627 wrapUnique(new UnacceleratedImageBufferSurface(sourceSize, NonOpaque)); 627 makeUnique<UnacceleratedImageBufferSurface>(sourceSize, NonOpaque);
628 sourceCanvas->createImageBufferUsingSurfaceForTesting( 628 sourceCanvas->createImageBufferUsingSurfaceForTesting(
629 std::move(sourceSurface)); 629 std::move(sourceSurface));
630 630
631 const ImageBitmapOptions defaultOptions; 631 const ImageBitmapOptions defaultOptions;
632 Optional<IntRect> cropRect = IntRect(IntPoint(0, 0), sourceSize); 632 Optional<IntRect> cropRect = IntRect(IntPoint(0, 0), sourceSize);
633 // Go through an ImageBitmap to avoid triggering a display list fallback 633 // Go through an ImageBitmap to avoid triggering a display list fallback
634 ImageBitmap* sourceImageBitmap = 634 ImageBitmap* sourceImageBitmap =
635 ImageBitmap::create(sourceCanvas, cropRect, defaultOptions); 635 ImageBitmap::create(sourceCanvas, cropRect, defaultOptions);
636 636
637 context2d()->drawImage(canvasElement().getExecutionContext(), 637 context2d()->drawImage(canvasElement().getExecutionContext(),
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 EXPECT_FALSE(canvasElement().buffer()->isAccelerated()); 1165 EXPECT_FALSE(canvasElement().buffer()->isAccelerated());
1166 1166
1167 context->fillRect(10, 10, 100, 100); 1167 context->fillRect(10, 10, 100, 100);
1168 1168
1169 EXPECT_EQ(0, getCurrentGPUMemoryUsage()); 1169 EXPECT_EQ(0, getCurrentGPUMemoryUsage());
1170 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); 1170 EXPECT_EQ(0, getGlobalGPUMemoryUsage());
1171 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount()); 1171 EXPECT_EQ(0u, getGlobalAcceleratedImageBufferCount());
1172 } 1172 }
1173 1173
1174 } // namespace blink 1174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698