Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "cc/surfaces/compositor_frame_sink_support_client.h" | |
| 12 #include "cc/surfaces/display_client.h" | 13 #include "cc/surfaces/display_client.h" |
| 13 #include "cc/surfaces/frame_sink_id.h" | 14 #include "cc/surfaces/frame_sink_id.h" |
| 14 #include "cc/surfaces/surface_factory_client.h" | |
| 15 #include "cc/surfaces/surface_id.h" | 15 #include "cc/surfaces/surface_id.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 class BeginFrameSource; | |
| 19 class CompositorFrameSinkSupport; | |
| 18 class Display; | 20 class Display; |
| 19 class SurfaceIdAllocator; | 21 class SurfaceIdAllocator; |
| 20 class SurfaceFactory; | |
| 21 class SurfaceManager; | 22 class SurfaceManager; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace gfx { | 25 namespace gfx { |
| 25 class Rect; | 26 class Rect; |
| 26 class Size; | 27 class Size; |
| 27 class Transform; | 28 class Transform; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace android_webview { | 31 namespace android_webview { |
| 31 | 32 |
| 32 class ParentOutputSurface; | 33 class ParentOutputSurface; |
| 33 | 34 |
| 34 class SurfacesInstance : public base::RefCounted<SurfacesInstance>, | 35 class SurfacesInstance : public base::RefCounted<SurfacesInstance>, |
| 35 public cc::DisplayClient, | 36 public cc::DisplayClient, |
| 36 public cc::SurfaceFactoryClient { | 37 public cc::CompositorFrameSinkSupportClient { |
| 37 public: | 38 public: |
| 38 static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); | 39 static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); |
| 39 | 40 |
| 40 cc::FrameSinkId AllocateFrameSinkId(); | 41 cc::FrameSinkId AllocateFrameSinkId(); |
| 41 cc::SurfaceManager* GetSurfaceManager(); | 42 cc::SurfaceManager* GetSurfaceManager(); |
| 42 | 43 |
| 43 void DrawAndSwap(const gfx::Size& viewport, | 44 void DrawAndSwap(const gfx::Size& viewport, |
| 44 const gfx::Rect& clip, | 45 const gfx::Rect& clip, |
| 45 const gfx::Transform& transform, | 46 const gfx::Transform& transform, |
| 46 const gfx::Size& frame_size, | 47 const gfx::Size& frame_size, |
| 47 const cc::SurfaceId& child_id); | 48 const cc::SurfaceId& child_id); |
| 48 | 49 |
| 49 void AddChildId(const cc::SurfaceId& child_id); | 50 void AddChildId(const cc::SurfaceId& child_id); |
| 50 void RemoveChildId(const cc::SurfaceId& child_id); | 51 void RemoveChildId(const cc::SurfaceId& child_id); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 friend class base::RefCounted<SurfacesInstance>; | 54 friend class base::RefCounted<SurfacesInstance>; |
| 54 | 55 |
| 55 SurfacesInstance(); | 56 SurfacesInstance(); |
| 56 ~SurfacesInstance() override; | 57 ~SurfacesInstance() override; |
| 57 | 58 |
| 58 // cc::DisplayClient overrides. | 59 // cc::DisplayClient overrides. |
| 59 void DisplayOutputSurfaceLost() override; | 60 void DisplayOutputSurfaceLost() override; |
| 60 void DisplayWillDrawAndSwap( | 61 void DisplayWillDrawAndSwap( |
| 61 bool will_draw_and_swap, | 62 bool will_draw_and_swap, |
| 62 const cc::RenderPassList& render_passes) override {} | 63 const cc::RenderPassList& render_passes) override {} |
| 63 void DisplayDidDrawAndSwap() override {} | 64 void DisplayDidDrawAndSwap() override {} |
| 64 | 65 |
| 65 // cc::SurfaceFactoryClient implementation. | 66 // cc::CompositorFrameSinkSupportClient implementation. |
| 66 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 67 void DidReceiveCompositorFrameAck() override {} |
|
Fady Samuel
2017/02/13 17:54:09
Empty impl in cc body is the preferred style for v
Saman Sami
2017/02/13 18:09:22
Done.
| |
| 67 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 68 void OnBeginFrame(const cc::BeginFrameArgs& args) override {} |
|
Fady Samuel
2017/02/13 17:54:09
Empty impl in cc body is the preferred style for v
Saman Sami
2017/02/13 18:09:22
Done.
| |
| 69 void WillDrawSurface() override {} | |
|
Fady Samuel
2017/02/13 17:54:09
Empty impl in cc body is the preferred style for v
Saman Sami
2017/02/13 18:09:22
Done.
| |
| 70 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | |
| 68 | 71 |
| 69 void SetEmptyRootFrame(); | 72 void SetEmptyRootFrame(); |
| 70 | 73 |
| 71 uint32_t next_client_id_; | 74 uint32_t next_client_id_; |
| 72 | 75 |
| 73 cc::FrameSinkId frame_sink_id_; | 76 cc::FrameSinkId frame_sink_id_; |
| 74 | 77 |
| 75 std::unique_ptr<cc::SurfaceManager> surface_manager_; | 78 std::unique_ptr<cc::SurfaceManager> surface_manager_; |
| 76 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; | 79 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; |
| 77 std::unique_ptr<cc::Display> display_; | 80 std::unique_ptr<cc::Display> display_; |
| 78 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 81 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 79 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | 82 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
| 80 | 83 |
| 81 cc::LocalSurfaceId root_id_; | 84 cc::LocalSurfaceId root_id_; |
| 82 std::vector<cc::SurfaceId> child_ids_; | 85 std::vector<cc::SurfaceId> child_ids_; |
| 83 | 86 |
| 84 // This is owned by |display_|. | 87 // This is owned by |display_|. |
| 85 ParentOutputSurface* output_surface_; | 88 ParentOutputSurface* output_surface_; |
| 86 | 89 |
| 87 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance); | 90 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance); |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 } // namespace android_webview | 93 } // namespace android_webview |
| 91 | 94 |
| 92 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ | 95 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ |
| OLD | NEW |