1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_SYNC_H_
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_SYNC_H_
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "gpu/command_buffer/service/async_pixel_transfer_manager.h"
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace gpu {
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class AsyncPixelTransferManagerSync : public AsyncPixelTransferManager {
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public:
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  AsyncPixelTransferManagerSync();
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual ~AsyncPixelTransferManagerSync();
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // AsyncPixelTransferManager implementation:
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void BindCompletedAsyncTransfers() OVERRIDE;
19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void AsyncNotifyCompletion(
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      const AsyncMemoryParams& mem_params,
21eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      AsyncPixelTransferCompletionObserver* observer) OVERRIDE;
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual uint32 GetTextureUploadCount() OVERRIDE;
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual base::TimeDelta GetTotalTextureUploadTime() OVERRIDE;
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual void ProcessMorePendingTransfers() OVERRIDE;
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual bool NeedsProcessMorePendingTransfers() OVERRIDE;
264ad1aa43a48567659193a298fad74f55e00b3dd9Ben Murdoch  virtual void WaitAllAsyncTexImage2D() OVERRIDE;
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // State shared between Managers and Delegates.
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  struct SharedState {
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    SharedState();
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    ~SharedState();
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    int texture_upload_count;
34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    base::TimeDelta total_texture_upload_time;
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  };
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private:
387d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  // AsyncPixelTransferManager implementation:
397d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)  virtual AsyncPixelTransferDelegate* CreatePixelTransferDelegateImpl(
407d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)      gles2::TextureRef* ref,
417d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)      const AsyncTexImage2DParams& define_params) OVERRIDE;
427d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  SharedState shared_state_;
44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(AsyncPixelTransferManagerSync);
46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)};
47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace gpu
49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif  // GPU_COMMAND_BUFFER_SERVICE_ASYNC_PIXEL_TRANSFER_MANAGER_SYNC_H_
51