| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "cc/ipc/display_compositor.mojom.h" |
| 19 #include "content/browser/compositor/image_transport_factory.h" | 20 #include "content/browser/compositor/image_transport_factory.h" |
| 20 #include "gpu/ipc/client/gpu_channel_host.h" | 21 #include "gpu/ipc/client/gpu_channel_host.h" |
| 22 #include "mojo/public/cpp/bindings/binding.h" |
| 21 #include "ui/compositor/compositor.h" | 23 #include "ui/compositor/compositor.h" |
| 22 | 24 |
| 23 namespace cc { | 25 namespace cc { |
| 24 class SingleThreadTaskGraphRunner; | 26 class SingleThreadTaskGraphRunner; |
| 25 class SoftwareOutputDevice; | 27 class SoftwareOutputDevice; |
| 26 class SurfaceManager; | 28 class SurfaceManager; |
| 27 class VulkanInProcessContextProvider; | 29 class VulkanInProcessContextProvider; |
| 28 } | 30 } |
| 29 | 31 |
| 30 namespace ui { | 32 namespace ui { |
| 31 class ContextProviderCommandBuffer; | 33 class ContextProviderCommandBuffer; |
| 32 } | 34 } |
| 33 | 35 |
| 34 namespace content { | 36 namespace content { |
| 35 class OutputDeviceBacking; | 37 class OutputDeviceBacking; |
| 36 | 38 |
| 37 class GpuProcessTransportFactory : public ui::ContextFactory, | 39 class GpuProcessTransportFactory : public ui::ContextFactory, |
| 38 public ui::ContextFactoryPrivate, | 40 public ui::ContextFactoryPrivate, |
| 39 public ImageTransportFactory { | 41 public ImageTransportFactory, |
| 42 public cc::mojom::DisplayCompositorClient { |
| 40 public: | 43 public: |
| 41 GpuProcessTransportFactory(); | 44 GpuProcessTransportFactory(); |
| 42 | 45 |
| 43 ~GpuProcessTransportFactory() override; | 46 ~GpuProcessTransportFactory() override; |
| 44 | 47 |
| 45 // ui::ContextFactory implementation. | 48 // ui::ContextFactory implementation. |
| 46 void CreateCompositorFrameSink( | 49 void CreateCompositorFrameSink( |
| 47 base::WeakPtr<ui::Compositor> compositor) override; | 50 base::WeakPtr<ui::Compositor> compositor) override; |
| 48 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override; | 51 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override; |
| 49 uint32_t GetImageTextureTarget(gfx::BufferFormat format, | 52 uint32_t GetImageTextureTarget(gfx::BufferFormat format, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 base::TimeDelta interval) override; | 72 base::TimeDelta interval) override; |
| 70 void SetDisplayVSyncParameters(ui::Compositor* compositor, | 73 void SetDisplayVSyncParameters(ui::Compositor* compositor, |
| 71 base::TimeTicks timebase, | 74 base::TimeTicks timebase, |
| 72 base::TimeDelta interval) override; | 75 base::TimeDelta interval) override; |
| 73 void SetOutputIsSecure(ui::Compositor* compositor, bool secure) override; | 76 void SetOutputIsSecure(ui::Compositor* compositor, bool secure) override; |
| 74 | 77 |
| 75 // ImageTransportFactory implementation. | 78 // ImageTransportFactory implementation. |
| 76 ui::ContextFactory* GetContextFactory() override; | 79 ui::ContextFactory* GetContextFactory() override; |
| 77 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; | 80 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; |
| 78 cc::SurfaceManager* GetSurfaceManager() override; | 81 cc::SurfaceManager* GetSurfaceManager() override; |
| 82 display_compositor::DisplayCompositor* GetDisplayCompositor() override; |
| 79 display_compositor::GLHelper* GetGLHelper() override; | 83 display_compositor::GLHelper* GetGLHelper() override; |
| 80 void SetGpuChannelEstablishFactory( | 84 void SetGpuChannelEstablishFactory( |
| 81 gpu::GpuChannelEstablishFactory* factory) override; | 85 gpu::GpuChannelEstablishFactory* factory) override; |
| 82 #if defined(OS_MACOSX) | 86 #if defined(OS_MACOSX) |
| 83 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, | 87 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, |
| 84 bool suspended) override; | 88 bool suspended) override; |
| 85 #endif | 89 #endif |
| 86 | 90 |
| 91 // cc::mojom::DisplayCompositorClient: |
| 92 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; |
| 93 |
| 87 private: | 94 private: |
| 88 struct PerCompositorData; | 95 struct PerCompositorData; |
| 89 | 96 |
| 90 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); | 97 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); |
| 91 std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( | 98 std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( |
| 92 ui::Compositor* compositor); | 99 ui::Compositor* compositor); |
| 93 void EstablishedGpuChannel( | 100 void EstablishedGpuChannel( |
| 94 base::WeakPtr<ui::Compositor> compositor, | 101 base::WeakPtr<ui::Compositor> compositor, |
| 95 bool create_gpu_output_surface, | 102 bool create_gpu_output_surface, |
| 96 int num_attempts, | 103 int num_attempts, |
| 97 scoped_refptr<gpu::GpuChannelHost> established_channel_host); | 104 scoped_refptr<gpu::GpuChannelHost> established_channel_host); |
| 98 | 105 |
| 99 void OnLostMainThreadSharedContextInsideCallback(); | 106 void OnLostMainThreadSharedContextInsideCallback(); |
| 100 void OnLostMainThreadSharedContext(); | 107 void OnLostMainThreadSharedContext(); |
| 101 | 108 |
| 102 scoped_refptr<cc::VulkanInProcessContextProvider> | 109 scoped_refptr<cc::VulkanInProcessContextProvider> |
| 103 SharedVulkanContextProvider(); | 110 SharedVulkanContextProvider(); |
| 104 | 111 |
| 105 std::unique_ptr<cc::SurfaceManager> surface_manager_; | 112 mojo::Binding<cc::mojom::DisplayCompositorClient> |
| 113 display_compositor_client_binding_; |
| 114 cc::mojom::DisplayCompositorPtr display_compositor_ptr_; |
| 115 |
| 116 std::unique_ptr<display_compositor::DisplayCompositor> display_compositor_; |
| 106 uint32_t next_sink_id_ = 1u; | 117 uint32_t next_sink_id_ = 1u; |
| 107 | 118 |
| 108 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
| 109 // Used by output surface, stored in PerCompositorData. | 120 // Used by output surface, stored in PerCompositorData. |
| 110 std::unique_ptr<OutputDeviceBacking> software_backing_; | 121 std::unique_ptr<OutputDeviceBacking> software_backing_; |
| 111 #endif | 122 #endif |
| 112 | 123 |
| 113 // Depends on SurfaceManager. | 124 // Depends on SurfaceManager. |
| 114 typedef std::map<ui::Compositor*, std::unique_ptr<PerCompositorData>> | 125 typedef std::map<ui::Compositor*, std::unique_ptr<PerCompositorData>> |
| 115 PerCompositorDataMap; | 126 PerCompositorDataMap; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 129 gpu::GpuChannelEstablishFactory* gpu_channel_factory_ = nullptr; | 140 gpu::GpuChannelEstablishFactory* gpu_channel_factory_ = nullptr; |
| 130 | 141 |
| 131 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; | 142 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; |
| 132 | 143 |
| 133 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); | 144 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); |
| 134 }; | 145 }; |
| 135 | 146 |
| 136 } // namespace content | 147 } // namespace content |
| 137 | 148 |
| 138 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 149 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
| OLD | NEW |