Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.h

Issue 2789753002: Convert offscreen canvas to use FrameSinkManagerHost. (Closed)
Patch Set: Lower similarity. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "cc/surfaces/frame_sink_id_allocator.h" 20 #include "cc/surfaces/frame_sink_id_allocator.h"
20 #include "content/browser/compositor/image_transport_factory.h" 21 #include "content/browser/compositor/image_transport_factory.h"
21 #include "gpu/ipc/client/gpu_channel_host.h" 22 #include "gpu/ipc/client/gpu_channel_host.h"
22 #include "ui/compositor/compositor.h" 23 #include "ui/compositor/compositor.h"
23 24
24 namespace cc { 25 namespace cc {
25 class SingleThreadTaskGraphRunner; 26 class SingleThreadTaskGraphRunner;
26 class SoftwareOutputDevice; 27 class SoftwareOutputDevice;
27 class SurfaceManager; 28 class SurfaceManager;
28 class VulkanInProcessContextProvider; 29 class VulkanInProcessContextProvider;
29 } 30 }
30 31
31 namespace ui { 32 namespace ui {
32 class ContextProviderCommandBuffer; 33 class ContextProviderCommandBuffer;
34 class DisplayCompositor;
33 } 35 }
34 36
35 namespace content { 37 namespace content {
36 class OutputDeviceBacking; 38 class OutputDeviceBacking;
37 39
38 class GpuProcessTransportFactory : public ui::ContextFactory, 40 class GpuProcessTransportFactory : public ui::ContextFactory,
39 public ui::ContextFactoryPrivate, 41 public ui::ContextFactoryPrivate,
40 public ImageTransportFactory { 42 public ImageTransportFactory {
41 public: 43 public:
42 GpuProcessTransportFactory(); 44 GpuProcessTransportFactory();
(...skipping 28 matching lines...) Expand all
71 base::TimeDelta interval) override; 73 base::TimeDelta interval) override;
72 void SetDisplayVSyncParameters(ui::Compositor* compositor, 74 void SetDisplayVSyncParameters(ui::Compositor* compositor,
73 base::TimeTicks timebase, 75 base::TimeTicks timebase,
74 base::TimeDelta interval) override; 76 base::TimeDelta interval) override;
75 void SetOutputIsSecure(ui::Compositor* compositor, bool secure) override; 77 void SetOutputIsSecure(ui::Compositor* compositor, bool secure) override;
76 78
77 // ImageTransportFactory implementation. 79 // ImageTransportFactory implementation.
78 ui::ContextFactory* GetContextFactory() override; 80 ui::ContextFactory* GetContextFactory() override;
79 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override; 81 ui::ContextFactoryPrivate* GetContextFactoryPrivate() override;
80 cc::SurfaceManager* GetSurfaceManager() override; 82 cc::SurfaceManager* GetSurfaceManager() override;
83 cc::mojom::DisplayCompositor* GetDisplayCompositor() override;
81 display_compositor::GLHelper* GetGLHelper() override; 84 display_compositor::GLHelper* GetGLHelper() override;
82 void SetGpuChannelEstablishFactory( 85 void SetGpuChannelEstablishFactory(
83 gpu::GpuChannelEstablishFactory* factory) override; 86 gpu::GpuChannelEstablishFactory* factory) override;
84 #if defined(OS_MACOSX) 87 #if defined(OS_MACOSX)
85 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, 88 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor,
86 bool suspended) override; 89 bool suspended) override;
87 #endif 90 #endif
88 91
89 private: 92 private:
90 struct PerCompositorData; 93 struct PerCompositorData;
91 94
92 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); 95 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor);
93 std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( 96 std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
94 ui::Compositor* compositor); 97 ui::Compositor* compositor);
95 void EstablishedGpuChannel( 98 void EstablishedGpuChannel(
96 base::WeakPtr<ui::Compositor> compositor, 99 base::WeakPtr<ui::Compositor> compositor,
97 bool create_gpu_output_surface, 100 bool create_gpu_output_surface,
98 int num_attempts, 101 int num_attempts,
99 scoped_refptr<gpu::GpuChannelHost> established_channel_host); 102 scoped_refptr<gpu::GpuChannelHost> established_channel_host);
100 103
101 void OnLostMainThreadSharedContextInsideCallback(); 104 void OnLostMainThreadSharedContextInsideCallback();
102 void OnLostMainThreadSharedContext(); 105 void OnLostMainThreadSharedContext();
103 106
104 scoped_refptr<cc::VulkanInProcessContextProvider> 107 scoped_refptr<cc::VulkanInProcessContextProvider>
105 SharedVulkanContextProvider(); 108 SharedVulkanContextProvider();
106 109
107 std::unique_ptr<cc::SurfaceManager> surface_manager_; 110 // Once all usage of SurfaceManager is removed, DisplayCompositor will only be
111 // used over Mojo and |display_compositor_| will be owned somewhere else.
112 cc::mojom::DisplayCompositorPtr display_compositor_ptr_;
113 std::unique_ptr<ui::DisplayCompositor> display_compositor_;
114
108 cc::FrameSinkIdAllocator frame_sink_id_allocator_; 115 cc::FrameSinkIdAllocator frame_sink_id_allocator_;
109 116
110 #if defined(OS_WIN) 117 #if defined(OS_WIN)
111 // Used by output surface, stored in PerCompositorData. 118 // Used by output surface, stored in PerCompositorData.
112 std::unique_ptr<OutputDeviceBacking> software_backing_; 119 std::unique_ptr<OutputDeviceBacking> software_backing_;
113 #endif 120 #endif
114 121
115 // Depends on SurfaceManager. 122 // Depends on SurfaceManager.
116 typedef std::map<ui::Compositor*, std::unique_ptr<PerCompositorData>> 123 typedef std::map<ui::Compositor*, std::unique_ptr<PerCompositorData>>
117 PerCompositorDataMap; 124 PerCompositorDataMap;
(...skipping 13 matching lines...) Expand all
131 gpu::GpuChannelEstablishFactory* gpu_channel_factory_ = nullptr; 138 gpu::GpuChannelEstablishFactory* gpu_channel_factory_ = nullptr;
132 139
133 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; 140 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_;
134 141
135 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); 142 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory);
136 }; 143 };
137 144
138 } // namespace content 145 } // namespace content
139 146
140 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ 147 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698