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

Side by Side Diff: cc/layers/tiled_layer_unittest.cc

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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
« no previous file with comments | « cc/layers/tiled_layer_impl.h ('k') | cc/layers/ui_resource_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layers/tiled_layer.h" 5 #include "cc/layers/tiled_layer.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 public: 50 public:
51 static scoped_ptr<SynchronousOutputSurfaceLayerTreeHost> Create( 51 static scoped_ptr<SynchronousOutputSurfaceLayerTreeHost> Create(
52 LayerTreeHostClient* client, 52 LayerTreeHostClient* client,
53 SharedBitmapManager* manager, 53 SharedBitmapManager* manager,
54 const LayerTreeSettings& settings, 54 const LayerTreeSettings& settings,
55 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 55 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
56 return make_scoped_ptr(new SynchronousOutputSurfaceLayerTreeHost( 56 return make_scoped_ptr(new SynchronousOutputSurfaceLayerTreeHost(
57 client, manager, settings, impl_task_runner)); 57 client, manager, settings, impl_task_runner));
58 } 58 }
59 59
60 virtual ~SynchronousOutputSurfaceLayerTreeHost() {} 60 ~SynchronousOutputSurfaceLayerTreeHost() override {}
61 61
62 bool EnsureOutputSurfaceCreated() { 62 bool EnsureOutputSurfaceCreated() {
63 base::MessageLoop::current()->PostDelayedTask( 63 base::MessageLoop::current()->PostDelayedTask(
64 FROM_HERE, 64 FROM_HERE,
65 run_loop_.QuitClosure(), 65 run_loop_.QuitClosure(),
66 base::TimeDelta::FromSeconds(5)); 66 base::TimeDelta::FromSeconds(5));
67 run_loop_.Run(); 67 run_loop_.Run();
68 return output_surface_created_; 68 return output_surface_created_;
69 } 69 }
70 70
71 virtual void OnCreateAndInitializeOutputSurfaceAttempted( 71 void OnCreateAndInitializeOutputSurfaceAttempted(bool success) override {
72 bool success) override {
73 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(success); 72 LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(success);
74 output_surface_created_ = success; 73 output_surface_created_ = success;
75 run_loop_.Quit(); 74 run_loop_.Quit();
76 } 75 }
77 76
78 private: 77 private:
79 SynchronousOutputSurfaceLayerTreeHost( 78 SynchronousOutputSurfaceLayerTreeHost(
80 LayerTreeHostClient* client, 79 LayerTreeHostClient* client,
81 SharedBitmapManager* manager, 80 SharedBitmapManager* manager,
82 const LayerTreeSettings& settings, 81 const LayerTreeSettings& settings,
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 resource_provider_.get()); 1641 resource_provider_.get());
1643 layer_tree_host_->SetRootLayer(nullptr); 1642 layer_tree_host_->SetRootLayer(nullptr);
1644 } 1643 }
1645 1644
1646 class TrackingLayerPainter : public LayerPainter { 1645 class TrackingLayerPainter : public LayerPainter {
1647 public: 1646 public:
1648 static scoped_ptr<TrackingLayerPainter> Create() { 1647 static scoped_ptr<TrackingLayerPainter> Create() {
1649 return make_scoped_ptr(new TrackingLayerPainter()); 1648 return make_scoped_ptr(new TrackingLayerPainter());
1650 } 1649 }
1651 1650
1652 virtual void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override { 1651 void Paint(SkCanvas* canvas, const gfx::Rect& content_rect) override {
1653 painted_rect_ = content_rect; 1652 painted_rect_ = content_rect;
1654 } 1653 }
1655 1654
1656 gfx::Rect PaintedRect() const { return painted_rect_; } 1655 gfx::Rect PaintedRect() const { return painted_rect_; }
1657 void ResetPaintedRect() { painted_rect_ = gfx::Rect(); } 1656 void ResetPaintedRect() { painted_rect_ = gfx::Rect(); }
1658 1657
1659 private: 1658 private:
1660 gfx::Rect painted_rect_; 1659 gfx::Rect painted_rect_;
1661 }; 1660 };
1662 1661
1663 class UpdateTrackingTiledLayer : public FakeTiledLayer { 1662 class UpdateTrackingTiledLayer : public FakeTiledLayer {
1664 public: 1663 public:
1665 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) 1664 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager)
1666 : FakeTiledLayer(manager) { 1665 : FakeTiledLayer(manager) {
1667 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); 1666 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create());
1668 tracking_layer_painter_ = painter.get(); 1667 tracking_layer_painter_ = painter.get();
1669 layer_updater_ = BitmapContentLayerUpdater::Create( 1668 layer_updater_ = BitmapContentLayerUpdater::Create(
1670 painter.Pass(), &stats_instrumentation_, 0); 1669 painter.Pass(), &stats_instrumentation_, 0);
1671 } 1670 }
1672 1671
1673 TrackingLayerPainter* tracking_layer_painter() const { 1672 TrackingLayerPainter* tracking_layer_painter() const {
1674 return tracking_layer_painter_; 1673 return tracking_layer_painter_;
1675 } 1674 }
1676 1675
1677 private: 1676 private:
1678 virtual LayerUpdater* Updater() const override { 1677 LayerUpdater* Updater() const override { return layer_updater_.get(); }
1679 return layer_updater_.get(); 1678 ~UpdateTrackingTiledLayer() override {}
1680 }
1681 virtual ~UpdateTrackingTiledLayer() {}
1682 1679
1683 TrackingLayerPainter* tracking_layer_painter_; 1680 TrackingLayerPainter* tracking_layer_painter_;
1684 scoped_refptr<BitmapContentLayerUpdater> layer_updater_; 1681 scoped_refptr<BitmapContentLayerUpdater> layer_updater_;
1685 FakeRenderingStatsInstrumentation stats_instrumentation_; 1682 FakeRenderingStatsInstrumentation stats_instrumentation_;
1686 }; 1683 };
1687 1684
1688 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { 1685 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
1689 scoped_refptr<UpdateTrackingTiledLayer> layer = 1686 scoped_refptr<UpdateTrackingTiledLayer> layer =
1690 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); 1687 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get()));
1691 1688
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 1755
1759 // Rounding leads to an extra pixel. 1756 // Rounding leads to an extra pixel.
1760 gfx::Rect expanded_layer_rect(layer_rect); 1757 gfx::Rect expanded_layer_rect(layer_rect);
1761 expanded_layer_rect.set_height(32); 1758 expanded_layer_rect.set_height(32);
1762 EXPECT_RECT_EQ(expanded_layer_rect, 1759 EXPECT_RECT_EQ(expanded_layer_rect,
1763 layer->tracking_layer_painter()->PaintedRect()); 1760 layer->tracking_layer_painter()->PaintedRect());
1764 } 1761 }
1765 1762
1766 } // namespace 1763 } // namespace
1767 } // namespace cc 1764 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer_impl.h ('k') | cc/layers/ui_resource_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698