| 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 "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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace gpu { | 25 namespace gpu { |
| 26 class GLInProcessContext; | 26 class GLInProcessContext; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 | 30 |
| 31 class SynchronousCompositorClient; | 31 class SynchronousCompositorClient; |
| 32 class WebContents; | 32 class WebContents; |
| 33 | 33 |
| 34 struct CONTENT_EXPORT SynchronousCompositorMemoryPolicy { | |
| 35 // Memory limit for rendering and pre-rendering. | |
| 36 size_t bytes_limit; | |
| 37 | |
| 38 // Limit of number of GL resources used for rendering and pre-rendering. | |
| 39 size_t num_resources_limit; | |
| 40 | |
| 41 SynchronousCompositorMemoryPolicy(); | |
| 42 | |
| 43 bool operator==(const SynchronousCompositorMemoryPolicy& other) const; | |
| 44 bool operator!=(const SynchronousCompositorMemoryPolicy& other) const; | |
| 45 }; | |
| 46 | |
| 47 // Interface for embedders that wish to direct compositing operations | 34 // Interface for embedders that wish to direct compositing operations |
| 48 // synchronously under their own control. Only meaningful when the | 35 // synchronously under their own control. Only meaningful when the |
| 49 // kEnableSyncrhonousRendererCompositor flag is specified. | 36 // kEnableSyncrhonousRendererCompositor flag is specified. |
| 50 class CONTENT_EXPORT SynchronousCompositor { | 37 class CONTENT_EXPORT SynchronousCompositor { |
| 51 public: | 38 public: |
| 52 // Must be called once per WebContents instance. Will create the compositor | 39 // Must be called once per WebContents instance. Will create the compositor |
| 53 // instance as needed, but only if |client| is non-NULL. | 40 // instance as needed, but only if |client| is non-NULL. |
| 54 static void SetClientForWebContents(WebContents* contents, | 41 static void SetClientForWebContents(WebContents* contents, |
| 55 SynchronousCompositorClient* client); | 42 SynchronousCompositorClient* client); |
| 56 | 43 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 79 |
| 93 // For delegated rendering, return resources from parent compositor to this. | 80 // For delegated rendering, return resources from parent compositor to this. |
| 94 // Note that all resources must be returned before ReleaseHwDraw. | 81 // Note that all resources must be returned before ReleaseHwDraw. |
| 95 virtual void ReturnResources(const cc::CompositorFrameAck& frame_ack) = 0; | 82 virtual void ReturnResources(const cc::CompositorFrameAck& frame_ack) = 0; |
| 96 | 83 |
| 97 // "On demand" SW draw, into the supplied canvas (observing the transform | 84 // "On demand" SW draw, into the supplied canvas (observing the transform |
| 98 // and clip set there-in). | 85 // and clip set there-in). |
| 99 virtual bool DemandDrawSw(SkCanvas* canvas) = 0; | 86 virtual bool DemandDrawSw(SkCanvas* canvas) = 0; |
| 100 | 87 |
| 101 // Set the memory limit policy of this compositor. | 88 // Set the memory limit policy of this compositor. |
| 102 virtual void SetMemoryPolicy( | 89 virtual void SetMemoryPolicy(size_t bytes_limit) = 0; |
| 103 const SynchronousCompositorMemoryPolicy& policy) = 0; | |
| 104 | 90 |
| 105 // Should be called by the embedder after the embedder had modified the | 91 // Should be called by the embedder after the embedder had modified the |
| 106 // scroll offset of the root layer (as returned by | 92 // scroll offset of the root layer (as returned by |
| 107 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). | 93 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). |
| 108 virtual void DidChangeRootLayerScrollOffset() = 0; | 94 virtual void DidChangeRootLayerScrollOffset() = 0; |
| 109 | 95 |
| 110 protected: | 96 protected: |
| 111 virtual ~SynchronousCompositor() {} | 97 virtual ~SynchronousCompositor() {} |
| 112 }; | 98 }; |
| 113 | 99 |
| 114 } // namespace content | 100 } // namespace content |
| 115 | 101 |
| 116 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 102 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
| OLD | NEW |