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 "base/basictypes.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include <public/WebCompositorOutputSurface.h> | 11 #include <public/WebCompositorOutputSurface.h> |
12 | 12 |
| 13 namespace gfx { |
| 14 class Rect; |
| 15 } |
| 16 |
13 namespace cc { | 17 namespace cc { |
14 | 18 |
15 class Thread; | 19 class Thread; |
16 class IntRect; | |
17 class IntSize; | 20 class IntSize; |
18 struct RenderingStats; | 21 struct RenderingStats; |
19 struct RendererCapabilities; | 22 struct RendererCapabilities; |
20 | 23 |
21 // Abstract class responsible for proxying commands from the main-thread side of | 24 // Abstract class responsible for proxying commands from the main-thread side of |
22 // the compositor over to the compositor implementation. | 25 // the compositor over to the compositor implementation. |
23 class Proxy { | 26 class Proxy { |
24 public: | 27 public: |
25 static void setMainThread(Thread*); | 28 static void setMainThread(Thread*); |
26 static Thread* mainThread(); | 29 static Thread* mainThread(); |
27 | 30 |
28 static bool hasImplThread(); | 31 static bool hasImplThread(); |
29 static void setImplThread(Thread*); | 32 static void setImplThread(Thread*); |
30 static Thread* implThread(); | 33 static Thread* implThread(); |
31 | 34 |
32 // Returns 0 if the current thread is neither the main thread nor the impl t
hread. | 35 // Returns 0 if the current thread is neither the main thread nor the impl t
hread. |
33 static Thread* currentThread(); | 36 static Thread* currentThread(); |
34 | 37 |
35 virtual ~Proxy(); | 38 virtual ~Proxy(); |
36 | 39 |
37 virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0; | 40 virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) = 0; |
38 | 41 |
39 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, base::TimeDelta duration) = 0; | 42 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, base::TimeDelta duration) = 0; |
40 | 43 |
41 virtual void finishAllRendering() = 0; | 44 virtual void finishAllRendering() = 0; |
42 | 45 |
43 virtual bool isStarted() const = 0; | 46 virtual bool isStarted() const = 0; |
44 | 47 |
45 // Attempts to initialize a context to use for rendering. Returns false if t
he context could not be created. | 48 // Attempts to initialize a context to use for rendering. Returns false if t
he context could not be created. |
46 // The context will not be used and no frames may be produced until initiali
zeRenderer() is called. | 49 // The context will not be used and no frames may be produced until initiali
zeRenderer() is called. |
47 virtual bool initializeContext() = 0; | 50 virtual bool initializeContext() = 0; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 #ifndef NDEBUG | 127 #ifndef NDEBUG |
125 DCHECK(Proxy::isMainThreadBlocked()); | 128 DCHECK(Proxy::isMainThreadBlocked()); |
126 Proxy::setMainThreadBlocked(false); | 129 Proxy::setMainThreadBlocked(false); |
127 #endif | 130 #endif |
128 } | 131 } |
129 }; | 132 }; |
130 | 133 |
131 } | 134 } |
132 | 135 |
133 #endif | 136 #endif |
OLD | NEW |