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

Side by Side Diff: content/public/browser/android/synchronous_compositor.h

Issue 266353003: aw: Ubercomp mega patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "gpu/command_buffer/service/in_process_command_buffer.h" 10 #include "gpu/command_buffer/service/in_process_command_buffer.h"
11 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
12 #include "ui/gfx/size.h" 12 #include "ui/gfx/size.h"
13 13
14 class SkCanvas; 14 class SkCanvas;
15 15
16 namespace cc {
17 class CompositorFrame;
18 class CompositorFrameAck;
19 }
20
16 namespace gfx { 21 namespace gfx {
17 class GLSurface; 22 class GLSurface;
18 class Transform; 23 class Transform;
19 }; 24 };
20 25
21 namespace content { 26 namespace content {
22 27
28 class SynchronousCompositorClient;
23 class WebContents; 29 class WebContents;
24 30
25 class SynchronousCompositorClient; 31 // TODO(boliu): Layering violation.
32 class SynchronousCompositorFactoryImpl;
26 33
27 struct CONTENT_EXPORT SynchronousCompositorMemoryPolicy { 34 struct CONTENT_EXPORT SynchronousCompositorMemoryPolicy {
28 // Memory limit for rendering and pre-rendering. 35 // Memory limit for rendering and pre-rendering.
29 size_t bytes_limit; 36 size_t bytes_limit;
30 37
31 // Limit of number of GL resources used for rendering and pre-rendering. 38 // Limit of number of GL resources used for rendering and pre-rendering.
32 size_t num_resources_limit; 39 size_t num_resources_limit;
33 40
34 SynchronousCompositorMemoryPolicy(); 41 SynchronousCompositorMemoryPolicy();
35 42
36 bool operator==(const SynchronousCompositorMemoryPolicy& other) const; 43 bool operator==(const SynchronousCompositorMemoryPolicy& other) const;
37 bool operator!=(const SynchronousCompositorMemoryPolicy& other) const; 44 bool operator!=(const SynchronousCompositorMemoryPolicy& other) const;
38 }; 45 };
39 46
40 // Interface for embedders that wish to direct compositing operations 47 // Interface for embedders that wish to direct compositing operations
41 // synchronously under their own control. Only meaningful when the 48 // synchronously under their own control. Only meaningful when the
42 // kEnableSyncrhonousRendererCompositor flag is specified. 49 // kEnableSyncrhonousRendererCompositor flag is specified.
43 class CONTENT_EXPORT SynchronousCompositor { 50 class CONTENT_EXPORT SynchronousCompositor {
44 public: 51 public:
45 // Must be called once per WebContents instance. Will create the compositor 52 // Must be called once per WebContents instance. Will create the compositor
46 // instance as needed, but only if |client| is non-NULL. 53 // instance as needed, but only if |client| is non-NULL.
47 static void SetClientForWebContents(WebContents* contents, 54 static void SetClientForWebContents(WebContents* contents,
48 SynchronousCompositorClient* client); 55 SynchronousCompositorClient* client);
49 56
57 // TODO(boliu): Layering violation.
58 static SynchronousCompositorFactoryImpl* GetFactory();
59
50 // Allows changing or resetting the client to NULL (this must be used if 60 // Allows changing or resetting the client to NULL (this must be used if
51 // the client is being deleted prior to the DidDestroyCompositor() call 61 // the client is being deleted prior to the DidDestroyCompositor() call
52 // being received by the client). Ownership of |client| remains with 62 // being received by the client). Ownership of |client| remains with
53 // the caller. 63 // the caller.
54 virtual void SetClient(SynchronousCompositorClient* client) = 0; 64 virtual void SetClient(SynchronousCompositorClient* client) = 0;
55 65
56 static void SetGpuService( 66 static void SetGpuService(
57 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); 67 scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
58 68
59 // Synchronously initialize compositor for hardware draw. Can only be called 69 // Synchronously initialize compositor for hardware draw. Can only be called
60 // while compositor is in software only mode, either after compositor is 70 // while compositor is in software only mode, either after compositor is
61 // first created or after ReleaseHwDraw is called. It is invalid to 71 // first created or after ReleaseHwDraw is called. It is invalid to
62 // DemandDrawHw before this returns true. |surface| is the GLSurface that 72 // DemandDrawHw before this returns true. |surface| is the GLSurface that
63 // should be used to create the underlying hardware context. 73 // should be used to create the underlying hardware context.
64 virtual bool InitializeHwDraw(scoped_refptr<gfx::GLSurface> surface) = 0; 74 virtual bool InitializeHwDraw(scoped_refptr<gfx::GLSurface> surface) = 0;
65 75
66 // Reverse of InitializeHwDraw above. Can only be called while hardware draw 76 // Reverse of InitializeHwDraw above. Can only be called while hardware draw
67 // is already initialized. Brings compositor back to software only mode and 77 // is already initialized. Brings compositor back to software only mode and
68 // releases all hardware resources. 78 // releases all hardware resources.
69 virtual void ReleaseHwDraw() = 0; 79 virtual void ReleaseHwDraw() = 0;
70 80
71 // "On demand" hardware draw. The content is first clipped to |damage_area|, 81 // "On demand" hardware draw. The content is first clipped to |damage_area|,
72 // then transformed through |transform|, and finally clipped to |view_size| 82 // then transformed through |transform|, and finally clipped to |view_size|
73 // and by the existing stencil buffer if any. 83 // and by the existing stencil buffer if any.
74 virtual bool DemandDrawHw( 84 virtual bool DemandDrawHw(gfx::Size surface_size,
75 gfx::Size surface_size, 85 const gfx::Transform& transform,
76 const gfx::Transform& transform, 86 gfx::Rect viewport,
77 gfx::Rect viewport, 87 gfx::Rect clip,
78 gfx::Rect clip, 88 bool stencil_enabled,
79 bool stencil_enabled) = 0; 89 cc::CompositorFrame* frame) = 0;
90
91 virtual bool DemandDrawDelegated(const gfx::Transform& transform,
92 gfx::Rect viewport,
93 gfx::Rect clip,
94 cc::CompositorFrame* frame) = 0;
80 95
81 // "On demand" SW draw, into the supplied canvas (observing the transform 96 // "On demand" SW draw, into the supplied canvas (observing the transform
82 // and clip set there-in). 97 // and clip set there-in).
83 virtual bool DemandDrawSw(SkCanvas* canvas) = 0; 98 virtual bool DemandDrawSw(SkCanvas* canvas,
99 cc::CompositorFrame* frame) = 0;
100
101 virtual void ReturnResources(const cc::CompositorFrameAck* frame_ack) = 0;
84 102
85 // Set the memory limit policy of this compositor. 103 // Set the memory limit policy of this compositor.
86 virtual void SetMemoryPolicy( 104 virtual void SetMemoryPolicy(
87 const SynchronousCompositorMemoryPolicy& policy) = 0; 105 const SynchronousCompositorMemoryPolicy& policy) = 0;
88 106
89 // Should be called by the embedder after the embedder had modified the 107 // Should be called by the embedder after the embedder had modified the
90 // scroll offset of the root layer (as returned by 108 // scroll offset of the root layer (as returned by
91 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). 109 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset).
92 virtual void DidChangeRootLayerScrollOffset() = 0; 110 virtual void DidChangeRootLayerScrollOffset() = 0;
93 111
94 protected: 112 protected:
95 virtual ~SynchronousCompositor() {} 113 virtual ~SynchronousCompositor() {}
96 }; 114 };
97 115
98 } // namespace content 116 } // namespace content
99 117
100 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ 118 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698