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

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

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