| 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 CCSingleThreadProxy_h | 5 #ifndef CCSingleThreadProxy_h |
| 6 #define CCSingleThreadProxy_h | 6 #define CCSingleThreadProxy_h |
| 7 | 7 |
| 8 #include "CCAnimationEvents.h" | 8 #include "CCAnimationEvents.h" |
| 9 #include "CCLayerTreeHostImpl.h" | 9 #include "CCLayerTreeHostImpl.h" |
| 10 #include "CCProxy.h" | 10 #include "CCProxy.h" |
| 11 #include <base/time.h> |
| 11 #include <limits> | 12 #include <limits> |
| 12 #include <wtf/OwnPtr.h> | 13 #include <wtf/OwnPtr.h> |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 | 16 |
| 16 class CCLayerTreeHost; | 17 class CCLayerTreeHost; |
| 17 | 18 |
| 18 class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient { | 19 class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient { |
| 19 public: | 20 public: |
| 20 static PassOwnPtr<CCProxy> create(CCLayerTreeHost*); | 21 static PassOwnPtr<CCProxy> create(CCLayerTreeHost*); |
| 21 virtual ~CCSingleThreadProxy(); | 22 virtual ~CCSingleThreadProxy(); |
| 22 | 23 |
| 23 // CCProxy implementation | 24 // CCProxy implementation |
| 24 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; | 25 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; |
| 25 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, double duration) OVERRIDE; | 26 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, double duration) OVERRIDE; |
| 26 virtual void finishAllRendering() OVERRIDE; | 27 virtual void finishAllRendering() OVERRIDE; |
| 27 virtual bool isStarted() const OVERRIDE; | 28 virtual bool isStarted() const OVERRIDE; |
| 28 virtual bool initializeContext() OVERRIDE; | 29 virtual bool initializeContext() OVERRIDE; |
| 29 virtual void setSurfaceReady() OVERRIDE; | 30 virtual void setSurfaceReady() OVERRIDE; |
| 30 virtual void setVisible(bool) OVERRIDE; | 31 virtual void setVisible(bool) OVERRIDE; |
| 31 virtual bool initializeRenderer() OVERRIDE; | 32 virtual bool initializeRenderer() OVERRIDE; |
| 32 virtual bool recreateContext() OVERRIDE; | 33 virtual bool recreateContext() OVERRIDE; |
| 33 virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE; | 34 virtual void renderingStats(CCRenderingStats*) OVERRIDE; |
| 34 virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; | 35 virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE; |
| 35 virtual void loseContext() OVERRIDE; | 36 virtual void loseContext() OVERRIDE; |
| 36 virtual void setNeedsAnimate() OVERRIDE; | 37 virtual void setNeedsAnimate() OVERRIDE; |
| 37 virtual void setNeedsCommit() OVERRIDE; | 38 virtual void setNeedsCommit() OVERRIDE; |
| 38 virtual void setNeedsRedraw() OVERRIDE; | 39 virtual void setNeedsRedraw() OVERRIDE; |
| 39 virtual bool commitRequested() const OVERRIDE; | 40 virtual bool commitRequested() const OVERRIDE; |
| 40 virtual void didAddAnimation() OVERRIDE; | 41 virtual void didAddAnimation() OVERRIDE; |
| 41 virtual void start() OVERRIDE; | 42 virtual void start() OVERRIDE; |
| 42 virtual void stop() OVERRIDE; | 43 virtual void stop() OVERRIDE; |
| 43 virtual size_t maxPartialTextureUpdates() const OVERRIDE; | 44 virtual size_t maxPartialTextureUpdates() const OVERRIDE; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 72 // Holds on to the context between initializeContext() and initializeRendere
r() calls. Shouldn't | 73 // Holds on to the context between initializeContext() and initializeRendere
r() calls. Shouldn't |
| 73 // be used for anything else. | 74 // be used for anything else. |
| 74 OwnPtr<CCGraphicsContext> m_contextBeforeInitialization; | 75 OwnPtr<CCGraphicsContext> m_contextBeforeInitialization; |
| 75 | 76 |
| 76 // Used on the CCThread, but checked on main thread during initialization/sh
utdown. | 77 // Used on the CCThread, but checked on main thread during initialization/sh
utdown. |
| 77 OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; | 78 OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; |
| 78 bool m_rendererInitialized; | 79 bool m_rendererInitialized; |
| 79 RendererCapabilities m_RendererCapabilitiesForMainThread; | 80 RendererCapabilities m_RendererCapabilitiesForMainThread; |
| 80 | 81 |
| 81 bool m_nextFrameIsNewlyCommittedFrame; | 82 bool m_nextFrameIsNewlyCommittedFrame; |
| 83 |
| 84 base::TimeDelta m_totalCommitTime; |
| 85 size_t m_totalCommitCount; |
| 82 }; | 86 }; |
| 83 | 87 |
| 84 // For use in the single-threaded case. In debug builds, it pretends that the | 88 // For use in the single-threaded case. In debug builds, it pretends that the |
| 85 // code is running on the impl thread to satisfy assertion checks. | 89 // code is running on the impl thread to satisfy assertion checks. |
| 86 class DebugScopedSetImplThread { | 90 class DebugScopedSetImplThread { |
| 87 public: | 91 public: |
| 88 DebugScopedSetImplThread() | 92 DebugScopedSetImplThread() |
| 89 { | 93 { |
| 90 #if !ASSERT_DISABLED | 94 #if !ASSERT_DISABLED |
| 91 CCProxy::setCurrentThreadIsImplThread(true); | 95 CCProxy::setCurrentThreadIsImplThread(true); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 122 // satisfy assertion checks | 126 // satisfy assertion checks |
| 123 class DebugScopedSetImplThreadAndMainThreadBlocked { | 127 class DebugScopedSetImplThreadAndMainThreadBlocked { |
| 124 private: | 128 private: |
| 125 DebugScopedSetImplThread m_implThread; | 129 DebugScopedSetImplThread m_implThread; |
| 126 DebugScopedSetMainThreadBlocked m_mainThreadBlocked; | 130 DebugScopedSetMainThreadBlocked m_mainThreadBlocked; |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace cc | 133 } // namespace cc |
| 130 | 134 |
| 131 #endif | 135 #endif |
| OLD | NEW |