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

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

Issue 11415089: ui/compositor: use cc/ directly instead of webkit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 8 years 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 7
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h" 12 #include "cc/layer_tree_host_client.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewCli ent.h"
15 #include "ui/compositor/compositor_export.h" 13 #include "ui/compositor/compositor_export.h"
16 #include "ui/gfx/native_widget_types.h" 14 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
18 #include "ui/gfx/transform.h" 16 #include "ui/gfx/transform.h"
19 #include "ui/gl/gl_share_group.h" 17 #include "ui/gl/gl_share_group.h"
20 18
21 class SkBitmap; 19 class SkBitmap;
22 20
21 namespace cc {
22 class Layer;
23 class LayerTreeHost;
24 }
25
23 namespace gfx { 26 namespace gfx {
24 class GLContext; 27 class GLContext;
25 class GLSurface; 28 class GLSurface;
26 class GLShareGroup; 29 class GLShareGroup;
27 class Point; 30 class Point;
28 class Rect; 31 class Rect;
29 } 32 }
30 33
34 namespace WebKit {
35 class WebGraphicsContext3D;
36 }
37
31 namespace ui { 38 namespace ui {
32 39
33 class Compositor; 40 class Compositor;
34 class CompositorObserver; 41 class CompositorObserver;
35 class Layer; 42 class Layer;
36 class PostedSwapQueue; 43 class PostedSwapQueue;
37 44
38 // This class abstracts the creation of the 3D context for the compositor. It is 45 // This class abstracts the creation of the 3D context for the compositor. It is
39 // a global object. 46 // a global object.
40 class COMPOSITOR_EXPORT ContextFactory { 47 class COMPOSITOR_EXPORT ContextFactory {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 DISALLOW_COPY_AND_ASSIGN(CompositorLock); 159 DISALLOW_COPY_AND_ASSIGN(CompositorLock);
153 }; 160 };
154 161
155 162
156 // Compositor object to take care of GPU painting. 163 // Compositor object to take care of GPU painting.
157 // A Browser compositor object is responsible for generating the final 164 // A Browser compositor object is responsible for generating the final
158 // displayable form of pixels comprising a single widget's contents. It draws an 165 // displayable form of pixels comprising a single widget's contents. It draws an
159 // appropriately transformed texture for each transformed view in the widget's 166 // appropriately transformed texture for each transformed view in the widget's
160 // view hierarchy. 167 // view hierarchy.
161 class COMPOSITOR_EXPORT Compositor 168 class COMPOSITOR_EXPORT Compositor
162 : NON_EXPORTED_BASE(public WebKit::WebLayerTreeViewClient) { 169 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient) {
163 public: 170 public:
164 Compositor(CompositorDelegate* delegate, 171 Compositor(CompositorDelegate* delegate,
165 gfx::AcceleratedWidget widget); 172 gfx::AcceleratedWidget widget);
166 virtual ~Compositor(); 173 virtual ~Compositor();
167 174
168 static void Initialize(bool useThread); 175 static void Initialize(bool useThread);
169 static void Terminate(); 176 static void Terminate();
170 177
171 // Schedules a redraw of the layer tree associated with this compositor. 178 // Schedules a redraw of the layer tree associated with this compositor.
172 void ScheduleDraw(); 179 void ScheduleDraw();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 235
229 // Signals swap has been posted. 236 // Signals swap has been posted.
230 void OnSwapBuffersPosted(); 237 void OnSwapBuffersPosted();
231 238
232 // Signals swap has completed. 239 // Signals swap has completed.
233 void OnSwapBuffersComplete(); 240 void OnSwapBuffersComplete();
234 241
235 // Signals swap has aborted (e.g. lost context). 242 // Signals swap has aborted (e.g. lost context).
236 void OnSwapBuffersAborted(); 243 void OnSwapBuffersAborted();
237 244
238 // WebLayerTreeViewClient implementation. 245 // LayerTreeHostClient implementation.
239 virtual void updateAnimations(double frameBeginTime); 246 virtual void willBeginFrame() OVERRIDE;
240 virtual void layout(); 247 virtual void didBeginFrame() OVERRIDE;
241 virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta, 248 virtual void animate(double frameBeginTime) OVERRIDE;
242 float scaleFactor); 249 virtual void layout() OVERRIDE;
243 virtual WebKit::WebCompositorOutputSurface* createOutputSurface(); 250 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta,
244 virtual void didRecreateOutputSurface(bool success); 251 float pageScale) OVERRIDE;
245 virtual void didCommit(); 252 virtual scoped_ptr<WebKit::WebCompositorOutputSurface>
246 virtual void didCommitAndDrawFrame(); 253 createOutputSurface() OVERRIDE;
247 virtual void didCompleteSwapBuffers(); 254 virtual void didRecreateOutputSurface(bool success) OVERRIDE;
248 virtual void scheduleComposite(); 255 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE;
256 virtual void willCommit() OVERRIDE;
257 virtual void didCommit() OVERRIDE;
258 virtual void didCommitAndDrawFrame() OVERRIDE;
259 virtual void didCompleteSwapBuffers() OVERRIDE;
260 virtual void scheduleComposite() OVERRIDE;
261
249 262
250 int last_started_frame() { return last_started_frame_; } 263 int last_started_frame() { return last_started_frame_; }
251 int last_ended_frame() { return last_ended_frame_; } 264 int last_ended_frame() { return last_ended_frame_; }
252 265
253 bool IsLocked() { return compositor_lock_ != NULL; } 266 bool IsLocked() { return compositor_lock_ != NULL; }
254 267
255 private: 268 private:
256 friend class base::RefCounted<Compositor>; 269 friend class base::RefCounted<Compositor>;
257 friend class CompositorLock; 270 friend class CompositorLock;
258 271
259 // Called by CompositorLock. 272 // Called by CompositorLock.
260 void UnlockCompositor(); 273 void UnlockCompositor();
261 274
262 // Called to release any pending CompositorLock 275 // Called to release any pending CompositorLock
263 void CancelCompositorLock(); 276 void CancelCompositorLock();
264 277
265 // Notifies the compositor that compositing is complete. 278 // Notifies the compositor that compositing is complete.
266 void NotifyEnd(); 279 void NotifyEnd();
267 280
268 CompositorDelegate* delegate_; 281 CompositorDelegate* delegate_;
269 gfx::Size size_; 282 gfx::Size size_;
270 283
271 // The root of the Layer tree drawn by this compositor. 284 // The root of the Layer tree drawn by this compositor.
272 Layer* root_layer_; 285 Layer* root_layer_;
273 286
274 ObserverList<CompositorObserver> observer_list_; 287 ObserverList<CompositorObserver> observer_list_;
275 288
276 gfx::AcceleratedWidget widget_; 289 gfx::AcceleratedWidget widget_;
277 scoped_ptr<WebKit::WebLayer> root_web_layer_; 290 scoped_refptr<cc::Layer> root_web_layer_;
278 scoped_ptr<WebKit::WebLayerTreeView> host_; 291 scoped_ptr<cc::LayerTreeHost> host_;
279 292
280 // Used to verify that we have at most one draw swap in flight. 293 // Used to verify that we have at most one draw swap in flight.
281 scoped_ptr<PostedSwapQueue> posted_swaps_; 294 scoped_ptr<PostedSwapQueue> posted_swaps_;
282 295
283 // The device scale factor of the monitor that this compositor is compositing 296 // The device scale factor of the monitor that this compositor is compositing
284 // layers on. 297 // layers on.
285 float device_scale_factor_; 298 float device_scale_factor_;
286 299
287 int last_started_frame_; 300 int last_started_frame_;
288 int last_ended_frame_; 301 int last_ended_frame_;
289 302
290 bool disable_schedule_composite_; 303 bool disable_schedule_composite_;
291 304
292 CompositorLock* compositor_lock_; 305 CompositorLock* compositor_lock_;
293 306
294 DISALLOW_COPY_AND_ASSIGN(Compositor); 307 DISALLOW_COPY_AND_ASSIGN(Compositor);
295 }; 308 };
296 309
297 } // namespace ui 310 } // namespace ui
298 311
299 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 312 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW
« cc/proxy.h ('K') | « ui/compositor/DEPS ('k') | ui/compositor/compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698