OLD | NEW |
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 GPU_IPC_SERVICE_GPU_CHANNEL_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_CHANNEL_H_ |
6 #define GPU_IPC_SERVICE_GPU_CHANNEL_H_ | 6 #define GPU_IPC_SERVICE_GPU_CHANNEL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO | 298 // - it handles the GpuCommandBufferMsg_InsertSyncPoint message on the IO |
299 // thread, generating the sync point ID and responding immediately, and then | 299 // thread, generating the sync point ID and responding immediately, and then |
300 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message | 300 // posting a task to insert the GpuCommandBufferMsg_RetireSyncPoint message |
301 // into the channel's queue. | 301 // into the channel's queue. |
302 // - it generates mailbox names for clients of the GPU process on the IO thread. | 302 // - it generates mailbox names for clients of the GPU process on the IO thread. |
303 class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter { | 303 class GPU_EXPORT GpuChannelMessageFilter : public IPC::MessageFilter { |
304 public: | 304 public: |
305 GpuChannelMessageFilter(); | 305 GpuChannelMessageFilter(); |
306 | 306 |
307 // IPC::MessageFilter implementation. | 307 // IPC::MessageFilter implementation. |
308 void OnFilterAdded(IPC::Sender* sender) override; | 308 void OnFilterAdded(IPC::Channel* channel) override; |
309 void OnFilterRemoved() override; | 309 void OnFilterRemoved() override; |
310 void OnChannelConnected(int32_t peer_pid) override; | 310 void OnChannelConnected(int32_t peer_pid) override; |
311 void OnChannelError() override; | 311 void OnChannelError() override; |
312 void OnChannelClosing() override; | 312 void OnChannelClosing() override; |
313 bool OnMessageReceived(const IPC::Message& message) override; | 313 bool OnMessageReceived(const IPC::Message& message) override; |
314 | 314 |
315 void AddChannelFilter(scoped_refptr<IPC::MessageFilter> filter); | 315 void AddChannelFilter(scoped_refptr<IPC::MessageFilter> filter); |
316 void RemoveChannelFilter(scoped_refptr<IPC::MessageFilter> filter); | 316 void RemoveChannelFilter(scoped_refptr<IPC::MessageFilter> filter); |
317 | 317 |
318 void AddRoute(int32_t route_id, | 318 void AddRoute(int32_t route_id, |
319 const scoped_refptr<GpuChannelMessageQueue>& queue); | 319 const scoped_refptr<GpuChannelMessageQueue>& queue); |
320 void RemoveRoute(int32_t route_id); | 320 void RemoveRoute(int32_t route_id); |
321 | 321 |
322 bool Send(IPC::Message* message); | 322 bool Send(IPC::Message* message); |
323 | 323 |
324 protected: | 324 protected: |
325 ~GpuChannelMessageFilter() override; | 325 ~GpuChannelMessageFilter() override; |
326 | 326 |
327 private: | 327 private: |
328 scoped_refptr<GpuChannelMessageQueue> LookupStreamByRoute(int32_t route_id); | 328 scoped_refptr<GpuChannelMessageQueue> LookupStreamByRoute(int32_t route_id); |
329 | 329 |
330 bool MessageErrorHandler(const IPC::Message& message, const char* error_msg); | 330 bool MessageErrorHandler(const IPC::Message& message, const char* error_msg); |
331 | 331 |
332 // Map of route id to message queue. | 332 // Map of route id to message queue. |
333 base::hash_map<int32_t, scoped_refptr<GpuChannelMessageQueue>> routes_; | 333 base::hash_map<int32_t, scoped_refptr<GpuChannelMessageQueue>> routes_; |
334 base::Lock routes_lock_; // Protects |routes_|. | 334 base::Lock routes_lock_; // Protects |routes_|. |
335 | 335 |
336 IPC::Sender* sender_; | 336 IPC::Channel* channel_; |
337 base::ProcessId peer_pid_; | 337 base::ProcessId peer_pid_; |
338 std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_; | 338 std::vector<scoped_refptr<IPC::MessageFilter>> channel_filters_; |
339 | 339 |
340 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageFilter); | 340 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageFilter); |
341 }; | 341 }; |
342 | 342 |
343 struct GpuChannelMessage { | 343 struct GpuChannelMessage { |
344 IPC::Message message; | 344 IPC::Message message; |
345 uint32_t order_number; | 345 uint32_t order_number; |
346 base::TimeTicks time_received; | 346 base::TimeTicks time_received; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 scoped_refptr<PreemptionFlag> preempting_flag_; | 473 scoped_refptr<PreemptionFlag> preempting_flag_; |
474 scoped_refptr<PreemptionFlag> preempted_flag_; | 474 scoped_refptr<PreemptionFlag> preempted_flag_; |
475 SyncPointManager* const sync_point_manager_; | 475 SyncPointManager* const sync_point_manager_; |
476 | 476 |
477 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); | 477 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); |
478 }; | 478 }; |
479 | 479 |
480 } // namespace gpu | 480 } // namespace gpu |
481 | 481 |
482 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_ | 482 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_ |
OLD | NEW |