Chromium Code Reviews| 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_H_ | 5 #ifndef UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 | 132 |
| 133 // Returns the size of the widget that is being drawn to. | 133 // Returns the size of the widget that is being drawn to. |
| 134 const gfx::Size& size() { return size_; } | 134 const gfx::Size& size() { return size_; } |
| 135 | 135 |
| 136 // Compositor does not own observers. It is the responsibility of the | 136 // Compositor does not own observers. It is the responsibility of the |
| 137 // observer to remove itself when it is done observing. | 137 // observer to remove itself when it is done observing. |
| 138 void AddObserver(CompositorObserver* observer); | 138 void AddObserver(CompositorObserver* observer); |
| 139 void RemoveObserver(CompositorObserver* observer); | 139 void RemoveObserver(CompositorObserver* observer); |
| 140 bool HasObserver(CompositorObserver* observer); | 140 bool HasObserver(CompositorObserver* observer); |
| 141 | 141 |
| 142 static void set_compositor_factory_for_testing( | |
| 143 ui::Compositor*(*factory)(ui::CompositorDelegate* owner)) { | |
| 144 compositor_factory_ = factory; | |
| 145 } | |
| 146 static ui::Compositor* (*compositor_factory())( | |
|
sky
2011/10/14 20:52:41
newline between 145 and 146.
danakj
2011/10/17 14:52:13
Done.
| |
| 147 ui::CompositorDelegate* owner) { | |
| 148 return compositor_factory_; | |
| 149 } | |
| 150 | |
| 142 protected: | 151 protected: |
| 143 Compositor(CompositorDelegate* delegate, const gfx::Size& size); | 152 Compositor(CompositorDelegate* delegate, const gfx::Size& size); |
| 144 virtual ~Compositor(); | 153 virtual ~Compositor(); |
| 145 | 154 |
| 146 // Notifies the compositor that compositing is about to start. | 155 // Notifies the compositor that compositing is about to start. |
| 147 virtual void OnNotifyStart(bool clear) = 0; | 156 virtual void OnNotifyStart(bool clear) = 0; |
| 148 | 157 |
| 149 // Notifies the compositor that compositing is complete. | 158 // Notifies the compositor that compositing is complete. |
| 150 virtual void OnNotifyEnd() = 0; | 159 virtual void OnNotifyEnd() = 0; |
| 151 | 160 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 162 void NotifyEnd(); | 171 void NotifyEnd(); |
| 163 | 172 |
| 164 CompositorDelegate* delegate_; | 173 CompositorDelegate* delegate_; |
| 165 gfx::Size size_; | 174 gfx::Size size_; |
| 166 | 175 |
| 167 // The root of the Layer tree drawn by this compositor. | 176 // The root of the Layer tree drawn by this compositor. |
| 168 Layer* root_layer_; | 177 Layer* root_layer_; |
| 169 | 178 |
| 170 ObserverList<CompositorObserver> observer_list_; | 179 ObserverList<CompositorObserver> observer_list_; |
| 171 | 180 |
| 181 // Factory used to create Compositors. Settable by tests. | |
| 182 // The delegate can be NULL if you don't wish to catch the ScheduleDraw() | |
| 183 // calls to it. | |
| 184 static ui::Compositor*(*compositor_factory_)( | |
| 185 ui::CompositorDelegate* delegate); | |
| 186 | |
| 172 friend class base::RefCounted<Compositor>; | 187 friend class base::RefCounted<Compositor>; |
| 173 }; | 188 }; |
| 174 | 189 |
| 175 } // namespace ui | 190 } // namespace ui |
| 176 | 191 |
| 177 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ | 192 #endif // UI_GFX_COMPOSITOR_COMPOSITOR_H_ |
| OLD | NEW |