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

Side by Side Diff: content/common/gpu/gpu_channel.h

Issue 1736643005: Decouple Media Service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nit + fixed compile issue Created 4 years, 9 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_COMMON_GPU_GPU_CHANNEL_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } 50 }
51 51
52 namespace IPC { 52 namespace IPC {
53 class MessageFilter; 53 class MessageFilter;
54 } 54 }
55 55
56 namespace content { 56 namespace content {
57 class GpuChannelManager; 57 class GpuChannelManager;
58 class GpuChannelMessageFilter; 58 class GpuChannelMessageFilter;
59 class GpuChannelMessageQueue; 59 class GpuChannelMessageQueue;
60 class GpuJpegDecodeAccelerator;
61 class GpuWatchdog; 60 class GpuWatchdog;
62 61
63 // Encapsulates an IPC channel between the GPU process and one renderer 62 // Encapsulates an IPC channel between the GPU process and one renderer
64 // process. On the renderer side there's a corresponding GpuChannelHost. 63 // process. On the renderer side there's a corresponding GpuChannelHost.
65 class CONTENT_EXPORT GpuChannel 64 class CONTENT_EXPORT GpuChannel
66 : public IPC::Listener, 65 : public IPC::Listener,
67 public IPC::Sender, 66 public IPC::Sender,
68 public gpu::gles2::SubscriptionRefSet::Observer { 67 public gpu::gles2::SubscriptionRefSet::Observer {
69 public: 68 public:
70 // Takes ownership of the renderer process handle. 69 // Takes ownership of the renderer process handle.
71 GpuChannel(GpuChannelManager* gpu_channel_manager, 70 GpuChannel(GpuChannelManager* gpu_channel_manager,
72 gpu::SyncPointManager* sync_point_manager, 71 gpu::SyncPointManager* sync_point_manager,
73 GpuWatchdog* watchdog, 72 GpuWatchdog* watchdog,
74 gfx::GLShareGroup* share_group, 73 gfx::GLShareGroup* share_group,
75 gpu::gles2::MailboxManager* mailbox_manager, 74 gpu::gles2::MailboxManager* mailbox_manager,
76 gpu::PreemptionFlag* preempting_flag, 75 gpu::PreemptionFlag* preempting_flag,
77 gpu::PreemptionFlag* preempted_flag, 76 gpu::PreemptionFlag* preempted_flag,
78 base::SingleThreadTaskRunner* task_runner, 77 base::SingleThreadTaskRunner* task_runner,
79 base::SingleThreadTaskRunner* io_task_runner, 78 base::SingleThreadTaskRunner* io_task_runner,
80 int32_t client_id, 79 int32_t client_id,
81 uint64_t client_tracing_id, 80 uint64_t client_tracing_id,
82 bool allow_view_command_buffers, 81 bool allow_view_command_buffers,
83 bool allow_real_time_streams); 82 bool allow_real_time_streams);
84 ~GpuChannel() override; 83 ~GpuChannel() override;
85 84
86 // Initializes the IPC channel. Caller takes ownership of the client FD in 85 // Initializes the IPC channel. Caller takes ownership of the client FD in
87 // the returned handle and is responsible for closing it. 86 // the returned handle and is responsible for closing it.
88 virtual IPC::ChannelHandle Init(base::WaitableEvent* shutdown_event); 87 virtual IPC::ChannelHandle Init(base::WaitableEvent* shutdown_event);
89 88
89 void SetUnhandledMessageListener(IPC::Listener* listener);
90
90 // Get the GpuChannelManager that owns this channel. 91 // Get the GpuChannelManager that owns this channel.
91 GpuChannelManager* gpu_channel_manager() const { 92 GpuChannelManager* gpu_channel_manager() const {
92 return gpu_channel_manager_; 93 return gpu_channel_manager_;
93 } 94 }
94 95
95 const std::string& channel_id() const { return channel_id_; } 96 const std::string& channel_id() const { return channel_id_; }
96 97
97 virtual base::ProcessId GetClientPID() const; 98 virtual base::ProcessId GetClientPID() const;
98 99
99 int client_id() const { return client_id_; } 100 int client_id() const { return client_id_; }
100 101
101 uint64_t client_tracing_id() const { return client_tracing_id_; } 102 uint64_t client_tracing_id() const { return client_tracing_id_; }
102 103
104 base::WeakPtr<GpuChannel> AsWeakPtr();
105
103 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() const { 106 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner() const {
104 return io_task_runner_; 107 return io_task_runner_;
105 } 108 }
106 109
107 // IPC::Listener implementation: 110 // IPC::Listener implementation:
108 bool OnMessageReceived(const IPC::Message& msg) override; 111 bool OnMessageReceived(const IPC::Message& msg) override;
109 void OnChannelError() override; 112 void OnChannelError() override;
110 113
111 // IPC::Sender implementation: 114 // IPC::Sender implementation:
112 bool Send(IPC::Message* msg) override; 115 bool Send(IPC::Message* msg) override;
(...skipping 27 matching lines...) Expand all
140 143
141 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( 144 scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer(
142 const gfx::GpuMemoryBufferHandle& handle, 145 const gfx::GpuMemoryBufferHandle& handle,
143 const gfx::Size& size, 146 const gfx::Size& size,
144 gfx::BufferFormat format, 147 gfx::BufferFormat format,
145 uint32_t internalformat); 148 uint32_t internalformat);
146 149
147 void HandleUpdateValueState(unsigned int target, 150 void HandleUpdateValueState(unsigned int target,
148 const gpu::ValueState& state); 151 const gpu::ValueState& state);
149 152
153 GpuChannelMessageFilter* filter() const { return filter_.get(); }
154
150 // Visible for testing. 155 // Visible for testing.
151 const gpu::ValueStateMap* pending_valuebuffer_state() const { 156 const gpu::ValueStateMap* pending_valuebuffer_state() const {
152 return pending_valuebuffer_state_.get(); 157 return pending_valuebuffer_state_.get();
153 } 158 }
154 159
155 // Visible for testing.
156 GpuChannelMessageFilter* filter() const { return filter_.get(); }
157
158 // Returns the global order number for the last processed IPC message. 160 // Returns the global order number for the last processed IPC message.
159 uint32_t GetProcessedOrderNum() const; 161 uint32_t GetProcessedOrderNum() const;
160 162
161 // Returns the global order number for the last unprocessed IPC message. 163 // Returns the global order number for the last unprocessed IPC message.
162 uint32_t GetUnprocessedOrderNum() const; 164 uint32_t GetUnprocessedOrderNum() const;
163 165
164 // Returns the shared sync point global order data for the stream. 166 // Returns the shared sync point global order data for the stream.
165 scoped_refptr<gpu::SyncPointOrderData> GetSyncPointOrderData( 167 scoped_refptr<gpu::SyncPointOrderData> GetSyncPointOrderData(
166 int32_t stream_id); 168 int32_t stream_id);
167 169
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 const gfx::GLSurfaceHandle& window, 213 const gfx::GLSurfaceHandle& window,
212 const GPUCreateCommandBufferConfig& init_params, 214 const GPUCreateCommandBufferConfig& init_params,
213 int32_t route_id, 215 int32_t route_id,
214 bool* succeeded); 216 bool* succeeded);
215 void OnCreateOffscreenCommandBuffer( 217 void OnCreateOffscreenCommandBuffer(
216 const gfx::Size& size, 218 const gfx::Size& size,
217 const GPUCreateCommandBufferConfig& init_params, 219 const GPUCreateCommandBufferConfig& init_params,
218 int32_t route_id, 220 int32_t route_id,
219 bool* succeeded); 221 bool* succeeded);
220 void OnDestroyCommandBuffer(int32_t route_id); 222 void OnDestroyCommandBuffer(int32_t route_id);
221 void OnCreateJpegDecoder(int32_t route_id, IPC::Message* reply_msg);
222 223
223 bool CreateCommandBuffer(const gfx::GLSurfaceHandle& window, 224 bool CreateCommandBuffer(const gfx::GLSurfaceHandle& window,
224 const gfx::Size& size, 225 const gfx::Size& size,
225 const GPUCreateCommandBufferConfig& init_params, 226 const GPUCreateCommandBufferConfig& init_params,
226 int32_t route_id); 227 int32_t route_id);
227 228
228 // The lifetime of objects of this class is managed by a GpuChannelManager. 229 // The lifetime of objects of this class is managed by a GpuChannelManager.
229 // The GpuChannelManager destroy all the GpuChannels that they own when they 230 // The GpuChannelManager destroy all the GpuChannels that they own when they
230 // are destroyed. So a raw pointer is safe. 231 // are destroyed. So a raw pointer is safe.
231 GpuChannelManager* const gpu_channel_manager_; 232 GpuChannelManager* const gpu_channel_manager_;
232 233
233 // Sync point manager. Outlives the channel and is guaranteed to outlive the 234 // Sync point manager. Outlives the channel and is guaranteed to outlive the
234 // message loop. 235 // message loop.
235 gpu::SyncPointManager* const sync_point_manager_; 236 gpu::SyncPointManager* const sync_point_manager_;
236 237
237 scoped_ptr<IPC::SyncChannel> channel_; 238 scoped_ptr<IPC::SyncChannel> channel_;
238 239
240 IPC::Listener* unhandled_message_listener_;
241
239 // Uniquely identifies the channel within this GPU process. 242 // Uniquely identifies the channel within this GPU process.
240 std::string channel_id_; 243 std::string channel_id_;
241 244
242 // Used to implement message routing functionality to CommandBuffer objects 245 // Used to implement message routing functionality to CommandBuffer objects
243 IPC::MessageRouter router_; 246 IPC::MessageRouter router_;
244 247
245 // Whether the processing of IPCs on this channel is stalled and we should 248 // Whether the processing of IPCs on this channel is stalled and we should
246 // preempt other GpuChannels. 249 // preempt other GpuChannels.
247 scoped_refptr<gpu::PreemptionFlag> preempting_flag_; 250 scoped_refptr<gpu::PreemptionFlag> preempting_flag_;
248 251
(...skipping 14 matching lines...) Expand all
263 // The share group that all contexts associated with a particular renderer 266 // The share group that all contexts associated with a particular renderer
264 // process use. 267 // process use.
265 scoped_refptr<gfx::GLShareGroup> share_group_; 268 scoped_refptr<gfx::GLShareGroup> share_group_;
266 269
267 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 270 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
268 271
269 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_; 272 scoped_refptr<gpu::gles2::SubscriptionRefSet> subscription_ref_set_;
270 273
271 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; 274 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_;
272 275
273 scoped_ptr<GpuJpegDecodeAccelerator> jpeg_decoder_;
274
275 gpu::gles2::DisallowedFeatures disallowed_features_; 276 gpu::gles2::DisallowedFeatures disallowed_features_;
276 GpuWatchdog* const watchdog_; 277 GpuWatchdog* const watchdog_;
277 278
278 // Map of stream id to appropriate message queue. 279 // Map of stream id to appropriate message queue.
279 base::hash_map<int32_t, scoped_refptr<GpuChannelMessageQueue>> streams_; 280 base::hash_map<int32_t, scoped_refptr<GpuChannelMessageQueue>> streams_;
280 281
281 // Multimap of stream id to route ids. 282 // Multimap of stream id to route ids.
282 base::hash_map<int32_t, int> streams_to_num_routes_; 283 base::hash_map<int32_t, int> streams_to_num_routes_;
283 284
284 // Map of route id to stream id; 285 // Map of route id to stream id;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 scoped_refptr<gpu::PreemptionFlag> preempting_flag_; 483 scoped_refptr<gpu::PreemptionFlag> preempting_flag_;
483 scoped_refptr<gpu::PreemptionFlag> preempted_flag_; 484 scoped_refptr<gpu::PreemptionFlag> preempted_flag_;
484 gpu::SyncPointManager* const sync_point_manager_; 485 gpu::SyncPointManager* const sync_point_manager_;
485 486
486 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); 487 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue);
487 }; 488 };
488 489
489 } // namespace content 490 } // namespace content
490 491
491 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_ 492 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_video_encode_accelerator_host.cc ('k') | content/common/gpu/gpu_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698