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

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: rebase 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 void ProcessPendingTransfers() OVERRIDE;
epenner 2013/03/13 18:58:01 Nit: This name sounds like it does all the transfe
reveman 2013/03/14 01:12:45 Now ProcessMorePendingTransfers.
49 virtual bool NeedsProcessPendingTransfers() OVERRIDE;
50
51 private:
52 struct Transfer {
53 Transfer(TransferStateInternalIdle* state, const base::Closure& task);
54 ~Transfer();
55
56 scoped_refptr<TransferStateInternalIdle> state;
epenner 2013/03/13 18:58:01 Can you confirm what happens if an AsyncPixelTrans
reveman 2013/03/14 01:12:45 oops, messed that up in my previous patch. I think
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 scoped_refptr<TransferStateInternalIdle> state,
75 AsyncTexImage2DParams tex_params,
76 AsyncMemoryParams mem_params,
77 const base::Closure& bind_callback,
78 ScopedSafeSharedMemory* safe_shared_memory);
79 void PerformAsyncTexSubImage2D(
80 scoped_refptr<TransferStateInternalIdle> state,
81 AsyncTexSubImage2DParams tex_params,
82 AsyncMemoryParams mem_params,
83 ScopedSafeSharedMemory* safe_shared_memory);
84
85 int texture_upload_count_;
86 base::TimeDelta total_texture_upload_time_;
87
88 bool texture_dirty_;
89 std::list<Transfer> transfers_;
90
91 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferDelegateIdle);
92 };
93
94 } // namespace gfx
95
96 #endif // UI_GL_ASYNC_TASK_DELEGATE_IDLE_H_
97
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698