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 #ifndef CC_SINGLE_THREAD_PROXY_H_ | 5 #ifndef CC_SINGLE_THREAD_PROXY_H_ |
6 #define CC_SINGLE_THREAD_PROXY_H_ | 6 #define CC_SINGLE_THREAD_PROXY_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "cc/animation_events.h" | 11 #include "cc/animation_events.h" |
12 #include "cc/layer_tree_host_impl.h" | 12 #include "cc/layer_tree_host_impl.h" |
13 #include "cc/proxy.h" | 13 #include "cc/proxy.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
| 17 class ContextProvider; |
17 class LayerTreeHost; | 18 class LayerTreeHost; |
18 | 19 |
19 class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { | 20 class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
20 public: | 21 public: |
21 static scoped_ptr<Proxy> create(LayerTreeHost*); | 22 static scoped_ptr<Proxy> create(LayerTreeHost*); |
22 virtual ~SingleThreadProxy(); | 23 virtual ~SingleThreadProxy(); |
23 | 24 |
24 // Proxy implementation | 25 // Proxy implementation |
25 virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE; | 26 virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE; |
26 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnc
hor, float scale, base::TimeDelta duration) OVERRIDE; | 27 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnc
hor, float scale, base::TimeDelta duration) OVERRIDE; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 virtual void renewTreePriority() OVERRIDE { } | 67 virtual void renewTreePriority() OVERRIDE { } |
67 | 68 |
68 // Called by the legacy path where RenderWidget does the scheduling. | 69 // Called by the legacy path where RenderWidget does the scheduling. |
69 void compositeImmediately(); | 70 void compositeImmediately(); |
70 | 71 |
71 private: | 72 private: |
72 explicit SingleThreadProxy(LayerTreeHost*); | 73 explicit SingleThreadProxy(LayerTreeHost*); |
73 | 74 |
74 bool commitAndComposite(); | 75 bool commitAndComposite(); |
75 void doCommit(scoped_ptr<ResourceUpdateQueue>); | 76 void doCommit(scoped_ptr<ResourceUpdateQueue>); |
76 bool doComposite(); | 77 bool doComposite(scoped_refptr<cc::ContextProvider> offscreenContextProvider
); |
77 void didSwapFrame(); | 78 void didSwapFrame(); |
78 | 79 |
79 // Accessed on main thread only. | 80 // Accessed on main thread only. |
80 LayerTreeHost* m_layerTreeHost; | 81 LayerTreeHost* m_layerTreeHost; |
81 bool m_outputSurfaceLost; | 82 bool m_outputSurfaceLost; |
| 83 bool m_createdOffscreenContextProvider; |
82 | 84 |
83 // Holds on to the context between initializeContext() and initializeRendere
r() calls. Shouldn't | 85 // Holds on to the context between initializeContext() and initializeRendere
r() calls. Shouldn't |
84 // be used for anything else. | 86 // be used for anything else. |
85 scoped_ptr<OutputSurface> m_outputSurfaceBeforeInitialization; | 87 scoped_ptr<OutputSurface> m_outputSurfaceBeforeInitialization; |
86 | 88 |
87 // Used on the Thread, but checked on main thread during initialization/shut
down. | 89 // Used on the Thread, but checked on main thread during initialization/shut
down. |
88 scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; | 90 scoped_ptr<LayerTreeHostImpl> m_layerTreeHostImpl; |
89 bool m_rendererInitialized; | 91 bool m_rendererInitialized; |
90 RendererCapabilities m_RendererCapabilitiesForMainThread; | 92 RendererCapabilities m_RendererCapabilitiesForMainThread; |
91 | 93 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 { | 156 { |
155 } | 157 } |
156 private: | 158 private: |
157 DebugScopedSetImplThread m_implThread; | 159 DebugScopedSetImplThread m_implThread; |
158 DebugScopedSetMainThreadBlocked m_mainThreadBlocked; | 160 DebugScopedSetMainThreadBlocked m_mainThreadBlocked; |
159 }; | 161 }; |
160 | 162 |
161 } // namespace cc | 163 } // namespace cc |
162 | 164 |
163 #endif // CC_SINGLE_THREAD_PROXY_H_ | 165 #endif // CC_SINGLE_THREAD_PROXY_H_ |
OLD | NEW |