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_factory_client.h" |
| 15 #include "cc/surfaces/surface_id.h" | 16 #include "cc/surfaces/surface_id.h" |
| 16 | 17 |
| 17 namespace cc { | 18 namespace cc { |
| 18 class Display; | 19 class CompositorFrameSinkSupport; |
| 19 class SurfaceIdAllocator; | 20 class SurfaceIdAllocator; |
| 20 class SurfaceFactory; | |
| 21 class SurfaceManager; | 21 class SurfaceManager; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace gfx { | 24 namespace gfx { |
| 25 class Rect; | 25 class Rect; |
| 26 class Size; | 26 class Size; |
| 27 class Transform; | 27 class Transform; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace android_webview { | 30 namespace android_webview { |
| 31 | 31 |
| 32 class ParentOutputSurface; | 32 class ParentOutputSurface; |
| 33 | 33 |
| 34 class SurfacesInstance : public base::RefCounted<SurfacesInstance>, | 34 class SurfacesInstance : public base::RefCounted<SurfacesInstance>, |
| 35 public cc::DisplayClient, | 35 public cc::CompositorFrameSinkSupportClient { |
| 36 public cc::SurfaceFactoryClient { | |
| 37 public: | 36 public: |
| 38 static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); | 37 static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); |
| 39 | 38 |
| 40 cc::FrameSinkId AllocateFrameSinkId(); | 39 cc::FrameSinkId AllocateFrameSinkId(); |
| 41 cc::SurfaceManager* GetSurfaceManager(); | 40 cc::SurfaceManager* GetSurfaceManager(); |
| 42 | 41 |
| 43 void DrawAndSwap(const gfx::Size& viewport, | 42 void DrawAndSwap(const gfx::Size& viewport, |
| 44 const gfx::Rect& clip, | 43 const gfx::Rect& clip, |
| 45 const gfx::Transform& transform, | 44 const gfx::Transform& transform, |
| 46 const gfx::Size& frame_size, | 45 const gfx::Size& frame_size, |
| 47 const cc::SurfaceId& child_id); | 46 const cc::SurfaceId& child_id); |
| 48 | 47 |
| 49 void AddChildId(const cc::SurfaceId& child_id); | 48 void AddChildId(const cc::SurfaceId& child_id); |
| 50 void RemoveChildId(const cc::SurfaceId& child_id); | 49 void RemoveChildId(const cc::SurfaceId& child_id); |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 friend class base::RefCounted<SurfacesInstance>; | 52 friend class base::RefCounted<SurfacesInstance>; |
| 54 | 53 |
| 55 SurfacesInstance(); | 54 SurfacesInstance(); |
| 56 ~SurfacesInstance() override; | 55 ~SurfacesInstance() override; |
| 57 | 56 |
| 58 // cc::DisplayClient overrides. | 57 void SetEmptyRootFrame(); |
| 58 | |
| 59 // cc::CompositorFrameSinkSupport implementation. | |
|
boliu
2017/01/24 17:41:50
CompositorFrameSinkSupportClient
Saman Sami
2017/01/24 17:44:57
Done.
| |
| 60 void DidReceiveCompositorFrameAck() override {} | |
|
boliu
2017/01/24 17:41:50
there is no need to override methods that are no-o
Saman Sami
2017/01/24 17:44:57
It's a pure virtual in the parent.
boliu
2017/01/24 17:50:57
Oh oops, misread. Then the question is why are the
| |
| 61 void OnBeginFrame(const cc::BeginFrameArgs& args) override {} | |
| 62 void WillDrawSurface() override {} | |
| 63 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | |
| 59 void DisplayOutputSurfaceLost() override; | 64 void DisplayOutputSurfaceLost() override; |
| 60 void DisplayWillDrawAndSwap( | |
| 61 bool will_draw_and_swap, | |
| 62 const cc::RenderPassList& render_passes) override {} | |
| 63 void DisplayDidDrawAndSwap() override {} | |
| 64 | |
| 65 // cc::SurfaceFactoryClient implementation. | |
| 66 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 67 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
| 68 | |
| 69 void SetEmptyRootFrame(); | |
| 70 | 65 |
| 71 uint32_t next_client_id_; | 66 uint32_t next_client_id_; |
| 72 | 67 |
| 73 cc::FrameSinkId frame_sink_id_; | 68 cc::FrameSinkId frame_sink_id_; |
| 74 | 69 |
| 75 std::unique_ptr<cc::SurfaceManager> surface_manager_; | 70 std::unique_ptr<cc::SurfaceManager> surface_manager_; |
| 76 std::unique_ptr<cc::BeginFrameSource> begin_frame_source_; | |
| 77 std::unique_ptr<cc::Display> display_; | |
| 78 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 71 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 79 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | 72 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
| 80 | 73 |
| 81 cc::LocalFrameId root_id_; | 74 cc::LocalFrameId root_id_; |
| 82 std::vector<cc::SurfaceId> child_ids_; | 75 std::vector<cc::SurfaceId> child_ids_; |
| 83 | 76 |
| 84 // This is owned by |display_|. | 77 // This is owned by |display_|. |
| 85 ParentOutputSurface* output_surface_; | 78 ParentOutputSurface* output_surface_; |
| 86 | 79 |
| 87 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance); | 80 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance); |
| 88 }; | 81 }; |
| 89 | 82 |
| 90 } // namespace android_webview | 83 } // namespace android_webview |
| 91 | 84 |
| 92 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ | 85 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ |
| OLD | NEW |