OLD | NEW |
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 19 matching lines...) Expand all Loading... |
30 #include "cc/thread_proxy.h" | 30 #include "cc/thread_proxy.h" |
31 #include "cc/top_controls_manager.h" | 31 #include "cc/top_controls_manager.h" |
32 #include "cc/tree_synchronizer.h" | 32 #include "cc/tree_synchronizer.h" |
33 | 33 |
34 namespace { | 34 namespace { |
35 static int numLayerTreeInstances; | 35 static int numLayerTreeInstances; |
36 } | 36 } |
37 | 37 |
38 namespace cc { | 38 namespace cc { |
39 | 39 |
40 bool LayerTreeHost::s_needsFilterContext = false; | |
41 | |
42 RendererCapabilities::RendererCapabilities() | 40 RendererCapabilities::RendererCapabilities() |
43 : bestTextureFormat(0) | 41 : bestTextureFormat(0) |
44 , usingPartialSwap(false) | 42 , usingPartialSwap(false) |
45 , usingAcceleratedPainting(false) | 43 , usingAcceleratedPainting(false) |
46 , usingSetVisibility(false) | 44 , usingSetVisibility(false) |
47 , usingSwapCompleteCallback(false) | 45 , usingSwapCompleteCallback(false) |
48 , usingGpuMemoryManager(false) | 46 , usingGpuMemoryManager(false) |
49 , usingDiscardBackbuffer(false) | 47 , usingDiscardBackbuffer(false) |
50 , usingEglImage(false) | 48 , usingEglImage(false) |
51 , allowPartialTextureUpdates(false) | 49 , allowPartialTextureUpdates(false) |
(...skipping 14 matching lines...) Expand all Loading... |
66 { | 64 { |
67 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings))
; | 65 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings))
; |
68 if (!layerTreeHost->initialize(implThread.Pass())) | 66 if (!layerTreeHost->initialize(implThread.Pass())) |
69 return scoped_ptr<LayerTreeHost>(); | 67 return scoped_ptr<LayerTreeHost>(); |
70 return layerTreeHost.Pass(); | 68 return layerTreeHost.Pass(); |
71 } | 69 } |
72 | 70 |
73 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
s& settings) | 71 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
s& settings) |
74 : m_animating(false) | 72 : m_animating(false) |
75 , m_needsFullTreeSync(true) | 73 , m_needsFullTreeSync(true) |
| 74 , m_needsFilterContext(false) |
76 , m_client(client) | 75 , m_client(client) |
77 , m_commitNumber(0) | 76 , m_commitNumber(0) |
78 , m_renderingStats() | 77 , m_renderingStats() |
79 , m_rendererInitialized(false) | 78 , m_rendererInitialized(false) |
80 , m_outputSurfaceLost(false) | 79 , m_outputSurfaceLost(false) |
81 , m_numFailedRecreateAttempts(0) | 80 , m_numFailedRecreateAttempts(0) |
82 , m_settings(settings) | 81 , m_settings(settings) |
83 , m_debugState(settings.initialDebugState) | 82 , m_debugState(settings.initialDebugState) |
84 , m_deviceScaleFactor(1) | 83 , m_deviceScaleFactor(1) |
85 , m_visible(true) | 84 , m_visible(true) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 { | 175 { |
177 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); | 176 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); |
178 DCHECK(m_outputSurfaceLost); | 177 DCHECK(m_outputSurfaceLost); |
179 | 178 |
180 if (m_proxy->recreateOutputSurface()) { | 179 if (m_proxy->recreateOutputSurface()) { |
181 m_client->didRecreateOutputSurface(true); | 180 m_client->didRecreateOutputSurface(true); |
182 m_outputSurfaceLost = false; | 181 m_outputSurfaceLost = false; |
183 return RecreateSucceeded; | 182 return RecreateSucceeded; |
184 } | 183 } |
185 | 184 |
| 185 m_client->willRetryRecreateOutputSurface(); |
| 186 |
186 // Tolerate a certain number of recreation failures to work around races | 187 // Tolerate a certain number of recreation failures to work around races |
187 // in the output-surface-lost machinery. | 188 // in the output-surface-lost machinery. |
188 m_numFailedRecreateAttempts++; | 189 m_numFailedRecreateAttempts++; |
189 if (m_numFailedRecreateAttempts < 5) { | 190 if (m_numFailedRecreateAttempts < 5) { |
190 // FIXME: The single thread does not self-schedule output surface | 191 // FIXME: The single thread does not self-schedule output surface |
191 // recreation. So force another recreation attempt to happen by requesti
ng | 192 // recreation. So force another recreation attempt to happen by requesti
ng |
192 // another commit. | 193 // another commit. |
193 if (!m_proxy->hasImplThread()) | 194 if (!m_proxy->hasImplThread()) |
194 setNeedsCommit(); | 195 setNeedsCommit(); |
195 return RecreateFailedButTryAgain; | 196 return RecreateFailedButTryAgain; |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 869 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
869 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 870 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
870 } | 871 } |
871 | 872 |
872 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 873 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
873 { | 874 { |
874 return m_proxy->capturePicture(); | 875 return m_proxy->capturePicture(); |
875 } | 876 } |
876 | 877 |
877 } // namespace cc | 878 } // namespace cc |
OLD | NEW |