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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11886091: cc: Fix resource eviction with impl-side painting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix enforceManagedMemoryPolicy. It's possible we have pending tree when this is called. Created 7 years, 11 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 | « no previous file | cc/layer_tree_host_impl.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/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 // This function commits the LayerTreeHost to an impl tree. When modifying 248 // This function commits the LayerTreeHost to an impl tree. When modifying
249 // this function, keep in mind that the function *runs* on the impl thread! Any 249 // this function, keep in mind that the function *runs* on the impl thread! Any
250 // code that is logically a main thread operation, e.g. deletion of a Layer, 250 // code that is logically a main thread operation, e.g. deletion of a Layer,
251 // should be delayed until the LayerTreeHost::commitComplete, which will run 251 // should be delayed until the LayerTreeHost::commitComplete, which will run
252 // after the commit, but on the main thread. 252 // after the commit, but on the main thread.
253 void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) 253 void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
254 { 254 {
255 DCHECK(m_proxy->isImplThread()); 255 DCHECK(m_proxy->isImplThread());
256 256
257 // If there are linked evicted backings, these backings' resources may be pu t into the
258 // impl tree, so we can't draw yet. Determine this before clearing all evict ed backings.
259 bool newImplTreeHasNoEvictedResources = !m_contentsTextureManager->linkedEvi ctedBackingsExist();
260
257 m_contentsTextureManager->updateBackingsInDrawingImplTree(); 261 m_contentsTextureManager->updateBackingsInDrawingImplTree();
258 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); 262 m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider());
259 263
260 // In impl-side painting, synchronize to the pending tree so that it has 264 // In impl-side painting, synchronize to the pending tree so that it has
261 // time to raster before being displayed. If no pending tree is needed, 265 // time to raster before being displayed. If no pending tree is needed,
262 // synchronization can happen directly to the active tree. 266 // synchronization can happen directly to the active tree.
263 LayerTreeImpl* syncTree; 267 LayerTreeImpl* syncTree;
264 bool needsFullTreeSync = false; 268 bool needsFullTreeSync = false;
265 if (m_settings.implSidePainting) { 269 if (m_settings.implSidePainting) {
266 // Commits should not occur while there is already a pending tree. 270 // Commits should not occur while there is already a pending tree.
(...skipping 26 matching lines...) Expand all
293 syncTree->set_source_frame_number(commitNumber()); 297 syncTree->set_source_frame_number(commitNumber());
294 syncTree->set_background_color(m_backgroundColor); 298 syncTree->set_background_color(m_backgroundColor);
295 syncTree->set_has_transparent_background(m_hasTransparentBackground); 299 syncTree->set_has_transparent_background(m_hasTransparentBackground);
296 300
297 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); 301 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize());
298 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); 302 hostImpl->setDeviceScaleFactor(deviceScaleFactor());
299 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); 303 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor);
300 hostImpl->setDebugState(m_debugState); 304 hostImpl->setDebugState(m_debugState);
301 hostImpl->savePaintTime(m_renderingStats.totalPaintTime); 305 hostImpl->savePaintTime(m_renderingStats.totalPaintTime);
302 306
307 if (newImplTreeHasNoEvictedResources) {
308 if (syncTree->ContentsTexturesPurged())
309 syncTree->ResetContentsTexturesPurged();
310 }
311
303 m_commitNumber++; 312 m_commitNumber++;
304 } 313 }
305 314
306 void LayerTreeHost::willCommit() 315 void LayerTreeHost::willCommit()
307 { 316 {
308 m_client->willCommit(); 317 m_client->willCommit();
309 318
310 if (m_debugState.showHudInfo()) { 319 if (m_debugState.showHudInfo()) {
311 if (!m_hudLayer) 320 if (!m_hudLayer)
312 m_hudLayer = HeadsUpDisplayLayer::create(); 321 m_hudLayer = HeadsUpDisplayLayer::create();
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 870 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
862 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 871 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
863 } 872 }
864 873
865 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() 874 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture()
866 { 875 {
867 return m_proxy->capturePicture(); 876 return m_proxy->capturePicture();
868 } 877 }
869 878
870 } // namespace cc 879 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698