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

Side by Side Diff: cc/scrollbar_layer.cc

Issue 12095053: cc: Avoid expensive RenderingStats collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 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
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/skpicture_content_layer_updater.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/scrollbar_layer.h" 5 #include "cc/scrollbar_layer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/caching_bitmap_content_layer_updater.h" 9 #include "cc/caching_bitmap_content_layer_updater.h"
10 #include "cc/layer_painter.h" 10 #include "cc/layer_painter.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (!m_foreTrack) 241 if (!m_foreTrack)
242 m_foreTrack = m_foreTrackUpdater->createResource(layerTreeHost()->co ntentsTextureManager()); 242 m_foreTrack = m_foreTrackUpdater->createResource(layerTreeHost()->co ntentsTextureManager());
243 } 243 }
244 244
245 if (!m_thumbUpdater) 245 if (!m_thumbUpdater)
246 m_thumbUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarThumb Painter::create(m_scrollbar.get(), m_painter.get(), m_geometry.get()).PassAs<Lay erPainter>()); 246 m_thumbUpdater = CachingBitmapContentLayerUpdater::Create(ScrollbarThumb Painter::create(m_scrollbar.get(), m_painter.get(), m_geometry.get()).PassAs<Lay erPainter>());
247 if (!m_thumb) 247 if (!m_thumb)
248 m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextur eManager()); 248 m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextur eManager());
249 } 249 }
250 250
251 void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer Updater::Resource* resource, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats& stats) 251 void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer Updater::Resource* resource, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats* stats)
252 { 252 {
253 // Skip painting and uploading if there are no invalidations and 253 // Skip painting and uploading if there are no invalidations and
254 // we already have valid texture data. 254 // we already have valid texture data.
255 if (resource->texture()->haveBackingTexture() && 255 if (resource->texture()->haveBackingTexture() &&
256 resource->texture()->size() == rect.size() && 256 resource->texture()->size() == rect.size() &&
257 !isDirty()) 257 !isDirty())
258 return; 258 return;
259 259
260 // We should always have enough memory for UI. 260 // We should always have enough memory for UI.
261 DCHECK(resource->texture()->canAcquireBackingTexture()); 261 DCHECK(resource->texture()->canAcquireBackingTexture());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 m_foreTrack->texture()->setDimensions(contentBounds(), m_textureFormat); 304 m_foreTrack->texture()->setDimensions(contentBounds(), m_textureFormat);
305 m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriorit y(drawsToRoot)); 305 m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriorit y(drawsToRoot));
306 } 306 }
307 if (m_thumb) { 307 if (m_thumb) {
308 gfx::Size thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbR ect(m_scrollbar.get())).size(); 308 gfx::Size thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbR ect(m_scrollbar.get())).size();
309 m_thumb->texture()->setDimensions(thumbSize, m_textureFormat); 309 m_thumb->texture()->setDimensions(thumbSize, m_textureFormat);
310 m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(dr awsToRoot)); 310 m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(dr awsToRoot));
311 } 311 }
312 } 312 }
313 313
314 void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats) 314 void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats* stats)
315 { 315 {
316 ContentsScalingLayer::update(queue, occlusion, stats); 316 ContentsScalingLayer::update(queue, occlusion, stats);
317 317
318 m_dirtyRect.Union(m_updateRect); 318 m_dirtyRect.Union(m_updateRect);
319 if (contentBounds().IsEmpty()) 319 if (contentBounds().IsEmpty())
320 return; 320 return;
321 if (visibleContentRect().IsEmpty()) 321 if (visibleContentRect().IsEmpty())
322 return; 322 return;
323 323
324 createUpdaterIfNeeded(); 324 createUpdaterIfNeeded();
325 325
326 gfx::Rect contentRect = scrollbarLayerRectToContentRect(gfx::Rect(m_scrollba r->location(), bounds())); 326 gfx::Rect contentRect = scrollbarLayerRectToContentRect(gfx::Rect(m_scrollba r->location(), bounds()));
327 updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, queue, stats); 327 updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, queue, stats);
328 if (m_foreTrack && m_foreTrackUpdater) 328 if (m_foreTrack && m_foreTrackUpdater)
329 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que ue, stats); 329 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que ue, stats);
330 330
331 // Consider the thumb to be at the origin when painting. 331 // Consider the thumb to be at the origin when painting.
332 gfx::Rect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); 332 gfx::Rect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
333 m_thumbSize = thumbRect.size(); 333 m_thumbSize = thumbRect.size();
334 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(thumbR ect.size())); 334 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(thumbR ect.size()));
335 if (!originThumbRect.IsEmpty()) 335 if (!originThumbRect.IsEmpty())
336 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats); 336 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
337 337
338 m_dirtyRect = gfx::RectF(); 338 m_dirtyRect = gfx::RectF();
339 } 339 }
340 340
341 } // namespace cc 341 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/skpicture_content_layer_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698