OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_DELEGATE_IDLE_H_ | |
6 #define GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_DELEGATE_IDLE_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "gpu/command_buffer/service/async_pixel_transfer_delegate.h" | |
11 | |
12 namespace gpu { | |
13 class ScopedSafeSharedMemory; | |
14 | |
15 // Class which handles async pixel transfers in a platform | |
16 // independent way. | |
17 class AsyncPixelTransferDelegateIdle : public AsyncPixelTransferDelegate, | |
18 public base::SupportsWeakPtr<AsyncPixelTransferDelegateIdle> { | |
19 public: | |
20 AsyncPixelTransferDelegateIdle(); | |
21 virtual ~AsyncPixelTransferDelegateIdle(); | |
22 | |
23 // implement AsyncPixelTransferDelegate: | |
24 virtual AsyncPixelTransferState* CreatePixelTransferState( | |
25 GLuint texture_id, | |
26 const AsyncTexImage2DParams& define_params) OVERRIDE; | |
27 virtual void BindCompletedAsyncTransfers() OVERRIDE; | |
28 virtual void AsyncNotifyCompletion( | |
29 const AsyncMemoryParams& mem_params, | |
30 const CompletionCallback& callback) OVERRIDE; | |
31 virtual void AsyncTexImage2D( | |
32 AsyncPixelTransferState* transfer_state, | |
33 const AsyncTexImage2DParams& tex_params, | |
34 const AsyncMemoryParams& mem_params, | |
35 const base::Closure& bind_callback) OVERRIDE; | |
36 virtual void AsyncTexSubImage2D( | |
37 AsyncPixelTransferState* transfer_state, | |
38 const AsyncTexSubImage2DParams& tex_params, | |
39 const AsyncMemoryParams& mem_params) OVERRIDE; | |
40 virtual void WaitForTransferCompletion( | |
41 AsyncPixelTransferState* transfer_state) OVERRIDE; | |
42 virtual uint32 GetTextureUploadCount() OVERRIDE; | |
43 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE; | |
44 virtual void ProcessMorePendingTransfers() OVERRIDE; | |
45 virtual bool NeedsProcessMorePendingTransfers() OVERRIDE; | |
46 | |
47 private: | |
48 struct Task { | |
49 Task(uint64 transfer_id, const base::Closure& task); | |
50 ~Task(); | |
51 | |
52 // This is non-zero if pixel transfer task. | |
53 uint64 transfer_id; | |
54 | |
55 base::Closure task; | |
56 }; | |
57 | |
58 void ProcessNotificationTasks(); | |
59 | |
60 void PerformNotifyCompletion( | |
61 AsyncMemoryParams mem_params, | |
62 ScopedSafeSharedMemory* safe_shared_memory, | |
63 const CompletionCallback& callback); | |
64 void PerformAsyncTexImage2D( | |
65 AsyncTexImage2DParams tex_params, | |
66 AsyncMemoryParams mem_params, | |
67 const base::Closure& bind_callback, | |
68 ScopedSafeSharedMemory* safe_shared_memory, | |
69 GLuint texture_id); | |
70 void PerformAsyncTexSubImage2D( | |
71 AsyncTexSubImage2DParams tex_params, | |
72 AsyncMemoryParams mem_params, | |
73 ScopedSafeSharedMemory* safe_shared_memory, | |
74 GLuint texture_id); | |
75 | |
76 int texture_upload_count_; | |
77 base::TimeDelta total_texture_upload_time_; | |
78 | |
79 std::list<Task> tasks_; | |
80 | |
81 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateIdle); | |
82 }; | |
83 | |
84 } // namespace gpu | |
85 | |
86 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_DELEGATE_IDLE_H_ | |
OLD | NEW |