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

Side by Side Diff: cc/layer_tree_host.h

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply code review comments Created 8 years, 1 month 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
« no previous file with comments | « cc/layer_sorter_unittest.cc ('k') | cc/layer_tree_host.cc » ('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 #ifndef CC_LAYER_TREE_HOST_H_ 5 #ifndef CC_LAYER_TREE_HOST_H_
6 #define CC_LAYER_TREE_HOST_H_ 6 #define CC_LAYER_TREE_HOST_H_
7 7
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 size_t maxPartialTextureUpdates; 67 size_t maxPartialTextureUpdates;
68 gfx::Size defaultTileSize; 68 gfx::Size defaultTileSize;
69 gfx::Size maxUntiledLayerSize; 69 gfx::Size maxUntiledLayerSize;
70 gfx::Size minimumOcclusionTrackingSize; 70 gfx::Size minimumOcclusionTrackingSize;
71 71
72 bool showDebugInfo() const { return showPlatformLayerTree || showDebugRects( ); } 72 bool showDebugInfo() const { return showPlatformLayerTree || showDebugRects( ); }
73 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR ects || showOccludingRects; } 73 bool showDebugRects() const { return showPaintRects || showPropertyChangedRe cts || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceR ects || showOccludingRects; }
74 }; 74 };
75 75
76 // Provides information on an Impl's rendering capabilities back to the LayerTre eHost 76 // Provides information on an Impl's rendering capabilities back to the LayerTre eHost
77 struct RendererCapabilities { 77 struct CC_EXPORT RendererCapabilities {
78 RendererCapabilities(); 78 RendererCapabilities();
79 ~RendererCapabilities(); 79 ~RendererCapabilities();
80 80
81 GLenum bestTextureFormat; 81 GLenum bestTextureFormat;
82 bool contextHasCachedFrontBuffer; 82 bool contextHasCachedFrontBuffer;
83 bool usingPartialSwap; 83 bool usingPartialSwap;
84 bool usingAcceleratedPainting; 84 bool usingAcceleratedPainting;
85 bool usingSetVisibility; 85 bool usingSetVisibility;
86 bool usingSwapCompleteCallback; 86 bool usingSwapCompleteCallback;
87 bool usingGpuMemoryManager; 87 bool usingGpuMemoryManager;
88 bool usingDiscardFramebuffer; 88 bool usingDiscardFramebuffer;
89 bool usingEglImage; 89 bool usingEglImage;
90 int maxTextureSize; 90 int maxTextureSize;
91 }; 91 };
92 92
93 class CC_EXPORT LayerTreeHost : public RateLimiterClient { 93 class CC_EXPORT LayerTreeHost : public RateLimiterClient {
94 public: 94 public:
95 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre eSettings&); 95 static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTre eSettings&, scoped_ptr<Thread> implThread);
96 virtual ~LayerTreeHost(); 96 virtual ~LayerTreeHost();
97 97
98 void setSurfaceReady(); 98 void setSurfaceReady();
99 99
100 // Returns true if any LayerTreeHost is alive. 100 // Returns true if any LayerTreeHost is alive.
101 static bool anyLayerTreeHostInstanceExists(); 101 static bool anyLayerTreeHostInstanceExists();
102 102
103 static bool needsFilterContext() { return s_needsFilterContext; } 103 static bool needsFilterContext() { return s_needsFilterContext; }
104 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo ntext = needsFilterContext; } 104 static void setNeedsFilterContext(bool needsFilterContext) { s_needsFilterCo ntext = needsFilterContext; }
105 bool needsSharedContext() const { return needsFilterContext() || settings(). acceleratePainting; } 105 bool needsSharedContext() const { return needsFilterContext() || settings(). acceleratePainting; }
(...skipping 20 matching lines...) Expand all
126 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } 126 void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); }
127 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } 127 void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); }
128 void deleteContentsTexturesOnImplThread(ResourceProvider*); 128 void deleteContentsTexturesOnImplThread(ResourceProvider*);
129 virtual void acquireLayerTextures(); 129 virtual void acquireLayerTextures();
130 // Returns false if we should abort this frame due to initialization failure . 130 // Returns false if we should abort this frame due to initialization failure .
131 bool initializeRendererIfNeeded(); 131 bool initializeRendererIfNeeded();
132 void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes); 132 void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes);
133 133
134 LayerTreeHostClient* client() { return m_client; } 134 LayerTreeHostClient* client() { return m_client; }
135 135
136 void composite();
137
136 // Only used when compositing on the main thread. 138 // Only used when compositing on the main thread.
137 void composite();
138 void scheduleComposite(); 139 void scheduleComposite();
139 140
140 // Composites and attempts to read back the result into the provided 141 // Composites and attempts to read back the result into the provided
141 // buffer. If it wasn't possible, e.g. due to context lost, will return 142 // buffer. If it wasn't possible, e.g. due to context lost, will return
142 // false. 143 // false.
143 bool compositeAndReadback(void *pixels, const gfx::Rect&); 144 bool compositeAndReadback(void *pixels, const gfx::Rect&);
144 145
145 void finishAllRendering(); 146 void finishAllRendering();
146 147
147 void setDeferCommits(bool deferCommits); 148 void setDeferCommits(bool deferCommits);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 bool requestPartialTextureUpdate(); 206 bool requestPartialTextureUpdate();
206 207
207 void setDeviceScaleFactor(float); 208 void setDeviceScaleFactor(float);
208 float deviceScaleFactor() const { return m_deviceScaleFactor; } 209 float deviceScaleFactor() const { return m_deviceScaleFactor; }
209 210
210 void setShowFPSCounter(bool show); 211 void setShowFPSCounter(bool show);
211 void setFontAtlas(scoped_ptr<FontAtlas>); 212 void setFontAtlas(scoped_ptr<FontAtlas>);
212 213
213 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } 214 HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); }
214 215
216 Proxy* proxy() const { return m_proxy.get(); }
217
215 protected: 218 protected:
216 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); 219 LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&);
217 bool initialize(); 220 bool initialize(scoped_ptr<Thread> implThread);
218 221
219 private: 222 private:
220 typedef std::vector<scoped_refptr<Layer> > LayerList; 223 typedef std::vector<scoped_refptr<Layer> > LayerList;
221 224
222 void initializeRenderer(); 225 void initializeRenderer();
223 226
224 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); 227 void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*);
225 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); 228 bool paintLayerContents(const LayerList&, ResourceUpdateQueue&);
226 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); 229 bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&);
227 230
(...skipping 10 matching lines...) Expand all
238 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base: :Time wallClockTime); 241 void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base: :Time wallClockTime);
239 242
240 void createHUDLayerIfNeeded(); 243 void createHUDLayerIfNeeded();
241 244
242 bool m_animating; 245 bool m_animating;
243 bool m_needsAnimateLayers; 246 bool m_needsAnimateLayers;
244 247
245 base::CancelableClosure m_prepaintCallback; 248 base::CancelableClosure m_prepaintCallback;
246 249
247 LayerTreeHostClient* m_client; 250 LayerTreeHostClient* m_client;
251 scoped_ptr<Proxy> m_proxy;
248 252
249 int m_commitNumber; 253 int m_commitNumber;
250 RenderingStats m_renderingStats; 254 RenderingStats m_renderingStats;
251 255
252 scoped_ptr<Proxy> m_proxy;
253 bool m_rendererInitialized; 256 bool m_rendererInitialized;
254 bool m_contextLost; 257 bool m_contextLost;
255 int m_numTimesRecreateShouldFail; 258 int m_numTimesRecreateShouldFail;
256 int m_numFailedRecreateAttempts; 259 int m_numFailedRecreateAttempts;
257 260
258 scoped_refptr<Layer> m_rootLayer; 261 scoped_refptr<Layer> m_rootLayer;
259 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; 262 scoped_refptr<HeadsUpDisplayLayer> m_hudLayer;
260 263
261 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; 264 scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager;
262 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; 265 scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder;
(...skipping 21 matching lines...) Expand all
284 size_t m_partialTextureUpdateRequests; 287 size_t m_partialTextureUpdateRequests;
285 288
286 static bool s_needsFilterContext; 289 static bool s_needsFilterContext;
287 290
288 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 291 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
289 }; 292 };
290 293
291 } // namespace cc 294 } // namespace cc
292 295
293 #endif // CC_LAYER_TREE_HOST_H_ 296 #endif // CC_LAYER_TREE_HOST_H_
OLDNEW
« no previous file with comments | « cc/layer_sorter_unittest.cc ('k') | cc/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698