Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: gpu/command_buffer/common/buffer.h

Issue 2575803002: Bug fix: TranferBufferManager's SharedMemory memory usage reporting was wrong (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/common/buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/trace_event/memory_allocator_dump.h" 16 #include "base/trace_event/memory_allocator_dump.h"
17 #include "gpu/gpu_export.h" 17 #include "gpu/gpu_export.h"
18 18
19 namespace base { 19 namespace base {
20 class SharedMemory; 20 class SharedMemory;
21 } 21 }
22 22
23 namespace gpu { 23 namespace gpu {
24 24
25 class GPU_EXPORT BufferBacking { 25 class GPU_EXPORT BufferBacking {
26 public: 26 public:
27 virtual ~BufferBacking() {} 27 virtual ~BufferBacking() {}
28 virtual bool is_shared() const;
28 virtual void* GetMemory() const = 0; 29 virtual void* GetMemory() const = 0;
29 virtual size_t GetSize() const = 0; 30 virtual size_t GetSize() const = 0;
30 }; 31 };
31 32
32 class GPU_EXPORT SharedMemoryBufferBacking : public BufferBacking { 33 class GPU_EXPORT SharedMemoryBufferBacking : public BufferBacking {
33 public: 34 public:
34 SharedMemoryBufferBacking(std::unique_ptr<base::SharedMemory> shared_memory, 35 SharedMemoryBufferBacking(std::unique_ptr<base::SharedMemory> shared_memory,
35 size_t size); 36 size_t size);
36 ~SharedMemoryBufferBacking() override; 37 ~SharedMemoryBufferBacking() override;
38 bool is_shared() const override;
37 void* GetMemory() const override; 39 void* GetMemory() const override;
38 size_t GetSize() const override; 40 size_t GetSize() const override;
39 base::SharedMemory* shared_memory() { return shared_memory_.get(); } 41 base::SharedMemory* shared_memory() { return shared_memory_.get(); }
40 42
41 private: 43 private:
42 std::unique_ptr<base::SharedMemory> shared_memory_; 44 std::unique_ptr<base::SharedMemory> shared_memory_;
43 size_t size_; 45 size_t size_;
44 DISALLOW_COPY_AND_ASSIGN(SharedMemoryBufferBacking); 46 DISALLOW_COPY_AND_ASSIGN(SharedMemoryBufferBacking);
45 }; 47 };
46 48
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 90 }
89 91
90 // Generates GUID which can be used to trace buffer using an Id. 92 // Generates GUID which can be used to trace buffer using an Id.
91 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( 93 GPU_EXPORT base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing(
92 uint64_t tracing_process_id, 94 uint64_t tracing_process_id,
93 int32_t buffer_id); 95 int32_t buffer_id);
94 96
95 } // namespace gpu 97 } // namespace gpu
96 98
97 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_ 99 #endif // GPU_COMMAND_BUFFER_COMMON_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/common/buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698