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

Side by Side Diff: content/gpu/gpu_child_thread.h

Issue 1845563005: Refactor content/common/gpu into gpu/ipc/service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_GPU_GPU_CHILD_THREAD_H_ 5 #ifndef CONTENT_GPU_GPU_CHILD_THREAD_H_
6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_ 6 #define CONTENT_GPU_GPU_CHILD_THREAD_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.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/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "content/child/child_thread_impl.h" 19 #include "content/child/child_thread_impl.h"
20 #include "content/common/gpu/gpu_channel.h"
21 #include "content/common/gpu/gpu_channel_manager.h"
22 #include "content/common/gpu/gpu_channel_manager_delegate.h"
23 #include "content/common/gpu/gpu_config.h"
24 #include "content/common/gpu/x_util.h"
25 #include "content/common/process_control.mojom.h" 20 #include "content/common/process_control.mojom.h"
26 #include "gpu/command_buffer/service/gpu_preferences.h" 21 #include "gpu/command_buffer/service/gpu_preferences.h"
27 #include "gpu/config/gpu_info.h" 22 #include "gpu/config/gpu_info.h"
23 #include "gpu/ipc/service/gpu_channel.h"
24 #include "gpu/ipc/service/gpu_channel_manager.h"
25 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
26 #include "gpu/ipc/service/gpu_config.h"
27 #include "gpu/ipc/service/x_util.h"
28 #include "mojo/public/cpp/bindings/binding_set.h" 28 #include "mojo/public/cpp/bindings/binding_set.h"
29 #include "mojo/public/cpp/bindings/interface_request.h" 29 #include "mojo/public/cpp/bindings/interface_request.h"
30 #include "ui/gfx/native_widget_types.h" 30 #include "ui/gfx/native_widget_types.h"
31 31
32 namespace gpu { 32 namespace gpu {
33 class GpuMemoryBufferFactory;
33 class SyncPointManager; 34 class SyncPointManager;
34 } 35 }
35 36
36 namespace sandbox { 37 namespace sandbox {
37 class TargetServices; 38 class TargetServices;
38 } 39 }
39 40
40 namespace content { 41 namespace content {
41 class GpuMemoryBufferFactory;
42 class GpuProcessControlImpl; 42 class GpuProcessControlImpl;
43 class GpuWatchdogThread; 43 class GpuWatchdogThread;
44 class MediaService; 44 class MediaService;
45 struct EstablishChannelParams; 45 struct EstablishChannelParams;
46 #if defined(OS_MACOSX) 46 #if defined(OS_MACOSX)
47 struct BufferPresentedParams; 47 struct BufferPresentedParams;
48 #endif 48 #endif
49 49
50 // The main thread of the GPU child process. There will only ever be one of 50 // The main thread of the GPU child process. There will only ever be one of
51 // these per process. It does process initialization and shutdown. It forwards 51 // these per process. It does process initialization and shutdown. It forwards
52 // IPC messages to GpuChannelManager, which is responsible for issuing rendering 52 // IPC messages to gpu::GpuChannelManager, which is responsible for issuing
53 // commands to the GPU. 53 // rendering commands to the GPU.
54 class GpuChildThread : public ChildThreadImpl, 54 class GpuChildThread : public ChildThreadImpl,
55 public GpuChannelManagerDelegate { 55 public gpu::GpuChannelManagerDelegate {
56 public: 56 public:
57 typedef std::queue<IPC::Message*> DeferredMessages; 57 typedef std::queue<IPC::Message*> DeferredMessages;
58 58
59 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread, 59 GpuChildThread(GpuWatchdogThread* gpu_watchdog_thread,
60 bool dead_on_arrival, 60 bool dead_on_arrival,
61 const gpu::GPUInfo& gpu_info, 61 const gpu::GPUInfo& gpu_info,
62 const DeferredMessages& deferred_messages, 62 const DeferredMessages& deferred_messages,
63 GpuMemoryBufferFactory* gpu_memory_buffer_factory, 63 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
64 gpu::SyncPointManager* sync_point_manager); 64 gpu::SyncPointManager* sync_point_manager);
65 65
66 GpuChildThread(const gpu::GpuPreferences& gpu_preferences, 66 GpuChildThread(const gpu::GpuPreferences& gpu_preferences,
67 const InProcessChildThreadParams& params, 67 const InProcessChildThreadParams& params,
68 GpuMemoryBufferFactory* gpu_memory_buffer_factory, 68 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
69 gpu::SyncPointManager* sync_point_manager); 69 gpu::SyncPointManager* sync_point_manager);
70 70
71 ~GpuChildThread() override; 71 ~GpuChildThread() override;
72 72
73 void Shutdown() override; 73 void Shutdown() override;
74 74
75 void Init(const base::Time& process_start_time); 75 void Init(const base::Time& process_start_time);
76 void StopWatchdog(); 76 void StopWatchdog();
77 77
78 private: 78 private:
79 // ChildThread overrides. 79 // ChildThread overrides.
80 bool Send(IPC::Message* msg) override; 80 bool Send(IPC::Message* msg) override;
81 bool OnControlMessageReceived(const IPC::Message& msg) override; 81 bool OnControlMessageReceived(const IPC::Message& msg) override;
82 bool OnMessageReceived(const IPC::Message& msg) override; 82 bool OnMessageReceived(const IPC::Message& msg) override;
83 83
84 // GpuChannelManagerDelegate implementation. 84 // gpu::GpuChannelManagerDelegate implementation.
85 void SetActiveURL(const GURL& url) override; 85 void SetActiveURL(const GURL& url) override;
86 void AddSubscription(int32_t client_id, unsigned int target) override; 86 void AddSubscription(int32_t client_id, unsigned int target) override;
87 void DidCreateOffscreenContext(const GURL& active_url) override; 87 void DidCreateOffscreenContext(const GURL& active_url) override;
88 void DidDestroyChannel(int client_id) override; 88 void DidDestroyChannel(int client_id) override;
89 void DidDestroyOffscreenContext(const GURL& active_url) override; 89 void DidDestroyOffscreenContext(const GURL& active_url) override;
90 void DidLoseContext(bool offscreen, 90 void DidLoseContext(bool offscreen,
91 gpu::error::ContextLostReason reason, 91 gpu::error::ContextLostReason reason,
92 const GURL& active_url) override; 92 const GURL& active_url) override;
93 void GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) override; 93 void GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) override;
94 void RemoveSubscription(int32_t client_id, unsigned int target) override; 94 void RemoveSubscription(int32_t client_id, unsigned int target) override;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 scoped_refptr<GpuWatchdogThread> watchdog_thread_; 152 scoped_refptr<GpuWatchdogThread> watchdog_thread_;
153 153
154 #if defined(OS_WIN) 154 #if defined(OS_WIN)
155 // Windows specific client sandbox interface. 155 // Windows specific client sandbox interface.
156 sandbox::TargetServices* target_services_; 156 sandbox::TargetServices* target_services_;
157 #endif 157 #endif
158 158
159 // Non-owning. 159 // Non-owning.
160 gpu::SyncPointManager* sync_point_manager_; 160 gpu::SyncPointManager* sync_point_manager_;
161 161
162 scoped_ptr<GpuChannelManager> gpu_channel_manager_; 162 scoped_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
163 163
164 scoped_ptr<MediaService> media_service_; 164 scoped_ptr<MediaService> media_service_;
165 165
166 // Information about the GPU, such as device and vendor ID. 166 // Information about the GPU, such as device and vendor ID.
167 gpu::GPUInfo gpu_info_; 167 gpu::GPUInfo gpu_info_;
168 168
169 // Error messages collected in gpu_main() before the thread is created. 169 // Error messages collected in gpu_main() before the thread is created.
170 DeferredMessages deferred_messages_; 170 DeferredMessages deferred_messages_;
171 171
172 // Whether the GPU thread is running in the browser process. 172 // Whether the GPU thread is running in the browser process.
173 bool in_browser_process_; 173 bool in_browser_process_;
174 174
175 // The GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers. 175 // The gpu::GpuMemoryBufferFactory instance used to allocate GpuMemoryBuffers.
176 GpuMemoryBufferFactory* const gpu_memory_buffer_factory_; 176 gpu::GpuMemoryBufferFactory* const gpu_memory_buffer_factory_;
177 177
178 // Process control for Mojo application hosting. 178 // Process control for Mojo application hosting.
179 scoped_ptr<GpuProcessControlImpl> process_control_; 179 scoped_ptr<GpuProcessControlImpl> process_control_;
180 180
181 // Bindings to the mojom::ProcessControl impl. 181 // Bindings to the mojom::ProcessControl impl.
182 mojo::BindingSet<mojom::ProcessControl> process_control_bindings_; 182 mojo::BindingSet<mojom::ProcessControl> process_control_bindings_;
183 183
184 DISALLOW_COPY_AND_ASSIGN(GpuChildThread); 184 DISALLOW_COPY_AND_ASSIGN(GpuChildThread);
185 }; 185 };
186 186
187 } // namespace content 187 } // namespace content
188 188
189 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_ 189 #endif // CONTENT_GPU_GPU_CHILD_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698