1 // Copyright (c) 2012 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_TRANSFER_BUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_TRANSFER_BUFFER_MANAGER_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/containers/hash_tables.h"
14 #include "base/memory/shared_memory.h"
15 #include "gpu/command_buffer/common/command_buffer_shared.h"
19 class GPU_EXPORT TransferBufferManagerInterface
{
21 virtual ~TransferBufferManagerInterface();
23 virtual bool RegisterTransferBuffer(int32 id
,
24 scoped_ptr
<BufferBacking
> buffer
) = 0;
25 virtual void DestroyTransferBuffer(int32 id
) = 0;
26 virtual scoped_refptr
<Buffer
> GetTransferBuffer(int32 id
) = 0;
29 class GPU_EXPORT TransferBufferManager
30 : public TransferBufferManagerInterface
{
32 TransferBufferManager();
35 bool RegisterTransferBuffer(
37 scoped_ptr
<BufferBacking
> buffer_backing
) override
;
38 void DestroyTransferBuffer(int32 id
) override
;
39 scoped_refptr
<Buffer
> GetTransferBuffer(int32 id
) override
;
42 ~TransferBufferManager() override
;
44 typedef base::hash_map
<int32
, scoped_refptr
<Buffer
> > BufferMap
;
45 BufferMap registered_buffers_
;
46 size_t shared_memory_bytes_allocated_
;
48 DISALLOW_COPY_AND_ASSIGN(TransferBufferManager
);
53 #endif // GPU_COMMAND_BUFFER_SERVICE_TRANSFER_BUFFER_MANAGER_H_