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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11748031: cc: remove loseOutputSurface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « cc/layer_tree_host.h ('k') | cc/proxy.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting s& settings) 71 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting s& settings)
72 : m_animating(false) 72 : m_animating(false)
73 , m_needsFullTreeSync(true) 73 , m_needsFullTreeSync(true)
74 , m_client(client) 74 , m_client(client)
75 , m_commitNumber(0) 75 , m_commitNumber(0)
76 , m_renderingStats() 76 , m_renderingStats()
77 , m_rendererInitialized(false) 77 , m_rendererInitialized(false)
78 , m_outputSurfaceLost(false) 78 , m_outputSurfaceLost(false)
79 , m_numTimesRecreateShouldFail(0)
80 , m_numFailedRecreateAttempts(0) 79 , m_numFailedRecreateAttempts(0)
81 , m_settings(settings) 80 , m_settings(settings)
82 , m_debugState(settings.initialDebugState) 81 , m_debugState(settings.initialDebugState)
83 , m_deviceScaleFactor(1) 82 , m_deviceScaleFactor(1)
84 , m_visible(true) 83 , m_visible(true)
85 , m_pageScaleFactor(1) 84 , m_pageScaleFactor(1)
86 , m_minPageScaleFactor(1) 85 , m_minPageScaleFactor(1)
87 , m_maxPageScaleFactor(1) 86 , m_maxPageScaleFactor(1)
88 , m_triggerIdleUpdates(true) 87 , m_triggerIdleUpdates(true)
89 , m_backgroundColor(SK_ColorWHITE) 88 , m_backgroundColor(SK_ColorWHITE)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 std::min(m_settings.defaultTileSize.h eight(), m_proxy->rendererCapabilities().maxTextureSize)); 168 std::min(m_settings.defaultTileSize.h eight(), m_proxy->rendererCapabilities().maxTextureSize));
170 m_settings.maxUntiledLayerSize = gfx::Size(std::min(m_settings.maxUntiledLay erSize.width(), m_proxy->rendererCapabilities().maxTextureSize), 169 m_settings.maxUntiledLayerSize = gfx::Size(std::min(m_settings.maxUntiledLay erSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
171 std::min(m_settings.maxUntiledLay erSize.height(), m_proxy->rendererCapabilities().maxTextureSize)); 170 std::min(m_settings.maxUntiledLay erSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
172 } 171 }
173 172
174 LayerTreeHost::RecreateResult LayerTreeHost::recreateOutputSurface() 173 LayerTreeHost::RecreateResult LayerTreeHost::recreateOutputSurface()
175 { 174 {
176 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); 175 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface");
177 DCHECK(m_outputSurfaceLost); 176 DCHECK(m_outputSurfaceLost);
178 177
179 bool recreated = false; 178 if (m_proxy->recreateOutputSurface()) {
180 if (!m_numTimesRecreateShouldFail)
181 recreated = m_proxy->recreateOutputSurface();
182 else
183 m_numTimesRecreateShouldFail--;
184
185 if (recreated) {
186 m_client->didRecreateOutputSurface(true); 179 m_client->didRecreateOutputSurface(true);
187 m_outputSurfaceLost = false; 180 m_outputSurfaceLost = false;
188 return RecreateSucceeded; 181 return RecreateSucceeded;
189 } 182 }
190 183
191 // Tolerate a certain number of recreation failures to work around races 184 // Tolerate a certain number of recreation failures to work around races
192 // in the output-surface-lost machinery. 185 // in the output-surface-lost machinery.
193 m_numFailedRecreateAttempts++; 186 m_numFailedRecreateAttempts++;
194 if (m_numFailedRecreateAttempts < 5) { 187 if (m_numFailedRecreateAttempts < 5) {
195 // FIXME: The single thread does not self-schedule output surface 188 // FIXME: The single thread does not self-schedule output surface
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 return; 515 return;
523 m_visible = visible; 516 m_visible = visible;
524 m_proxy->setVisible(visible); 517 m_proxy->setVisible(visible);
525 } 518 }
526 519
527 void LayerTreeHost::startPageScaleAnimation(gfx::Vector2d targetOffset, bool use Anchor, float scale, base::TimeDelta duration) 520 void LayerTreeHost::startPageScaleAnimation(gfx::Vector2d targetOffset, bool use Anchor, float scale, base::TimeDelta duration)
528 { 521 {
529 m_proxy->startPageScaleAnimation(targetOffset, useAnchor, scale, duration); 522 m_proxy->startPageScaleAnimation(targetOffset, useAnchor, scale, duration);
530 } 523 }
531 524
532 void LayerTreeHost::loseOutputSurface(int numTimes)
533 {
534 TRACE_EVENT1("cc", "LayerTreeHost::loseCompositorOutputSurface", "numTimes", numTimes);
535 m_numTimesRecreateShouldFail = numTimes - 1;
536 m_proxy->loseOutputSurface();
537 }
538
539 PrioritizedResourceManager* LayerTreeHost::contentsTextureManager() const 525 PrioritizedResourceManager* LayerTreeHost::contentsTextureManager() const
540 { 526 {
541 return m_contentsTextureManager.get(); 527 return m_contentsTextureManager.get();
542 } 528 }
543 529
544 void LayerTreeHost::composite() 530 void LayerTreeHost::composite()
545 { 531 {
546 if (!m_proxy->hasImplThread()) 532 if (!m_proxy->hasImplThread())
547 static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately(); 533 static_cast<SingleThreadProxy*>(m_proxy.get())->compositeImmediately();
548 else 534 else
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 else 878 else
893 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 879 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
894 } 880 }
895 } 881 }
896 882
897 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 883 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
898 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 884 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
899 } 885 }
900 886
901 } // namespace cc 887 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698