Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / command_buffer / service / transfer_buffer_manager.h
blob8fae98c911fdeb0eff53ee4e5d70f73887e663c3
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/ref_counted.h"
15 #include "base/memory/shared_memory.h"
16 #include "gpu/command_buffer/common/command_buffer_shared.h"
18 namespace gpu {
20 class GPU_EXPORT TransferBufferManagerInterface :
21 public base::RefCounted<TransferBufferManagerInterface> {
22 public:
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;
28 protected:
29 friend class base::RefCounted<TransferBufferManagerInterface>;
31 virtual ~TransferBufferManagerInterface();
34 class GPU_EXPORT TransferBufferManager
35 : public TransferBufferManagerInterface {
36 public:
37 TransferBufferManager();
39 bool Initialize();
40 bool RegisterTransferBuffer(
41 int32 id,
42 scoped_ptr<BufferBacking> buffer_backing) override;
43 void DestroyTransferBuffer(int32 id) override;
44 scoped_refptr<Buffer> GetTransferBuffer(int32 id) override;
46 private:
47 ~TransferBufferManager() override;
49 typedef base::hash_map<int32, scoped_refptr<Buffer> > BufferMap;
50 BufferMap registered_buffers_;
51 size_t shared_memory_bytes_allocated_;
53 DISALLOW_COPY_AND_ASSIGN(TransferBufferManager);
56 } // namespace gpu
58 #endif // GPU_COMMAND_BUFFER_SERVICE_TRANSFER_BUFFER_MANAGER_H_