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

Side by Side Diff: ui/gl/async_pixel_transfer_delegate_idle.h

Issue 12040049: gpu: Implement idle async pixel transfers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECKs to ensure idle async uploads are only used with GL_TEXTURE_2D target Created 7 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 | Annotate | Revision Log
OLDNEW
(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 UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
6 #define UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
7
8 #include <list>
9 #include <queue>
10
11 #include "base/callback.h"
12 #include "ui/gl/async_pixel_transfer_delegate.h"
13
14 namespace gfx {
15 class GLSurface;
16 class TransferStateInternalIdle;
17 class ScopedSafeSharedMemory;
18
19 // Class which handles async pixel transfers in a platform
20 // independent way.
21 class AsyncPixelTransferDelegateIdle : public AsyncPixelTransferDelegate,
22 public base::SupportsWeakPtr<AsyncPixelTransferDelegateIdle> {
23 public:
24 static scoped_ptr<AsyncPixelTransferDelegate>
25 Create(gfx::GLContext* context);
26
27 AsyncPixelTransferDelegateIdle();
28 virtual ~AsyncPixelTransferDelegateIdle();
29
30 // implement AsyncPixelTransferDelegate:
31 virtual bool BindCompletedAsyncTransfers() OVERRIDE;
32 virtual void AsyncNotifyCompletion(
33 const AsyncMemoryParams& mem_params,
34 const CompletionCallback& callback) OVERRIDE;
35 virtual void AsyncTexImage2D(
36 AsyncPixelTransferState* transfer_state,
37 const AsyncTexImage2DParams& tex_params,
38 const AsyncMemoryParams& mem_params,
39 const base::Closure& bind_callback) OVERRIDE;
40 virtual void AsyncTexSubImage2D(
41 AsyncPixelTransferState* transfer_state,
42 const AsyncTexSubImage2DParams& tex_params,
43 const AsyncMemoryParams& mem_params) OVERRIDE;
44 virtual void WaitForTransferCompletion(
45 AsyncPixelTransferState* transfer_state) OVERRIDE;
46 virtual uint32 GetTextureUploadCount() OVERRIDE;
47 virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE;
48 virtual bool ProcessMorePendingTransfers() OVERRIDE;
49 virtual bool NeedsProcessMorePendingTransfers() OVERRIDE;
50
51 private:
52 struct Transfer {
53 Transfer(uint64 id, const base::Closure& task);
54 ~Transfer();
55
56 uint64 id;
57 base::Closure task;
58 std::queue<base::Closure> notifications;
59 };
60
61 void ProcessTransfer(Transfer& transfer);
62
63 // implement AsyncPixelTransferDelegate:
64 virtual AsyncPixelTransferState*
65 CreateRawPixelTransferState(
66 GLuint texture_id,
67 const AsyncTexImage2DParams& define_params) OVERRIDE;
68
69 void PerformNotifyCompletion(
70 AsyncMemoryParams mem_params,
71 ScopedSafeSharedMemory* safe_shared_memory,
72 const CompletionCallback& callback);
73 void PerformAsyncTexImage2D(
74 AsyncTexImage2DParams tex_params,
75 AsyncMemoryParams mem_params,
76 const base::Closure& bind_callback,
77 ScopedSafeSharedMemory* safe_shared_memory,
78 GLuint texture_id);
79 void PerformAsyncTexSubImage2D(
80 AsyncTexSubImage2DParams tex_params,
81 AsyncMemoryParams mem_params,
82 ScopedSafeSharedMemory* safe_shared_memory,
83 GLuint texture_id);
84
85 int texture_upload_count_;
86 base::TimeDelta total_texture_upload_time_;
87
88 std::list<Transfer> transfers_;
89
90 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateIdle);
91 };
92
93 } // namespace gfx
94
95 #endif // UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
96
OLDNEW
« no previous file with comments | « ui/gl/async_pixel_transfer_delegate_android.cc ('k') | ui/gl/async_pixel_transfer_delegate_idle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698