| 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/callback.h" |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "cc/blink/context_provider_web_context.h" |
| 9 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 10 #include "gpu/command_buffer/service/in_process_command_buffer.h" | 12 #include "gpu/command_buffer/service/in_process_command_buffer.h" |
| 13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 12 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
| 13 | 16 |
| 14 class SkCanvas; | 17 class SkCanvas; |
| 15 | 18 |
| 16 namespace cc { | 19 namespace cc { |
| 17 class CompositorFrame; | 20 class CompositorFrame; |
| 18 class CompositorFrameAck; | 21 class CompositorFrameAck; |
| 19 } | 22 } |
| 20 | 23 |
| 21 namespace gfx { | 24 namespace gfx { |
| 22 class Transform; | 25 class Transform; |
| 23 }; | 26 } |
| 24 | 27 |
| 25 namespace gpu { | 28 namespace gpu { |
| 26 class GLInProcessContext; | 29 class GLInProcessContext; |
| 30 struct GLInProcessContextSharedMemoryLimits; |
| 27 } | 31 } |
| 28 | 32 |
| 29 namespace content { | 33 namespace content { |
| 30 | 34 |
| 31 class SynchronousCompositorClient; | 35 class SynchronousCompositorClient; |
| 32 class WebContents; | 36 class WebContents; |
| 33 | 37 |
| 34 // Interface for embedders that wish to direct compositing operations | 38 // Interface for embedders that wish to direct compositing operations |
| 35 // synchronously under their own control. Only meaningful when the | 39 // synchronously under their own control. Only meaningful when the |
| 36 // kEnableSyncrhonousRendererCompositor flag is specified. | 40 // kEnableSyncrhonousRendererCompositor flag is specified. |
| 37 class CONTENT_EXPORT SynchronousCompositor { | 41 class CONTENT_EXPORT SynchronousCompositor { |
| 38 public: | 42 public: |
| 43 struct CONTENT_EXPORT ContextHolder { |
| 44 ContextHolder(); |
| 45 ~ContextHolder(); |
| 46 |
| 47 scoped_refptr<cc_blink::ContextProviderWebContext> context_provider; |
| 48 gpu::GLInProcessContext* context; |
| 49 }; |
| 50 |
| 39 // Must be called once per WebContents instance. Will create the compositor | 51 // Must be called once per WebContents instance. Will create the compositor |
| 40 // instance as needed, but only if |client| is non-nullptr. | 52 // instance as needed, but only if |client| is non-nullptr. |
| 41 static void SetClientForWebContents(WebContents* contents, | 53 static void SetClientForWebContents(WebContents* contents, |
| 42 SynchronousCompositorClient* client); | 54 SynchronousCompositorClient* client); |
| 43 | 55 |
| 56 typedef base::Callback<ContextHolder( |
| 57 bool /* need_share_group_with_parent */, |
| 58 const blink::WebGraphicsContext3D::Attributes& /* attributes */, |
| 59 bool /* is_offscreen */, |
| 60 const gpu::GLInProcessContextSharedMemoryLimits& /* mem_limits */)> |
| 61 CreateContextCallback; |
| 62 static void SetCreateContextCallback(CreateContextCallback callback); |
| 63 |
| 44 static void SetGpuService( | 64 static void SetGpuService( |
| 45 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); | 65 scoped_refptr<gpu::InProcessCommandBuffer::Service> service); |
| 46 | 66 |
| 47 // By default, synchronous compopsitor records the full layer, not only | 67 // By default, synchronous compopsitor records the full layer, not only |
| 48 // what is inside and around the view port. This can be used to switch | 68 // what is inside and around the view port. This can be used to switch |
| 49 // between this record-full-layer behavior and normal record-around-viewport | 69 // between this record-full-layer behavior and normal record-around-viewport |
| 50 // behavior. | 70 // behavior. |
| 51 static void SetRecordFullDocument(bool record_full_document); | 71 static void SetRecordFullDocument(bool record_full_document); |
| 52 | 72 |
| 53 // Synchronously initialize compositor for hardware draw. Can only be called | 73 // Synchronously initialize compositor for hardware draw. Can only be called |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). | 107 // SynchronousCompositorClient::GetTotalRootLayerScrollOffset). |
| 88 virtual void DidChangeRootLayerScrollOffset() = 0; | 108 virtual void DidChangeRootLayerScrollOffset() = 0; |
| 89 | 109 |
| 90 protected: | 110 protected: |
| 91 virtual ~SynchronousCompositor() {} | 111 virtual ~SynchronousCompositor() {} |
| 92 }; | 112 }; |
| 93 | 113 |
| 94 } // namespace content | 114 } // namespace content |
| 95 | 115 |
| 96 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ | 116 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_SYNCHRONOUS_COMPOSITOR_H_ |
| OLD | NEW |