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) |
| 50 , usingOffscreenContext3d(false) |
52 , maxTextureSize(0) | 51 , maxTextureSize(0) |
53 , avoidPow2Textures(false) | 52 , avoidPow2Textures(false) |
54 { | 53 { |
55 } | 54 } |
56 | 55 |
57 RendererCapabilities::~RendererCapabilities() | 56 RendererCapabilities::~RendererCapabilities() |
58 { | 57 { |
59 } | 58 } |
60 | 59 |
61 bool LayerTreeHost::anyLayerTreeHostInstanceExists() | 60 bool LayerTreeHost::anyLayerTreeHostInstanceExists() |
62 { | 61 { |
63 return numLayerTreeInstances > 0; | 62 return numLayerTreeInstances > 0; |
64 } | 63 } |
65 | 64 |
66 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con
st LayerTreeSettings& settings, scoped_ptr<Thread> implThread) | 65 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con
st LayerTreeSettings& settings, scoped_ptr<Thread> implThread) |
67 { | 66 { |
68 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings))
; | 67 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings))
; |
69 if (!layerTreeHost->initialize(implThread.Pass())) | 68 if (!layerTreeHost->initialize(implThread.Pass())) |
70 return scoped_ptr<LayerTreeHost>(); | 69 return scoped_ptr<LayerTreeHost>(); |
71 return layerTreeHost.Pass(); | 70 return layerTreeHost.Pass(); |
72 } | 71 } |
73 | 72 |
74 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
s& settings) | 73 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting
s& settings) |
75 : m_animating(false) | 74 : m_animating(false) |
76 , m_needsFullTreeSync(true) | 75 , m_needsFullTreeSync(true) |
| 76 , m_needsFilterContext(false) |
77 , m_client(client) | 77 , m_client(client) |
78 , m_commitNumber(0) | 78 , m_commitNumber(0) |
79 , m_renderingStats() | 79 , m_renderingStats() |
80 , m_rendererInitialized(false) | 80 , m_rendererInitialized(false) |
81 , m_outputSurfaceLost(false) | 81 , m_outputSurfaceLost(false) |
82 , m_numFailedRecreateAttempts(0) | 82 , m_numFailedRecreateAttempts(0) |
83 , m_settings(settings) | 83 , m_settings(settings) |
84 , m_debugState(settings.initialDebugState) | 84 , m_debugState(settings.initialDebugState) |
85 , m_deviceScaleFactor(1) | 85 , m_deviceScaleFactor(1) |
86 , m_visible(true) | 86 , m_visible(true) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 { | 177 { |
178 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); | 178 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); |
179 DCHECK(m_outputSurfaceLost); | 179 DCHECK(m_outputSurfaceLost); |
180 | 180 |
181 if (m_proxy->recreateOutputSurface()) { | 181 if (m_proxy->recreateOutputSurface()) { |
182 m_client->didRecreateOutputSurface(true); | 182 m_client->didRecreateOutputSurface(true); |
183 m_outputSurfaceLost = false; | 183 m_outputSurfaceLost = false; |
184 return RecreateSucceeded; | 184 return RecreateSucceeded; |
185 } | 185 } |
186 | 186 |
| 187 m_client->willRetryRecreateOutputSurface(); |
| 188 |
187 // Tolerate a certain number of recreation failures to work around races | 189 // Tolerate a certain number of recreation failures to work around races |
188 // in the output-surface-lost machinery. | 190 // in the output-surface-lost machinery. |
189 m_numFailedRecreateAttempts++; | 191 m_numFailedRecreateAttempts++; |
190 if (m_numFailedRecreateAttempts < 5) { | 192 if (m_numFailedRecreateAttempts < 5) { |
191 // FIXME: The single thread does not self-schedule output surface | 193 // FIXME: The single thread does not self-schedule output surface |
192 // recreation. So force another recreation attempt to happen by requesti
ng | 194 // recreation. So force another recreation attempt to happen by requesti
ng |
193 // another commit. | 195 // another commit. |
194 if (!m_proxy->hasImplThread()) | 196 if (!m_proxy->hasImplThread()) |
195 setNeedsCommit(); | 197 setNeedsCommit(); |
196 return RecreateFailedButTryAgain; | 198 return RecreateFailedButTryAgain; |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 880 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
879 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 881 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
880 } | 882 } |
881 | 883 |
882 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() | 884 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() |
883 { | 885 { |
884 return m_proxy->capturePicture(); | 886 return m_proxy->capturePicture(); |
885 } | 887 } |
886 | 888 |
887 } // namespace cc | 889 } // namespace cc |
OLD | NEW |