| 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 CCProxy_h | 5 #ifndef CCProxy_h |
| 6 #define CCProxy_h | 6 #define CCProxy_h |
| 7 | 7 |
| 8 #include "base/basictypes.h" |
| 8 #include "IntRect.h" | 9 #include "IntRect.h" |
| 9 #include <public/WebCompositorOutputSurface.h> | 10 #include <public/WebCompositorOutputSurface.h> |
| 10 #include <wtf/Noncopyable.h> | |
| 11 #include <wtf/PassOwnPtr.h> | 11 #include <wtf/PassOwnPtr.h> |
| 12 #include <wtf/PassRefPtr.h> | 12 #include <wtf/PassRefPtr.h> |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class CCThread; | 16 class CCThread; |
| 17 struct CCRenderingStats; | 17 struct CCRenderingStats; |
| 18 struct RendererCapabilities; | 18 struct RendererCapabilities; |
| 19 | 19 |
| 20 // Abstract class responsible for proxying commands from the main-thread side of | 20 // Abstract class responsible for proxying commands from the main-thread side of |
| 21 // the compositor over to the compositor implementation. | 21 // the compositor over to the compositor implementation. |
| 22 class CCProxy { | 22 class CCProxy { |
| 23 WTF_MAKE_NONCOPYABLE(CCProxy); | |
| 24 public: | 23 public: |
| 25 static void setMainThread(CCThread*); | 24 static void setMainThread(CCThread*); |
| 26 static CCThread* mainThread(); | 25 static CCThread* mainThread(); |
| 27 | 26 |
| 28 static bool hasImplThread(); | 27 static bool hasImplThread(); |
| 29 static void setImplThread(CCThread*); | 28 static void setImplThread(CCThread*); |
| 30 static CCThread* implThread(); | 29 static CCThread* implThread(); |
| 31 | 30 |
| 32 // Returns 0 if the current thread is neither the main thread nor the impl t
hread. | 31 // Returns 0 if the current thread is neither the main thread nor the impl t
hread. |
| 33 static CCThread* currentThread(); | 32 static CCThread* currentThread(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 virtual void loseContext() = 0; | 93 virtual void loseContext() = 0; |
| 95 | 94 |
| 96 #ifndef NDEBUG | 95 #ifndef NDEBUG |
| 97 static void setCurrentThreadIsImplThread(bool); | 96 static void setCurrentThreadIsImplThread(bool); |
| 98 #endif | 97 #endif |
| 99 | 98 |
| 100 protected: | 99 protected: |
| 101 CCProxy(); | 100 CCProxy(); |
| 102 friend class DebugScopedSetImplThread; | 101 friend class DebugScopedSetImplThread; |
| 103 friend class DebugScopedSetMainThreadBlocked; | 102 friend class DebugScopedSetMainThreadBlocked; |
| 103 |
| 104 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(CCProxy); |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 class DebugScopedSetMainThreadBlocked { | 108 class DebugScopedSetMainThreadBlocked { |
| 107 public: | 109 public: |
| 108 DebugScopedSetMainThreadBlocked() | 110 DebugScopedSetMainThreadBlocked() |
| 109 { | 111 { |
| 110 #if !ASSERT_DISABLED | 112 #if !ASSERT_DISABLED |
| 111 ASSERT(!CCProxy::isMainThreadBlocked()); | 113 ASSERT(!CCProxy::isMainThreadBlocked()); |
| 112 CCProxy::setMainThreadBlocked(true); | 114 CCProxy::setMainThreadBlocked(true); |
| 113 #endif | 115 #endif |
| 114 } | 116 } |
| 115 ~DebugScopedSetMainThreadBlocked() | 117 ~DebugScopedSetMainThreadBlocked() |
| 116 { | 118 { |
| 117 #if !ASSERT_DISABLED | 119 #if !ASSERT_DISABLED |
| 118 ASSERT(CCProxy::isMainThreadBlocked()); | 120 ASSERT(CCProxy::isMainThreadBlocked()); |
| 119 CCProxy::setMainThreadBlocked(false); | 121 CCProxy::setMainThreadBlocked(false); |
| 120 #endif | 122 #endif |
| 121 } | 123 } |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } | 126 } |
| 125 | 127 |
| 126 #endif | 128 #endif |
| OLD | NEW |