JSONStringValueSerializer takes a StringPiece instead of std::string&.
[chromium-blink-merge.git] / gpu / command_buffer / service / async_pixel_transfer_manager_idle.h
blob41a77b397dc9a6cccb90b3a072f948ff5929d529
1 // Copyright 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.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_IDLE_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_IDLE_H_
8 #include <list>
10 #include "gpu/command_buffer/service/async_pixel_transfer_manager.h"
12 namespace gpu {
14 class AsyncPixelTransferManagerIdle : public AsyncPixelTransferManager {
15 public:
16 explicit AsyncPixelTransferManagerIdle(
17 bool use_teximage2d_over_texsubimage2d);
18 ~AsyncPixelTransferManagerIdle() override;
20 // AsyncPixelTransferManager implementation:
21 void BindCompletedAsyncTransfers() override;
22 void AsyncNotifyCompletion(
23 const AsyncMemoryParams& mem_params,
24 AsyncPixelTransferCompletionObserver* observer) override;
25 uint32 GetTextureUploadCount() override;
26 base::TimeDelta GetTotalTextureUploadTime() override;
27 void ProcessMorePendingTransfers() override;
28 bool NeedsProcessMorePendingTransfers() override;
29 void WaitAllAsyncTexImage2D() override;
31 struct Task {
32 Task(uint64 transfer_id,
33 AsyncPixelTransferDelegate* delegate,
34 const base::Closure& task);
35 ~Task();
37 // This is non-zero if pixel transfer task.
38 uint64 transfer_id;
40 AsyncPixelTransferDelegate* delegate;
42 base::Closure task;
45 // State shared between Managers and Delegates.
46 struct SharedState {
47 explicit SharedState(bool use_teximage2d_over_texsubimage2d);
48 ~SharedState();
49 void ProcessNotificationTasks();
51 const bool use_teximage2d_over_texsubimage2d;
52 int texture_upload_count;
53 base::TimeDelta total_texture_upload_time;
54 std::list<Task> tasks;
57 private:
58 // AsyncPixelTransferManager implementation:
59 AsyncPixelTransferDelegate* CreatePixelTransferDelegateImpl(
60 gles2::TextureRef* ref,
61 const AsyncTexImage2DParams& define_params) override;
63 SharedState shared_state_;
65 DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferManagerIdle);
68 } // namespace gpu
70 #endif // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_IDLE_H_