summaryrefslogtreecommitdiffstats
path: root/ui/gl/gl_image_shared_memory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/gl/gl_image_shared_memory.cc')
-rw-r--r--ui/gl/gl_image_shared_memory.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc
index 6ca7905..16ec6cb 100644
--- a/ui/gl/gl_image_shared_memory.cc
+++ b/ui/gl/gl_image_shared_memory.cc
@@ -5,18 +5,16 @@
#include "ui/gl/gl_image_shared_memory.h"
#include "base/logging.h"
-#include "base/memory/shared_memory.h"
#include "base/numerics/safe_math.h"
#include "base/process/process_handle.h"
-#include "base/trace_event/memory_allocator_dump.h"
-#include "base/trace_event/memory_dump_manager.h"
-#include "base/trace_event/process_memory_dump.h"
namespace gfx {
namespace {
// Returns true if the size is valid and false otherwise.
-bool SizeInBytes(const Size& size, BufferFormat format, size_t* size_in_bytes) {
+bool SizeInBytes(const gfx::Size& size,
+ gfx::BufferFormat format,
+ size_t* size_in_bytes) {
if (size.IsEmpty())
return false;
@@ -33,17 +31,19 @@ bool SizeInBytes(const Size& size, BufferFormat format, size_t* size_in_bytes) {
} // namespace
-GLImageSharedMemory::GLImageSharedMemory(const Size& size,
+GLImageSharedMemory::GLImageSharedMemory(const gfx::Size& size,
unsigned internalformat)
- : GLImageMemory(size, internalformat) {}
+ : GLImageMemory(size, internalformat) {
+}
GLImageSharedMemory::~GLImageSharedMemory() {
DCHECK(!shared_memory_);
}
-bool GLImageSharedMemory::Initialize(const base::SharedMemoryHandle& handle,
- GenericSharedMemoryId shared_memory_id,
- BufferFormat format) {
+bool GLImageSharedMemory::Initialize(
+ const base::SharedMemoryHandle& handle,
+ gfx::GenericSharedMemoryId shared_memory_id,
+ gfx::BufferFormat format) {
size_t size_in_bytes;
if (!SizeInBytes(GetSize(), format, &size_in_bytes))
return false;
@@ -98,15 +98,18 @@ void GLImageSharedMemory::OnMemoryDump(
// Dump under "/shared_memory", as the base class may also dump to
// "/texture_memory".
base::trace_event::MemoryAllocatorDump* dump =
- pmd->CreateAllocatorDump(dump_name + "/shared_memory");
+ pmd->CreateAllocatorDump(dump_name + "/private_memory");
dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
static_cast<uint64_t>(size_in_bytes));
- auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
- shared_memory_id_);
+ auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
+ shared_memory_id_);
pmd->CreateSharedGlobalAllocatorDump(guid);
pmd->AddOwnershipEdge(dump->guid(), guid);
+
+ // Also dump the base class's texture memory.
+ GLImageMemory::OnMemoryDump(pmd, process_tracing_id, dump_name);
}
} // namespace gfx