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 |
11 #include <memory> | 11 #include <memory> |
| 12 #include <queue> |
12 #include <string> | 13 #include <string> |
13 | 14 |
14 #include "base/containers/hash_tables.h" | 15 #include "base/containers/hash_tables.h" |
15 #include "base/containers/scoped_ptr_hash_map.h" | 16 #include "base/containers/scoped_ptr_hash_map.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
19 #include "base/process/process.h" | 20 #include "base/process/process.h" |
20 #include "base/threading/thread_checker.h" | 21 #include "base/threading/thread_checker.h" |
21 #include "base/trace_event/memory_dump_provider.h" | 22 #include "base/trace_event/memory_dump_provider.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 176 |
176 protected: | 177 protected: |
177 // The message filter on the io thread. | 178 // The message filter on the io thread. |
178 scoped_refptr<GpuChannelMessageFilter> filter_; | 179 scoped_refptr<GpuChannelMessageFilter> filter_; |
179 | 180 |
180 // Map of routing id to command buffer stub. | 181 // Map of routing id to command buffer stub. |
181 base::ScopedPtrHashMap<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_; | 182 base::ScopedPtrHashMap<int32_t, std::unique_ptr<GpuCommandBufferStub>> stubs_; |
182 | 183 |
183 private: | 184 private: |
184 friend class TestGpuChannel; | 185 friend class TestGpuChannel; |
| 186 friend class GpuChannelDeleter; |
185 | 187 |
186 bool OnControlMessageReceived(const IPC::Message& msg); | 188 bool OnControlMessageReceived(const IPC::Message& msg); |
187 | 189 |
188 void HandleMessage(const scoped_refptr<GpuChannelMessageQueue>& queue); | 190 void HandleMessage(const scoped_refptr<GpuChannelMessageQueue>& queue); |
189 | 191 |
190 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are | 192 // Some messages such as WaitForGetOffsetInRange and WaitForTokenInRange are |
191 // processed as soon as possible because the client is blocked until they | 193 // processed as soon as possible because the client is blocked until they |
192 // are completed. | 194 // are completed. |
193 void HandleOutOfOrderMessage(const IPC::Message& msg); | 195 void HandleOutOfOrderMessage(const IPC::Message& msg); |
194 | 196 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 scoped_refptr<SyncPointOrderData> sync_point_order_data_; | 472 scoped_refptr<SyncPointOrderData> sync_point_order_data_; |
471 | 473 |
472 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 474 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
473 scoped_refptr<PreemptionFlag> preempting_flag_; | 475 scoped_refptr<PreemptionFlag> preempting_flag_; |
474 scoped_refptr<PreemptionFlag> preempted_flag_; | 476 scoped_refptr<PreemptionFlag> preempted_flag_; |
475 SyncPointManager* const sync_point_manager_; | 477 SyncPointManager* const sync_point_manager_; |
476 | 478 |
477 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); | 479 DISALLOW_COPY_AND_ASSIGN(GpuChannelMessageQueue); |
478 }; | 480 }; |
479 | 481 |
| 482 // Helper class which stores state related to iterative deletion of a |
| 483 // GpuChannel. |
| 484 class GpuChannelDeleter { |
| 485 public: |
| 486 GpuChannelDeleter(std::unique_ptr<GpuChannel> channel); |
| 487 ~GpuChannelDeleter(); |
| 488 |
| 489 bool DeleteWithTimeout(const base::TimeTicks& timeout); |
| 490 |
| 491 private: |
| 492 std::unique_ptr<GpuChannel> channel_; |
| 493 std::queue<GpuCommandBufferStub*> pending_stubs_; |
| 494 }; |
| 495 |
480 } // namespace gpu | 496 } // namespace gpu |
481 | 497 |
482 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_ | 498 #endif // GPU_IPC_SERVICE_GPU_CHANNEL_H_ |
OLD | NEW |