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

Unified Diff: gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (rebase) Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
diff --git a/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc b/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
index 54423d51ceef266fe271be741f8bfa1725b01c56..92b36a30d5d97bf3412de3425070376645e9af4e 100644
--- a/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
+++ b/gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.cc
@@ -12,7 +12,6 @@
#include "base/numerics/safe_math.h"
#include "base/process/memory.h"
#include "ui/gfx/buffer_format_util.h"
-#include "ui/gfx/gpu_memory_buffer_tracing.h"
#include "ui/gl/gl_bindings.h"
namespace gpu {
@@ -47,7 +46,8 @@ GpuMemoryBufferImplSharedMemory::Create(gfx::GpuMemoryBufferId id,
std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
if (!shared_memory->CreateAndMapAnonymous(buffer_size))
return nullptr;
-
+ const int kImportance = 2;
+ shared_memory->set_importance(kImportance);
return base::WrapUnique(new GpuMemoryBufferImplSharedMemory(
id, size, format, callback, std::move(shared_memory), 0,
gfx::RowSizeForBufferFormat(size.width(), format, 0)));
@@ -86,11 +86,13 @@ GpuMemoryBufferImplSharedMemory::CreateFromHandle(
gfx::BufferUsage usage,
const DestructionCallback& callback) {
DCHECK(base::SharedMemory::IsHandleValid(handle.handle));
-
+ std::unique_ptr<base::SharedMemory> shared_memory =
+ base::MakeUnique<base::SharedMemory>(handle.handle, false);
+ const int kImportance = 2;
+ shared_memory->set_importance(kImportance);
return base::WrapUnique(new GpuMemoryBufferImplSharedMemory(
- handle.id, size, format, callback,
- base::MakeUnique<base::SharedMemory>(handle.handle, false), handle.offset,
- handle.stride));
+ handle.id, size, format, callback, std::move(shared_memory),
+ handle.offset, handle.stride));
}
// static
@@ -215,7 +217,11 @@ gfx::GpuMemoryBufferHandle GpuMemoryBufferImplSharedMemory::GetHandle() const {
base::trace_event::MemoryAllocatorDumpGuid
GpuMemoryBufferImplSharedMemory::GetGUIDForTracing(
uint64_t tracing_process_id) const {
- return gfx::GetSharedMemoryGUIDForTracing(tracing_process_id, id_);
+ return shared_memory_->handle().GetGUIDForTracing();
+}
+
+base::SharedMemory* GpuMemoryBufferImplSharedMemory::GetSharedMemory() {
+ return shared_memory_.get();
}
} // namespace gpu
« no previous file with comments | « gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698