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

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

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart with GrContext owned in cc Created 7 years, 10 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 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"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Creates an output surface for the given compositor. The factory may keep 60 // Creates an output surface for the given compositor. The factory may keep
61 // per-compositor data (e.g. a shared context), that needs to be cleaned up 61 // per-compositor data (e.g. a shared context), that needs to be cleaned up
62 // by calling RemoveCompositor when the compositor gets destroyed. 62 // by calling RemoveCompositor when the compositor gets destroyed.
63 virtual cc::OutputSurface* CreateOutputSurface( 63 virtual cc::OutputSurface* CreateOutputSurface(
64 Compositor* compositor) = 0; 64 Compositor* compositor) = 0;
65 65
66 // Creates a context used for offscreen rendering. This context can be shared 66 // Creates a context used for offscreen rendering. This context can be shared
67 // with all compositors. 67 // with all compositors.
68 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0; 68 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() = 0;
69 69
70 virtual WebKit::WebGraphicsContext3D* OffscreenContextForMainThread() = 0;
71 virtual WebKit::WebGraphicsContext3D*
72 OffscreenContextForCompositorThread() = 0;
73
70 // Destroys per-compositor data. 74 // Destroys per-compositor data.
71 virtual void RemoveCompositor(Compositor* compositor) = 0; 75 virtual void RemoveCompositor(Compositor* compositor) = 0;
72 }; 76 };
73 77
74 // The default factory that creates in-process contexts. 78 // The default factory that creates in-process contexts.
75 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory { 79 class COMPOSITOR_EXPORT DefaultContextFactory : public ContextFactory {
76 public: 80 public:
77 DefaultContextFactory(); 81 DefaultContextFactory();
78 virtual ~DefaultContextFactory(); 82 virtual ~DefaultContextFactory();
79 83
80 // ContextFactory implementation 84 // ContextFactory implementation
81 virtual cc::OutputSurface* CreateOutputSurface( 85 virtual cc::OutputSurface* CreateOutputSurface(
82 Compositor* compositor) OVERRIDE; 86 Compositor* compositor) OVERRIDE;
83 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE; 87 virtual WebKit::WebGraphicsContext3D* CreateOffscreenContext() OVERRIDE;
88 virtual WebKit::WebGraphicsContext3D* OffscreenContextForMainThread()
89 OVERRIDE;
90 virtual WebKit::WebGraphicsContext3D* OffscreenContextForCompositorThread()
91 OVERRIDE;
84 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE; 92 virtual void RemoveCompositor(Compositor* compositor) OVERRIDE;
85 93
86 bool Initialize(); 94 bool Initialize();
87 95
88 void set_share_group(gfx::GLShareGroup* share_group) { 96 void set_share_group(gfx::GLShareGroup* share_group) {
89 share_group_ = share_group; 97 share_group_ = share_group;
90 } 98 }
91 99
92 private: 100 private:
93 WebKit::WebGraphicsContext3D* CreateContextCommon( 101 WebKit::WebGraphicsContext3D* CreateContextCommon(
94 Compositor* compositor, 102 Compositor* compositor,
95 bool offscreen); 103 bool offscreen);
96 104
97 scoped_refptr<gfx::GLShareGroup> share_group_; 105 scoped_refptr<gfx::GLShareGroup> share_group_;
106 scoped_ptr<WebKit::WebGraphicsContext3D> test_offscreen_context_main_thread_;
107 scoped_ptr<WebKit::WebGraphicsContext3D>
108 test_offscreen_context_compositor_thread_;
98 109
99 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory); 110 DISALLOW_COPY_AND_ASSIGN(DefaultContextFactory);
100 }; 111 };
101 112
102 // Texture provide an abstraction over the external texture that can be passed 113 // Texture provide an abstraction over the external texture that can be passed
103 // to a layer. 114 // to a layer.
104 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> { 115 class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> {
105 public: 116 public:
106 Texture(bool flipped, const gfx::Size& size, float device_scale_factor); 117 Texture(bool flipped, const gfx::Size& size, float device_scale_factor);
107 118
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // LayerTreeHostClient implementation. 265 // LayerTreeHostClient implementation.
255 virtual void willBeginFrame() OVERRIDE; 266 virtual void willBeginFrame() OVERRIDE;
256 virtual void didBeginFrame() OVERRIDE; 267 virtual void didBeginFrame() OVERRIDE;
257 virtual void animate(double frameBeginTime) OVERRIDE; 268 virtual void animate(double frameBeginTime) OVERRIDE;
258 virtual void layout() OVERRIDE; 269 virtual void layout() OVERRIDE;
259 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, 270 virtual void applyScrollAndScale(gfx::Vector2d scrollDelta,
260 float pageScale) OVERRIDE; 271 float pageScale) OVERRIDE;
261 virtual scoped_ptr<cc::OutputSurface> 272 virtual scoped_ptr<cc::OutputSurface>
262 createOutputSurface() OVERRIDE; 273 createOutputSurface() OVERRIDE;
263 virtual void didRecreateOutputSurface(bool success) OVERRIDE; 274 virtual void didRecreateOutputSurface(bool success) OVERRIDE;
275 virtual WebKit::WebGraphicsContext3D*
276 OffscreenContext3dForMainThread() OVERRIDE;
277 virtual WebKit::WebGraphicsContext3D*
278 OffscreenContext3dForCompositorThread() OVERRIDE;
264 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE; 279 virtual scoped_ptr<cc::InputHandler> createInputHandler() OVERRIDE;
265 virtual void willCommit() OVERRIDE; 280 virtual void willCommit() OVERRIDE;
266 virtual void didCommit() OVERRIDE; 281 virtual void didCommit() OVERRIDE;
267 virtual void didCommitAndDrawFrame() OVERRIDE; 282 virtual void didCommitAndDrawFrame() OVERRIDE;
268 virtual void didCompleteSwapBuffers() OVERRIDE; 283 virtual void didCompleteSwapBuffers() OVERRIDE;
269 virtual void scheduleComposite() OVERRIDE; 284 virtual void scheduleComposite() OVERRIDE;
270 virtual scoped_ptr<cc::FontAtlas> createFontAtlas() OVERRIDE; 285 virtual scoped_ptr<cc::FontAtlas> createFontAtlas() OVERRIDE;
271 286
272 287
273 int last_started_frame() { return last_started_frame_; } 288 int last_started_frame() { return last_started_frame_; }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 bool disable_schedule_composite_; 328 bool disable_schedule_composite_;
314 329
315 CompositorLock* compositor_lock_; 330 CompositorLock* compositor_lock_;
316 331
317 DISALLOW_COPY_AND_ASSIGN(Compositor); 332 DISALLOW_COPY_AND_ASSIGN(Compositor);
318 }; 333 };
319 334
320 } // namespace ui 335 } // namespace ui
321 336
322 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 337 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698