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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "content/browser/compositor/image_transport_factory.h" | 15 #include "content/browser/compositor/image_transport_factory.h" |
16 #include "content/common/gpu/client/gpu_channel_host.h" | 16 #include "content/common/gpu/client/gpu_channel_host.h" |
17 #include "ui/compositor/compositor.h" | 17 #include "ui/compositor/compositor.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SimpleThread; | 20 class SimpleThread; |
21 class Thread; | 21 class Thread; |
22 } | 22 } |
23 | 23 |
24 namespace cc { | 24 namespace cc { |
| 25 class SoftwareOutputDevice; |
25 class SurfaceManager; | 26 class SurfaceManager; |
26 } | 27 } |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 class BrowserCompositorOutputSurface; | 30 class BrowserCompositorOutputSurface; |
30 class CompositorSwapClient; | 31 class CompositorSwapClient; |
31 class ContextProviderCommandBuffer; | 32 class ContextProviderCommandBuffer; |
| 33 class OutputDeviceBacking; |
32 class ReflectorImpl; | 34 class ReflectorImpl; |
33 class WebGraphicsContext3DCommandBufferImpl; | 35 class WebGraphicsContext3DCommandBufferImpl; |
34 | 36 |
35 class GpuProcessTransportFactory | 37 class GpuProcessTransportFactory |
36 : public ui::ContextFactory, | 38 : public ui::ContextFactory, |
37 public ImageTransportFactory { | 39 public ImageTransportFactory { |
38 public: | 40 public: |
39 GpuProcessTransportFactory(); | 41 GpuProcessTransportFactory(); |
40 | 42 |
41 ~GpuProcessTransportFactory() override; | 43 ~GpuProcessTransportFactory() override; |
(...skipping 29 matching lines...) Expand all Loading... |
71 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, | 73 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, |
72 bool suspended) override; | 74 bool suspended) override; |
73 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle( | 75 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle( |
74 int surface_id) const override; | 76 int surface_id) const override; |
75 #endif | 77 #endif |
76 | 78 |
77 private: | 79 private: |
78 struct PerCompositorData; | 80 struct PerCompositorData; |
79 | 81 |
80 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); | 82 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); |
| 83 scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( |
| 84 ui::Compositor* compositor); |
81 void EstablishedGpuChannel(base::WeakPtr<ui::Compositor> compositor, | 85 void EstablishedGpuChannel(base::WeakPtr<ui::Compositor> compositor, |
82 bool create_gpu_output_surface, | 86 bool create_gpu_output_surface, |
83 int num_attempts); | 87 int num_attempts); |
84 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContextCommon( | 88 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContextCommon( |
85 scoped_refptr<GpuChannelHost> gpu_channel_host, | 89 scoped_refptr<GpuChannelHost> gpu_channel_host, |
86 int surface_id); | 90 int surface_id); |
87 | 91 |
88 void OnLostMainThreadSharedContextInsideCallback(); | 92 void OnLostMainThreadSharedContextInsideCallback(); |
89 void OnLostMainThreadSharedContext(); | 93 void OnLostMainThreadSharedContext(); |
90 | 94 |
91 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; | 95 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; |
92 PerCompositorDataMap per_compositor_data_; | 96 PerCompositorDataMap per_compositor_data_; |
93 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_; | 97 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_; |
94 scoped_ptr<GLHelper> gl_helper_; | 98 scoped_ptr<GLHelper> gl_helper_; |
95 ObserverList<ImageTransportFactoryObserver> observer_list_; | 99 ObserverList<ImageTransportFactoryObserver> observer_list_; |
96 scoped_ptr<cc::SurfaceManager> surface_manager_; | 100 scoped_ptr<cc::SurfaceManager> surface_manager_; |
97 uint32_t next_surface_id_namespace_; | 101 uint32_t next_surface_id_namespace_; |
98 scoped_ptr<cc::TaskGraphRunner> task_graph_runner_; | 102 scoped_ptr<cc::TaskGraphRunner> task_graph_runner_; |
99 scoped_ptr<base::SimpleThread> raster_thread_; | 103 scoped_ptr<base::SimpleThread> raster_thread_; |
100 | 104 |
| 105 #if defined(OS_WIN) |
| 106 scoped_ptr<OutputDeviceBacking> software_backing_; |
| 107 #endif |
| 108 |
101 // The contents of this map and its methods may only be used on the compositor | 109 // The contents of this map and its methods may only be used on the compositor |
102 // thread. | 110 // thread. |
103 IDMap<BrowserCompositorOutputSurface> output_surface_map_; | 111 IDMap<BrowserCompositorOutputSurface> output_surface_map_; |
104 | 112 |
105 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; | 113 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; |
106 | 114 |
107 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); | 115 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); |
108 }; | 116 }; |
109 | 117 |
110 } // namespace content | 118 } // namespace content |
111 | 119 |
112 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 120 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
OLD | NEW |