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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 12
12 #include "base/id_map.h" 13 #include "base/id_map.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.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 "content/browser/compositor/image_transport_factory.h" 19 #include "content/browser/compositor/image_transport_factory.h"
20 #include "gpu/ipc/client/gpu_channel_host.h" 20 #include "gpu/ipc/client/gpu_channel_host.h"
21 #include "gpu/ipc/common/surface_handle.h" 21 #include "gpu/ipc/common/surface_handle.h"
22 #include "ui/compositor/compositor.h" 22 #include "ui/compositor/compositor.h"
23 23
24 namespace base { 24 namespace base {
25 class SimpleThread; 25 class SimpleThread;
(...skipping 15 matching lines...) Expand all
41 class WebGraphicsContext3DCommandBufferImpl; 41 class WebGraphicsContext3DCommandBufferImpl;
42 42
43 class GpuProcessTransportFactory 43 class GpuProcessTransportFactory
44 : public ui::ContextFactory, 44 : public ui::ContextFactory,
45 public ImageTransportFactory { 45 public ImageTransportFactory {
46 public: 46 public:
47 GpuProcessTransportFactory(); 47 GpuProcessTransportFactory();
48 48
49 ~GpuProcessTransportFactory() override; 49 ~GpuProcessTransportFactory() override;
50 50
51 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> 51 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl>
52 CreateOffscreenCommandBufferContext(); 52 CreateOffscreenCommandBufferContext();
53 53
54 // ui::ContextFactory implementation. 54 // ui::ContextFactory implementation.
55 void CreateOutputSurface(base::WeakPtr<ui::Compositor> compositor) override; 55 void CreateOutputSurface(base::WeakPtr<ui::Compositor> compositor) override;
56 scoped_ptr<ui::Reflector> CreateReflector(ui::Compositor* source, 56 std::unique_ptr<ui::Reflector> CreateReflector(ui::Compositor* source,
57 ui::Layer* target) override; 57 ui::Layer* target) override;
58 void RemoveReflector(ui::Reflector* reflector) override; 58 void RemoveReflector(ui::Reflector* reflector) override;
59 void RemoveCompositor(ui::Compositor* compositor) override; 59 void RemoveCompositor(ui::Compositor* compositor) override;
60 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override; 60 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override;
61 bool DoesCreateTestContexts() override; 61 bool DoesCreateTestContexts() override;
62 uint32_t GetImageTextureTarget(gfx::BufferFormat format, 62 uint32_t GetImageTextureTarget(gfx::BufferFormat format,
63 gfx::BufferUsage usage) override; 63 gfx::BufferUsage usage) override;
64 cc::SharedBitmapManager* GetSharedBitmapManager() override; 64 cc::SharedBitmapManager* GetSharedBitmapManager() override;
65 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; 65 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
66 cc::TaskGraphRunner* GetTaskGraphRunner() override; 66 cc::TaskGraphRunner* GetTaskGraphRunner() override;
67 scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override; 67 std::unique_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override;
68 void ResizeDisplay(ui::Compositor* compositor, 68 void ResizeDisplay(ui::Compositor* compositor,
69 const gfx::Size& size) override; 69 const gfx::Size& size) override;
70 70
71 // ImageTransportFactory implementation. 71 // ImageTransportFactory implementation.
72 ui::ContextFactory* GetContextFactory() override; 72 ui::ContextFactory* GetContextFactory() override;
73 cc::SurfaceManager* GetSurfaceManager() override; 73 cc::SurfaceManager* GetSurfaceManager() override;
74 GLHelper* GetGLHelper() override; 74 GLHelper* GetGLHelper() override;
75 void AddObserver(ImageTransportFactoryObserver* observer) override; 75 void AddObserver(ImageTransportFactoryObserver* observer) override;
76 void RemoveObserver(ImageTransportFactoryObserver* observer) override; 76 void RemoveObserver(ImageTransportFactoryObserver* observer) override;
77 #if defined(OS_MACOSX) 77 #if defined(OS_MACOSX)
78 void OnGpuSwapBuffersCompleted( 78 void OnGpuSwapBuffersCompleted(
79 int surface_id, 79 int surface_id,
80 const std::vector<ui::LatencyInfo>& latency_info, 80 const std::vector<ui::LatencyInfo>& latency_info,
81 gfx::SwapResult result) override; 81 gfx::SwapResult result) override;
82 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor, 82 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor,
83 bool suspended) override; 83 bool suspended) override;
84 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle( 84 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle(
85 int surface_id) const override; 85 int surface_id) const override;
86 #endif 86 #endif
87 87
88 private: 88 private:
89 struct PerCompositorData; 89 struct PerCompositorData;
90 90
91 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); 91 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor);
92 scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice( 92 std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
93 ui::Compositor* compositor); 93 ui::Compositor* compositor);
94 void EstablishedGpuChannel(base::WeakPtr<ui::Compositor> compositor, 94 void EstablishedGpuChannel(base::WeakPtr<ui::Compositor> compositor,
95 bool create_gpu_output_surface, 95 bool create_gpu_output_surface,
96 int num_attempts); 96 int num_attempts);
97 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContextCommon( 97 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContextCommon(
98 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, 98 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host,
99 gpu::SurfaceHandle surface_handle); 99 gpu::SurfaceHandle surface_handle);
100 100
101 void OnLostMainThreadSharedContextInsideCallback(); 101 void OnLostMainThreadSharedContextInsideCallback();
102 void OnLostMainThreadSharedContext(); 102 void OnLostMainThreadSharedContext();
103 103
104 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; 104 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap;
105 PerCompositorDataMap per_compositor_data_; 105 PerCompositorDataMap per_compositor_data_;
106 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_; 106 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_;
107 scoped_ptr<GLHelper> gl_helper_; 107 std::unique_ptr<GLHelper> gl_helper_;
108 base::ObserverList<ImageTransportFactoryObserver> observer_list_; 108 base::ObserverList<ImageTransportFactoryObserver> observer_list_;
109 scoped_ptr<cc::SurfaceManager> surface_manager_; 109 std::unique_ptr<cc::SurfaceManager> surface_manager_;
110 uint32_t next_surface_id_namespace_; 110 uint32_t next_surface_id_namespace_;
111 scoped_ptr<cc::SingleThreadTaskGraphRunner> task_graph_runner_; 111 std::unique_ptr<cc::SingleThreadTaskGraphRunner> task_graph_runner_;
112 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_; 112 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_;
113 113
114 #if defined(OS_WIN) 114 #if defined(OS_WIN)
115 scoped_ptr<OutputDeviceBacking> software_backing_; 115 std::unique_ptr<OutputDeviceBacking> software_backing_;
116 #endif 116 #endif
117 117
118 // The contents of this map and its methods may only be used on the compositor 118 // The contents of this map and its methods may only be used on the compositor
119 // thread. 119 // thread.
120 IDMap<BrowserCompositorOutputSurface> output_surface_map_; 120 IDMap<BrowserCompositorOutputSurface> output_surface_map_;
121 121
122 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; 122 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_;
123 123
124 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); 124 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory);
125 }; 125 };
126 126
127 } // namespace content 127 } // namespace content
128 128
129 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ 129 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698