Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ui/compositor/compositor.h

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments, remove dead code, plumb through context. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Texture provide an abstraction over the external texture that can be passed 98 // Texture provide an abstraction over the external texture that can be passed
96 // to a layer. 99 // to a layer.
97 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { 100 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> {
98 public: 101 public:
99 Texture(bool flipped, const gfx::Size& size); 102 Texture(bool flipped, const gfx::Size& size);
100 103
101 unsigned int texture_id() const { return texture_id_; } 104 unsigned int texture_id() const { return texture_id_; }
102 void set_texture_id(unsigned int id) { texture_id_ = id; } 105 void set_texture_id(unsigned int id) { texture_id_ = id; }
103 bool flipped() const { return flipped_; } 106 bool flipped() const { return flipped_; }
104 gfx::Size size() const { return size_; } 107 gfx::Size size() const { return size_; }
108 virtual WebKit::WebGraphicsContext3D* hostContext3D() = 0;
piman 2012/07/12 00:18:09 nit: chrome style.
jonathan.backer 2012/07/12 13:53:22 Done.
105 109
106 protected: 110 protected:
107 virtual ~Texture(); 111 virtual ~Texture();
108 112
109 private: 113 private:
110 friend class base::RefCounted<Texture>; 114 friend class base::RefCounted<Texture>;
111 115
112 unsigned int texture_id_; 116 unsigned int texture_id_;
113 bool flipped_; 117 bool flipped_;
114 gfx::Size size_; // in pixel 118 gfx::Size size_; // in pixel
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Signals swap has aborted (e.g. lost context). 207 // Signals swap has aborted (e.g. lost context).
204 void OnSwapBuffersAborted(); 208 void OnSwapBuffersAborted();
205 209
206 // WebLayerTreeViewClient implementation. 210 // WebLayerTreeViewClient implementation.
207 virtual void updateAnimations(double frameBeginTime); 211 virtual void updateAnimations(double frameBeginTime);
208 virtual void layout(); 212 virtual void layout();
209 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, 213 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta,
210 float scaleFactor); 214 float scaleFactor);
211 virtual WebKit::WebGraphicsContext3D* createContext3D(); 215 virtual WebKit::WebGraphicsContext3D* createContext3D();
212 virtual void didRebindGraphicsContext(bool success); 216 virtual void didRebindGraphicsContext(bool success);
217 virtual void didCommit();
213 virtual void didCommitAndDrawFrame(); 218 virtual void didCommitAndDrawFrame();
214 virtual void didCompleteSwapBuffers(); 219 virtual void didCompleteSwapBuffers();
215 virtual void scheduleComposite(); 220 virtual void scheduleComposite();
216 221
217 int last_started_frame() { return last_started_frame_; } 222 int last_started_frame() { return last_started_frame_; }
218 int last_ended_frame() { return last_ended_frame_; } 223 int last_ended_frame() { return last_ended_frame_; }
219 224
225 void AddDidCommitCallback(
226 const base::Callback<void(ui::Compositor*)>& callback);
227
220 private: 228 private:
221 friend class base::RefCounted<Compositor>; 229 friend class base::RefCounted<Compositor>;
222 230
223 // When reading back pixel data we often get RGBA rather than BGRA pixels and 231 // When reading back pixel data we often get RGBA rather than BGRA pixels and
224 // and the image often needs to be flipped vertically. 232 // and the image often needs to be flipped vertically.
225 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels, 233 static void SwizzleRGBAToBGRAAndFlip(unsigned char* pixels,
226 const gfx::Size& image_size); 234 const gfx::Size& image_size);
227 235
228 // Notifies the compositor that compositing is complete. 236 // Notifies the compositor that compositing is complete.
229 void NotifyEnd(); 237 void NotifyEnd();
(...skipping 15 matching lines...) Expand all
245 bool swap_posted_; 253 bool swap_posted_;
246 254
247 // The device scale factor of the monitor that this compositor is compositing 255 // The device scale factor of the monitor that this compositor is compositing
248 // layers on. 256 // layers on.
249 float device_scale_factor_; 257 float device_scale_factor_;
250 258
251 int last_started_frame_; 259 int last_started_frame_;
252 int last_ended_frame_; 260 int last_ended_frame_;
253 261
254 bool disable_schedule_composite_; 262 bool disable_schedule_composite_;
263
264 std::vector< base::Callback<void(ui::Compositor*)> >
265 did_commit_callbacks_;
255 }; 266 };
256 267
257 } // namespace ui 268 } // namespace ui
258 269
259 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 270 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698