| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class ScopedAppGLStateRestore; | 33 class ScopedAppGLStateRestore; |
| 34 | 34 |
| 35 class SurfacesInstance : public base::RefCounted<SurfacesInstance>, | 35 class SurfacesInstance : public base::RefCounted<SurfacesInstance>, |
| 36 public cc::DisplayClient, | 36 public cc::DisplayClient, |
| 37 public cc::SurfaceFactoryClient { | 37 public cc::SurfaceFactoryClient { |
| 38 public: | 38 public: |
| 39 static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); | 39 static scoped_refptr<SurfacesInstance> GetOrCreateInstance(); |
| 40 | 40 |
| 41 uint32_t AllocateSurfaceClientId(); | 41 uint32_t AllocateSurfaceClientId(); |
| 42 cc::SurfaceManager* GetSurfaceManager(); | 42 cc::SurfaceManager* GetSurfaceManager(); |
| 43 void SetBackingFrameBufferObject(int framebuffer_binding_ext); | |
| 44 | 43 |
| 45 void DrawAndSwap(const gfx::Size& viewport, | 44 void DrawAndSwap(const gfx::Size& viewport, |
| 46 const gfx::Rect& clip, | 45 const gfx::Rect& clip, |
| 47 const gfx::Transform& transform, | 46 const gfx::Transform& transform, |
| 48 const gfx::Size& frame_size, | 47 const gfx::Size& frame_size, |
| 49 const cc::SurfaceId& child_id, | 48 const cc::SurfaceId& child_id); |
| 50 const ScopedAppGLStateRestore& gl_state); | |
| 51 | 49 |
| 52 void AddChildId(const cc::SurfaceId& child_id); | 50 void AddChildId(const cc::SurfaceId& child_id); |
| 53 void RemoveChildId(const cc::SurfaceId& child_id); | 51 void RemoveChildId(const cc::SurfaceId& child_id); |
| 54 | 52 |
| 55 private: | 53 private: |
| 56 friend class base::RefCounted<SurfacesInstance>; | 54 friend class base::RefCounted<SurfacesInstance>; |
| 57 | 55 |
| 58 SurfacesInstance(); | 56 SurfacesInstance(); |
| 59 ~SurfacesInstance() override; | 57 ~SurfacesInstance() override; |
| 60 | 58 |
| 61 // cc::DisplayClient overrides. | 59 // cc::DisplayClient overrides. |
| 62 void DisplayOutputSurfaceLost() override {} | 60 void DisplayOutputSurfaceLost() override {} |
| 63 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override {} | 61 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override {} |
| 64 void DisplayWillDrawAndSwap( | 62 void DisplayWillDrawAndSwap( |
| 65 bool will_draw_and_swap, | 63 bool will_draw_and_swap, |
| 66 const cc::RenderPassList& render_passes) override {} | 64 const cc::RenderPassList& render_passes) override {} |
| 67 void DisplayDidDrawAndSwap() override {} | 65 void DisplayDidDrawAndSwap() override {} |
| 68 | 66 |
| 69 // cc::SurfaceFactoryClient implementation. | 67 // cc::SurfaceFactoryClient implementation. |
| 70 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 68 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 71 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 69 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 72 | 70 |
| 73 void SetEmptyRootFrame(); | 71 void SetEmptyRootFrame(); |
| 74 | 72 |
| 75 uint32_t next_surface_client_id_; | 73 uint32_t next_surface_client_id_; |
| 76 | 74 |
| 77 scoped_refptr<AwGLSurface> gl_surface_; | |
| 78 std::unique_ptr<cc::SurfaceManager> surface_manager_; | 75 std::unique_ptr<cc::SurfaceManager> surface_manager_; |
| 79 std::unique_ptr<cc::Display> display_; | 76 std::unique_ptr<cc::Display> display_; |
| 80 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 77 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
| 81 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | 78 std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
| 82 | 79 |
| 83 cc::SurfaceId root_id_; | 80 cc::SurfaceId root_id_; |
| 84 std::vector<cc::SurfaceId> child_ids_; | 81 std::vector<cc::SurfaceId> child_ids_; |
| 85 | 82 |
| 86 // This is owned by |display_|. | 83 // This is owned by |display_|. |
| 87 ParentOutputSurface* output_surface_; | 84 ParentOutputSurface* output_surface_; |
| 88 | 85 |
| 89 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance); | 86 DISALLOW_COPY_AND_ASSIGN(SurfacesInstance); |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 } // namespace android_webview | 89 } // namespace android_webview |
| 93 | 90 |
| 94 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ | 91 #endif // ANDROID_WEBVIEW_BROWSER_SURFACES_INSTANCE_H_ |
| OLD | NEW |