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

Unified Diff: ui/gl/gl_image_egl.cc

Issue 1263913002: FREEZE.unindexed Base URL: https://chromium.googlesource.com/chromium/src.git@textures3
Patch Set: Created 5 years, 4 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 | « ui/gl/gl_image_egl.h ('k') | ui/gl/gl_image_glx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_egl.cc
diff --git a/ui/gl/gl_image_egl.cc b/ui/gl/gl_image_egl.cc
index 0ebd7ccac909fef1c5e74d8a147e808d274271c5..685398e9ffaa17cac74e5c3e305dd660f5e68f92 100644
--- a/ui/gl/gl_image_egl.cc
+++ b/ui/gl/gl_image_egl.cc
@@ -10,29 +10,28 @@
namespace gfx {
GLImageEGL::GLImageEGL(const gfx::Size& size)
- : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {
-}
+ : egl_image_(EGL_NO_IMAGE_KHR), size_(size) {}
GLImageEGL::~GLImageEGL() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
}
-bool GLImageEGL::Initialize(EGLenum target,
- EGLClientBuffer buffer,
- const EGLint* attrs) {
+bool GLImageEGL::Initialize(
+ base::trace_event::GenericSharedMemoryId shared_memory_id,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLint* attrs) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(EGL_NO_IMAGE_KHR, egl_image_);
egl_image_ = eglCreateImageKHR(GLSurfaceEGL::GetHardwareDisplay(),
- EGL_NO_CONTEXT,
- target,
- buffer,
- attrs);
+ EGL_NO_CONTEXT, target, buffer, attrs);
if (egl_image_ == EGL_NO_IMAGE_KHR) {
DLOG(ERROR) << "Error creating EGLImage: " << ui::GetLastEGLErrorString();
return false;
}
+ shared_memory_id_ = shared_memory_id;
return true;
}
@@ -75,4 +74,24 @@ bool GLImageEGL::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
return false;
}
+void GLImageEGL::DumpMemory(base::trace_event::ProcessMemoryDump* pmd,
+ uint64_t process_tracing_id,
+ const std::string& dump_name) {
+ // TODO(ericrk): Don't always assume 4BPP.
+ const size_t bytes_per_pixel = 4;
+ size_t size_in_bytes =
+ bytes_per_pixel * GetSize().width() * GetSize().height();
+
+ base::trace_event::MemoryAllocatorDump* dump =
+ pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ static_cast<uint64_t>(size_in_bytes));
+
+ auto guid = base::trace_event::GetGenericSharedMemoryGUIDForTracing(
+ process_tracing_id, shared_memory_id_);
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid);
+}
+
} // namespace gfx
« no previous file with comments | « ui/gl/gl_image_egl.h ('k') | ui/gl/gl_image_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698