OLD | NEW |
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 "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
9 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
11 | 12 |
12 class SkCanvas; | 13 class SkCanvas; |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
| 16 class GLSurface; |
15 class Transform; | 17 class Transform; |
16 }; | 18 }; |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 | 21 |
20 class WebContents; | 22 class WebContents; |
21 | 23 |
22 class SynchronousCompositorClient; | 24 class SynchronousCompositorClient; |
23 | 25 |
24 // Interface for embedders that wish to direct compositing operations | 26 // Interface for embedders that wish to direct compositing operations |
25 // synchronously under their own control. Only meaningful when the | 27 // synchronously under their own control. Only meaningful when the |
26 // kEnableSyncrhonousRendererCompositor flag is specified. | 28 // kEnableSyncrhonousRendererCompositor flag is specified. |
27 class CONTENT_EXPORT SynchronousCompositor { | 29 class CONTENT_EXPORT SynchronousCompositor { |
28 public: | 30 public: |
29 // Must be called once per WebContents instance. Will create the compositor | 31 // Must be called once per WebContents instance. Will create the compositor |
30 // instance as needed, but only if |client| is non-NULL. | 32 // instance as needed, but only if |client| is non-NULL. |
31 static void SetClientForWebContents(WebContents* contents, | 33 static void SetClientForWebContents(WebContents* contents, |
32 SynchronousCompositorClient* client); | 34 SynchronousCompositorClient* client); |
33 | 35 |
34 // Allows changing or resetting the client to NULL (this must be used if | 36 // Allows changing or resetting the client to NULL (this must be used if |
35 // the client is being deleted prior to the DidDestroyCompositor() call | 37 // the client is being deleted prior to the DidDestroyCompositor() call |
36 // being received by the client). Ownership of |client| remains with | 38 // being received by the client). Ownership of |client| remains with |
37 // the caller. | 39 // the caller. |
38 virtual void SetClient(SynchronousCompositorClient* client) = 0; | 40 virtual void SetClient(SynchronousCompositorClient* client) = 0; |
39 | 41 |
40 // Synchronously initialize compositor for hardware draw. Can only be called | 42 // Synchronously initialize compositor for hardware draw. Can only be called |
41 // while compositor is in software only mode, either after compositor is | 43 // while compositor is in software only mode, either after compositor is |
42 // first created or after ReleaseHwDraw is called. It is invalid to | 44 // first created or after ReleaseHwDraw is called. It is invalid to |
43 // DemandDrawHw before this returns true. | 45 // DemandDrawHw before this returns true. |surface| is the GLSurface that |
44 virtual bool InitializeHwDraw() = 0; | 46 // should be used to create the underlying hardware context. |
| 47 virtual bool InitializeHwDraw(scoped_refptr<gfx::GLSurface> surface) = 0; |
45 | 48 |
46 // Reverse of InitializeHwDraw above. Can only be called while hardware draw | 49 // Reverse of InitializeHwDraw above. Can only be called while hardware draw |
47 // is already initialized. Brings compositor back to software only mode and | 50 // is already initialized. Brings compositor back to software only mode and |
48 // releases all hardware resources. | 51 // releases all hardware resources. |
49 virtual void ReleaseHwDraw() = 0; | 52 virtual void ReleaseHwDraw() = 0; |
50 | 53 |
51 // "On demand" hardware draw. The content is first clipped to |damage_area|, | 54 // "On demand" hardware draw. The content is first clipped to |damage_area|, |
52 // then transformed through |transform|, and finally clipped to |view_size| | 55 // then transformed through |transform|, and finally clipped to |view_size| |
53 // and by the existing stencil buffer if any. | 56 // and by the existing stencil buffer if any. |
54 virtual bool DemandDrawHw( | 57 virtual bool DemandDrawHw( |
(...skipping 11 matching lines...) Expand all Loading... |
66 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). | 69 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). |
67 virtual void DidChangeRootLayerScrollOffset() = 0; | 70 virtual void DidChangeRootLayerScrollOffset() = 0; |
68 | 71 |
69 protected: | 72 protected: |
70 virtual ~SynchronousCompositor() {} | 73 virtual ~SynchronousCompositor() {} |
71 }; | 74 }; |
72 | 75 |
73 } // namespace content | 76 } // namespace content |
74 | 77 |
75 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 78 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
OLD | NEW |