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

Side by Side Diff: cc/content_layer.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/content_layer.h" 7 #include "cc/content_layer.h"
8 8
9 #include "CCLayerTreeHost.h" 9 #include "CCLayerTreeHost.h"
10 #include "CCSettings.h" 10 #include "CCSettings.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "cc/bitmap_canvas_layer_texture_updater.h" 12 #include "cc/bitmap_canvas_layer_texture_updater.h"
13 #include "cc/bitmap_skpicture_canvas_layer_texture_updater.h" 13 #include "cc/bitmap_skpicture_canvas_layer_texture_updater.h"
14 #include "cc/content_layer_client.h" 14 #include "cc/content_layer_client.h"
15 #include "cc/frame_buffer_skpicture_canvas_layer_texture_updater.h" 15 #include "cc/frame_buffer_skpicture_canvas_layer_texture_updater.h"
16 #include "cc/layer_painter.h" 16 #include "cc/layer_painter.h"
17 #include <public/Platform.h> 17 #include <public/Platform.h>
18 18
19 namespace cc { 19 namespace cc {
20 20
21 ContentLayerPainter::ContentLayerPainter(ContentLayerChromiumClient* client) 21 ContentLayerPainter::ContentLayerPainter(ContentLayerClient* client)
22 : m_client(client) 22 : m_client(client)
23 { 23 {
24 } 24 }
25 25
26 scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerChromium Client* client) 26 scoped_ptr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerClient* client)
27 { 27 {
28 return make_scoped_ptr(new ContentLayerPainter(client)); 28 return make_scoped_ptr(new ContentLayerPainter(client));
29 } 29 }
30 30
31 void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, Fl oatRect& opaque) 31 void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, Fl oatRect& opaque)
32 { 32 {
33 base::TimeTicks paintStart = base::TimeTicks::HighResNow(); 33 base::TimeTicks paintStart = base::TimeTicks::HighResNow();
34 m_client->paintContents(canvas, contentRect, opaque); 34 m_client->paintContents(canvas, contentRect, opaque);
35 base::TimeTicks paintEnd = base::TimeTicks::HighResNow(); 35 base::TimeTicks paintEnd = base::TimeTicks::HighResNow();
36 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintE nd - paintStart).InSecondsF(); 36 double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintE nd - paintStart).InSecondsF();
37 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPa intDurationMS", (paintEnd - paintStart).InMillisecondsF(), 0, 120, 30); 37 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPa intDurationMS", (paintEnd - paintStart).InMillisecondsF(), 0, 120, 30);
38 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPa intMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); 38 WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPa intMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
39 } 39 }
40 40
41 scoped_refptr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChr omiumClient* client) 41 scoped_refptr<ContentLayer> ContentLayer::create(ContentLayerClient* client)
42 { 42 {
43 return make_scoped_refptr(new ContentLayerChromium(client)); 43 return make_scoped_refptr(new ContentLayer(client));
44 } 44 }
45 45
46 ContentLayerChromium::ContentLayerChromium(ContentLayerChromiumClient* client) 46 ContentLayer::ContentLayer(ContentLayerClient* client)
47 : TiledLayerChromium() 47 : TiledLayer()
48 , m_client(client) 48 , m_client(client)
49 { 49 {
50 } 50 }
51 51
52 ContentLayerChromium::~ContentLayerChromium() 52 ContentLayer::~ContentLayer()
53 { 53 {
54 } 54 }
55 55
56 bool ContentLayerChromium::drawsContent() const 56 bool ContentLayer::drawsContent() const
57 { 57 {
58 return TiledLayerChromium::drawsContent() && m_client; 58 return TiledLayer::drawsContent() && m_client;
59 } 59 }
60 60
61 void ContentLayerChromium::setTexturePriorities(const CCPriorityCalculator& prio rityCalc) 61 void ContentLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
62 { 62 {
63 // Update the tile data before creating all the layer's tiles. 63 // Update the tile data before creating all the layer's tiles.
64 updateTileSizeAndTilingOption(); 64 updateTileSizeAndTilingOption();
65 65
66 TiledLayerChromium::setTexturePriorities(priorityCalc); 66 TiledLayer::setTexturePriorities(priorityCalc);
67 } 67 }
68 68
69 void ContentLayerChromium::update(CCTextureUpdateQueue& queue, const CCOcclusion Tracker* occlusion, CCRenderingStats& stats) 69 void ContentLayer::update(TextureUpdateQueue& queue, const OcclusionTracker* occ lusion, RenderingStats& stats)
70 { 70 {
71 createTextureUpdaterIfNeeded(); 71 createTextureUpdaterIfNeeded();
72 TiledLayerChromium::update(queue, occlusion, stats); 72 TiledLayer::update(queue, occlusion, stats);
73 m_needsDisplay = false; 73 m_needsDisplay = false;
74 } 74 }
75 75
76 bool ContentLayerChromium::needMoreUpdates() 76 bool ContentLayer::needMoreUpdates()
77 { 77 {
78 return needsIdlePaint(); 78 return needsIdlePaint();
79 } 79 }
80 80
81 LayerTextureUpdater* ContentLayerChromium::textureUpdater() const 81 LayerTextureUpdater* ContentLayer::textureUpdater() const
82 { 82 {
83 return m_textureUpdater.get(); 83 return m_textureUpdater.get();
84 } 84 }
85 85
86 void ContentLayerChromium::createTextureUpdaterIfNeeded() 86 void ContentLayer::createTextureUpdaterIfNeeded()
87 { 87 {
88 if (m_textureUpdater) 88 if (m_textureUpdater)
89 return; 89 return;
90 scoped_ptr<LayerPainterChromium> painter = ContentLayerPainter::create(m_cli ent).PassAs<LayerPainterChromium>(); 90 scoped_ptr<LayerPainter> painter = ContentLayerPainter::create(m_client).Pas sAs<LayerPainter>();
91 if (layerTreeHost()->settings().acceleratePainting) 91 if (layerTreeHost()->settings().acceleratePainting)
92 m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create (painter.Pass()); 92 m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create (painter.Pass());
93 else if (CCSettings::perTilePaintingEnabled()) 93 else if (Settings::perTilePaintingEnabled())
94 m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(pain ter.Pass()); 94 m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(pain ter.Pass());
95 else 95 else
96 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(painter.Pass( )); 96 m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(painter.Pass( ));
97 m_textureUpdater->setOpaque(contentsOpaque()); 97 m_textureUpdater->setOpaque(contentsOpaque());
98 98
99 GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTexture Format; 99 GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTexture Format;
100 setTextureFormat(textureFormat); 100 setTextureFormat(textureFormat);
101 setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); 101 setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat));
102 } 102 }
103 103
104 void ContentLayerChromium::setContentsOpaque(bool opaque) 104 void ContentLayer::setContentsOpaque(bool opaque)
105 { 105 {
106 LayerChromium::setContentsOpaque(opaque); 106 Layer::setContentsOpaque(opaque);
107 if (m_textureUpdater) 107 if (m_textureUpdater)
108 m_textureUpdater->setOpaque(opaque); 108 m_textureUpdater->setOpaque(opaque);
109 } 109 }
110 110
111 } 111 }
OLDNEW
« cc/active_animation.h ('K') | « cc/content_layer.h ('k') | cc/content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698