OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ | 5 #ifndef UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ |
6 #define UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ | 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 NON_EXPORTED_BASE(public WebKit::WebLayerClient) { | 83 NON_EXPORTED_BASE(public WebKit::WebLayerClient) { |
84 public: | 84 public: |
85 CompositorCC(CompositorDelegate* delegate, | 85 CompositorCC(CompositorDelegate* delegate, |
86 gfx::AcceleratedWidget widget, | 86 gfx::AcceleratedWidget widget, |
87 const gfx::Size& size); | 87 const gfx::Size& size); |
88 virtual ~CompositorCC(); | 88 virtual ~CompositorCC(); |
89 | 89 |
90 static void Initialize(bool useThread); | 90 static void Initialize(bool useThread); |
91 static void Terminate(); | 91 static void Terminate(); |
92 | 92 |
| 93 // If necessary enables the test context. If the test context is enabled the |
| 94 // compositor does not render anything to screen. |
| 95 static void EnableTestContextIfNecessary(); |
| 96 |
93 protected: | 97 protected: |
94 // Compositor implementation. | 98 // Compositor implementation. |
95 virtual Texture* CreateTexture() OVERRIDE; | 99 virtual Texture* CreateTexture() OVERRIDE; |
96 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; | 100 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; |
97 virtual void ScheduleDraw() OVERRIDE; | 101 virtual void ScheduleDraw() OVERRIDE; |
98 virtual void OnNotifyStart(bool clear) OVERRIDE; | 102 virtual void OnNotifyStart(bool clear) OVERRIDE; |
99 virtual void OnNotifyEnd() OVERRIDE; | 103 virtual void OnNotifyEnd() OVERRIDE; |
100 virtual void OnWidgetSizeChanged() OVERRIDE; | 104 virtual void OnWidgetSizeChanged() OVERRIDE; |
101 virtual void OnRootLayerChanged() OVERRIDE; | 105 virtual void OnRootLayerChanged() OVERRIDE; |
102 virtual void DrawTree() OVERRIDE; | 106 virtual void DrawTree() OVERRIDE; |
103 virtual bool ReadPixels(SkBitmap* bitmap, const gfx::Rect& bounds) OVERRIDE; | 107 virtual bool ReadPixels(SkBitmap* bitmap, const gfx::Rect& bounds) OVERRIDE; |
104 | 108 |
105 // WebLayerTreeViewClient implementation. | 109 // WebLayerTreeViewClient implementation. |
106 virtual void animateAndLayout(double frameBeginTime); | 110 virtual void animateAndLayout(double frameBeginTime); |
107 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 111 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
108 float scaleFactor); | 112 float scaleFactor); |
109 virtual void applyScrollDelta(const WebKit::WebSize&); | 113 virtual void applyScrollDelta(const WebKit::WebSize&); |
110 virtual WebKit::WebGraphicsContext3D* createContext3D(); | 114 virtual WebKit::WebGraphicsContext3D* createContext3D(); |
111 virtual void didRebindGraphicsContext(bool success); | 115 virtual void didRebindGraphicsContext(bool success); |
112 virtual void scheduleComposite(); | 116 virtual void scheduleComposite(); |
113 | 117 |
114 // WebLayerClient implementation. | 118 // WebLayerClient implementation. |
115 virtual void notifyNeedsComposite(); | 119 virtual void notifyNeedsComposite(); |
116 | 120 |
117 private: | 121 private: |
118 gfx::AcceleratedWidget widget_; | 122 gfx::AcceleratedWidget widget_; |
119 WebKit::WebLayer root_web_layer_; | 123 WebKit::WebLayer root_web_layer_; |
120 WebKit::WebLayerTreeView host_; | 124 WebKit::WebLayerTreeView host_; |
121 | 125 |
| 126 // See description above SetTestContextEnabled. |
| 127 static bool test_context_enabled_; |
| 128 |
122 DISALLOW_COPY_AND_ASSIGN(CompositorCC); | 129 DISALLOW_COPY_AND_ASSIGN(CompositorCC); |
123 }; | 130 }; |
124 | 131 |
125 } // namespace ui | 132 } // namespace ui |
126 | 133 |
127 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ | 134 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_CC_H_ |
OLD | NEW |