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