OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | |
10 | |
11 #include "base/callback.h" | |
9 #include "base/hash_tables.h" | 12 #include "base/hash_tables.h" |
10 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
11 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h" |
15 #include "ui/compositor/compositor_export.h" | 18 #include "ui/compositor/compositor_export.h" |
16 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
18 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 // Signals swap has aborted (e.g. lost context). | 206 // Signals swap has aborted (e.g. lost context). |
204 void OnSwapBuffersAborted(); | 207 void OnSwapBuffersAborted(); |
205 | 208 |
206 // WebLayerTreeViewClient implementation. | 209 // WebLayerTreeViewClient implementation. |
207 virtual void updateAnimations(double frameBeginTime); | 210 virtual void updateAnimations(double frameBeginTime); |
208 virtual void layout(); | 211 virtual void layout(); |
209 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 212 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
210 float scaleFactor); | 213 float scaleFactor); |
211 virtual WebKit::WebGraphicsContext3D* createContext3D(); | 214 virtual WebKit::WebGraphicsContext3D* createContext3D(); |
212 virtual void didRebindGraphicsContext(bool success); | 215 virtual void didRebindGraphicsContext(bool success); |
216 virtual void didCommit(); | |
213 virtual void didCommitAndDrawFrame(); | 217 virtual void didCommitAndDrawFrame(); |
214 virtual void didCompleteSwapBuffers(); | 218 virtual void didCompleteSwapBuffers(); |
215 virtual void scheduleComposite(); | 219 virtual void scheduleComposite(); |
216 | 220 |
217 int last_started_frame() { return last_started_frame_; } | 221 int last_started_frame() { return last_started_frame_; } |
218 int last_ended_frame() { return last_ended_frame_; } | 222 int last_ended_frame() { return last_ended_frame_; } |
219 | 223 |
224 void AddDidCommitCallback( | |
piman
2012/07/09 22:40:01
It would be good to have the name and/or comments
jonathan.backer
2012/07/11 21:02:03
You're right: it's confusing. I changed it to fire
piman
2012/07/12 00:18:09
I'd rather be consistent.
| |
225 const base::Callback<void(ui::Compositor*)>& callback); | |
226 | |
220 private: | 227 private: |
221 friend class base::RefCounted<Compositor>; | 228 friend class base::RefCounted<Compositor>; |
222 | 229 |
223 // When reading back pixel data we often get RGBA rather than BGRA pixels and | 230 // When reading back pixel data we often get RGBA rather than BGRA pixels and |
224 // and the image often needs to be flipped vertically. | 231 // and the image often needs to be flipped vertically. |
225 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, | 232 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, |
226 const gfx::Size& image_size); | 233 const gfx::Size& image_size); |
227 | 234 |
228 // Notifies the compositor that compositing is complete. | 235 // Notifies the compositor that compositing is complete. |
229 void NotifyEnd(); | 236 void NotifyEnd(); |
(...skipping 15 matching lines...) Expand all Loading... | |
245 bool swap_posted_; | 252 bool swap_posted_; |
246 | 253 |
247 // The device scale factor of the monitor that this compositor is compositing | 254 // The device scale factor of the monitor that this compositor is compositing |
248 // layers on. | 255 // layers on. |
249 float device_scale_factor_; | 256 float device_scale_factor_; |
250 | 257 |
251 int last_started_frame_; | 258 int last_started_frame_; |
252 int last_ended_frame_; | 259 int last_ended_frame_; |
253 | 260 |
254 bool disable_schedule_composite_; | 261 bool disable_schedule_composite_; |
262 | |
263 std::vector< base::Callback<void(ui::Compositor*)> > | |
264 did_commit_callbacks_; | |
255 }; | 265 }; |
256 | 266 |
257 } // namespace ui | 267 } // namespace ui |
258 | 268 |
259 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 269 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |