Fix bad field type in ScriptRequestIncident.
[chromium-blink-merge.git] / gpu / command_buffer / service / transfer_buffer_manager.h
blobf867790d431225aa9048f469a2378a54f41211a9
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_
8 #include <set>
9 #include <vector>
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"
17 namespace gpu {
19 class GPU_EXPORT TransferBufferManagerInterface {
20 public:
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 {
31 public:
32 TransferBufferManager();
34 bool Initialize();
35 bool RegisterTransferBuffer(
36 int32 id,
37 scoped_ptr<BufferBacking> buffer_backing) override;
38 void DestroyTransferBuffer(int32 id) override;
39 scoped_refptr<Buffer> GetTransferBuffer(int32 id) override;
41 private:
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);
51 } // namespace gpu
53 #endif // GPU_COMMAND_BUFFER_SERVICE_TRANSFER_BUFFER_MANAGER_H_