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

Side by Side Diff: cc/layer_tree_host.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo 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
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 18 matching lines...) Expand all
29 #include "cc/thread_proxy.h" 29 #include "cc/thread_proxy.h"
30 #include "cc/top_controls_manager.h" 30 #include "cc/top_controls_manager.h"
31 #include "cc/tree_synchronizer.h" 31 #include "cc/tree_synchronizer.h"
32 32
33 namespace { 33 namespace {
34 static int numLayerTreeInstances; 34 static int numLayerTreeInstances;
35 } 35 }
36 36
37 namespace cc { 37 namespace cc {
38 38
39 bool LayerTreeHost::s_needsFilterContext = false;
40
41 RendererCapabilities::RendererCapabilities() 39 RendererCapabilities::RendererCapabilities()
42 : bestTextureFormat(0) 40 : bestTextureFormat(0)
43 , usingPartialSwap(false) 41 , usingPartialSwap(false)
44 , usingAcceleratedPainting(false) 42 , usingAcceleratedPainting(false)
45 , usingSetVisibility(false) 43 , usingSetVisibility(false)
46 , usingSwapCompleteCallback(false) 44 , usingSwapCompleteCallback(false)
47 , usingGpuMemoryManager(false) 45 , usingGpuMemoryManager(false)
48 , usingDiscardBackbuffer(false) 46 , usingDiscardBackbuffer(false)
49 , usingEglImage(false) 47 , usingEglImage(false)
50 , allowPartialTextureUpdates(false) 48 , allowPartialTextureUpdates(false)
49 , usingOffscreenContext3d(false)
51 , maxTextureSize(0) 50 , maxTextureSize(0)
52 , avoidPow2Textures(false) 51 , avoidPow2Textures(false)
53 { 52 {
54 } 53 }
55 54
56 RendererCapabilities::~RendererCapabilities() 55 RendererCapabilities::~RendererCapabilities()
57 { 56 {
58 } 57 }
59 58
60 bool LayerTreeHost::anyLayerTreeHostInstanceExists() 59 bool LayerTreeHost::anyLayerTreeHostInstanceExists()
61 { 60 {
62 return numLayerTreeInstances > 0; 61 return numLayerTreeInstances > 0;
63 } 62 }
64 63
65 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con st LayerTreeSettings& settings, scoped_ptr<Thread> implThread) 64 scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, con st LayerTreeSettings& settings, scoped_ptr<Thread> implThread)
66 { 65 {
67 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)) ; 66 scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)) ;
68 if (!layerTreeHost->initialize(implThread.Pass())) 67 if (!layerTreeHost->initialize(implThread.Pass()))
69 return scoped_ptr<LayerTreeHost>(); 68 return scoped_ptr<LayerTreeHost>();
70 return layerTreeHost.Pass(); 69 return layerTreeHost.Pass();
71 } 70 }
72 71
73 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting s& settings) 72 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSetting s& settings)
74 : m_animating(false) 73 : m_animating(false)
75 , m_needsFullTreeSync(true) 74 , m_needsFullTreeSync(true)
75 , m_needsFilterContext(false)
76 , m_client(client) 76 , m_client(client)
77 , m_commitNumber(0) 77 , m_commitNumber(0)
78 , m_renderingStats() 78 , m_renderingStats()
79 , m_rendererInitialized(false) 79 , m_rendererInitialized(false)
80 , m_outputSurfaceLost(false) 80 , m_outputSurfaceLost(false)
81 , m_numFailedRecreateAttempts(0) 81 , m_numFailedRecreateAttempts(0)
82 , m_settings(settings) 82 , m_settings(settings)
83 , m_debugState(settings.initialDebugState) 83 , m_debugState(settings.initialDebugState)
84 , m_deviceScaleFactor(1) 84 , m_deviceScaleFactor(1)
85 , m_visible(true) 85 , m_visible(true)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 { 176 {
177 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); 177 TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface");
178 DCHECK(m_outputSurfaceLost); 178 DCHECK(m_outputSurfaceLost);
179 179
180 if (m_proxy->recreateOutputSurface()) { 180 if (m_proxy->recreateOutputSurface()) {
181 m_client->didRecreateOutputSurface(true); 181 m_client->didRecreateOutputSurface(true);
182 m_outputSurfaceLost = false; 182 m_outputSurfaceLost = false;
183 return RecreateSucceeded; 183 return RecreateSucceeded;
184 } 184 }
185 185
186 m_client->willRetryRecreateOutputSurface();
187
186 // Tolerate a certain number of recreation failures to work around races 188 // Tolerate a certain number of recreation failures to work around races
187 // in the output-surface-lost machinery. 189 // in the output-surface-lost machinery.
188 m_numFailedRecreateAttempts++; 190 m_numFailedRecreateAttempts++;
189 if (m_numFailedRecreateAttempts < 5) { 191 if (m_numFailedRecreateAttempts < 5) {
190 // FIXME: The single thread does not self-schedule output surface 192 // FIXME: The single thread does not self-schedule output surface
191 // recreation. So force another recreation attempt to happen by requesti ng 193 // recreation. So force another recreation attempt to happen by requesti ng
192 // another commit. 194 // another commit.
193 if (!m_proxy->hasImplThread()) 195 if (!m_proxy->hasImplThread())
194 setNeedsCommit(); 196 setNeedsCommit();
195 return RecreateFailedButTryAgain; 197 return RecreateFailedButTryAgain;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 879 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
878 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 880 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
879 } 881 }
880 882
881 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() 883 skia::RefPtr<SkPicture> LayerTreeHost::capturePicture()
882 { 884 {
883 return m_proxy->capturePicture(); 885 return m_proxy->capturePicture();
884 } 886 }
885 887
886 } // namespace cc 888 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698