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

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

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (rebase) Created 3 years, 6 months 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 | « gpu/command_buffer/common/buffer.h ('k') | gpu/command_buffer/service/buffer_manager.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "gpu/command_buffer/common/buffer.h" 5 #include "gpu/command_buffer/common/buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/numerics/safe_math.h" 12 #include "base/numerics/safe_math.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 16
17 bool BufferBacking::is_shared() const { 17 base::SharedMemory* BufferBacking::shared_memory() {
18 return false; 18 return nullptr;
19 } 19 }
20 20
21 SharedMemoryBufferBacking::SharedMemoryBufferBacking( 21 SharedMemoryBufferBacking::SharedMemoryBufferBacking(
22 std::unique_ptr<base::SharedMemory> shared_memory, 22 std::unique_ptr<base::SharedMemory> shared_memory,
23 size_t size) 23 size_t size)
24 : shared_memory_(std::move(shared_memory)), size_(size) {} 24 : shared_memory_(std::move(shared_memory)), size_(size) {}
25 25
26 SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {} 26 SharedMemoryBufferBacking::~SharedMemoryBufferBacking() {}
27 27
28 bool SharedMemoryBufferBacking::is_shared() const { 28 base::SharedMemory* SharedMemoryBufferBacking::shared_memory() {
29 return true; 29 return shared_memory_.get();
30 } 30 }
31 31
32 void* SharedMemoryBufferBacking::GetMemory() const { 32 void* SharedMemoryBufferBacking::GetMemory() const {
33 return shared_memory_->memory(); 33 return shared_memory_->memory();
34 } 34 }
35 35
36 size_t SharedMemoryBufferBacking::GetSize() const { return size_; } 36 size_t SharedMemoryBufferBacking::GetSize() const { return size_; }
37 37
38 Buffer::Buffer(std::unique_ptr<BufferBacking> backing) 38 Buffer::Buffer(std::unique_ptr<BufferBacking> backing)
39 : backing_(std::move(backing)), 39 : backing_(std::move(backing)),
(...skipping 27 matching lines...) Expand all
67 } 67 }
68 68
69 base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing( 69 base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing(
70 uint64_t tracing_process_id, 70 uint64_t tracing_process_id,
71 int32_t buffer_id) { 71 int32_t buffer_id) {
72 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf( 72 return base::trace_event::MemoryAllocatorDumpGuid(base::StringPrintf(
73 "gpu-buffer-x-process/%" PRIx64 "/%d", tracing_process_id, buffer_id)); 73 "gpu-buffer-x-process/%" PRIx64 "/%d", tracing_process_id, buffer_id));
74 } 74 }
75 75
76 } // namespace gpu 76 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/buffer.h ('k') | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698