| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/gl/gl_image_io_surface.h" | 5 #include "ui/gl/gl_image_io_surface.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/mac/bind_objc_block.h" | 10 #include "base/mac/bind_objc_block.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // IOSurfaceGetAllocSize will return 0 if io_surface_ is invalid. In this case | 354 // IOSurfaceGetAllocSize will return 0 if io_surface_ is invalid. In this case |
| 355 // we log 0 for consistency with other GLImage memory dump functions. | 355 // we log 0 for consistency with other GLImage memory dump functions. |
| 356 size_t size_bytes = IOSurfaceGetAllocSize(io_surface_); | 356 size_t size_bytes = IOSurfaceGetAllocSize(io_surface_); |
| 357 | 357 |
| 358 base::trace_event::MemoryAllocatorDump* dump = | 358 base::trace_event::MemoryAllocatorDump* dump = |
| 359 pmd->CreateAllocatorDump(dump_name); | 359 pmd->CreateAllocatorDump(dump_name); |
| 360 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 360 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 361 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 361 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 362 static_cast<uint64_t>(size_bytes)); | 362 static_cast<uint64_t>(size_bytes)); |
| 363 | 363 |
| 364 // The process tracing id is to identify the GpuMemoryBuffer client that |
| 365 // created the allocation. For CVPixelBufferRefs, there is no corresponding |
| 366 // GpuMemoryBuffer, so use an invalid process id. |
| 367 if (cv_pixel_buffer_) { |
| 368 process_tracing_id = |
| 369 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId; |
| 370 } |
| 371 |
| 364 auto guid = | 372 auto guid = |
| 365 GetGenericSharedMemoryGUIDForTracing(process_tracing_id, io_surface_id_); | 373 GetGenericSharedMemoryGUIDForTracing(process_tracing_id, io_surface_id_); |
| 366 pmd->CreateSharedGlobalAllocatorDump(guid); | 374 pmd->CreateSharedGlobalAllocatorDump(guid); |
| 367 pmd->AddOwnershipEdge(dump->guid(), guid); | 375 pmd->AddOwnershipEdge(dump->guid(), guid); |
| 368 } | 376 } |
| 369 | 377 |
| 370 bool GLImageIOSurface::EmulatingRGB() const { | 378 bool GLImageIOSurface::EmulatingRGB() const { |
| 371 return client_internalformat_ == GL_RGB; | 379 return client_internalformat_ == GL_RGB; |
| 372 } | 380 } |
| 373 | 381 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 395 } | 403 } |
| 396 | 404 |
| 397 // static | 405 // static |
| 398 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { | 406 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { |
| 399 if (!image || image->GetType() != Type::IOSURFACE) | 407 if (!image || image->GetType() != Type::IOSURFACE) |
| 400 return nullptr; | 408 return nullptr; |
| 401 return static_cast<GLImageIOSurface*>(image); | 409 return static_cast<GLImageIOSurface*>(image); |
| 402 } | 410 } |
| 403 | 411 |
| 404 } // namespace gl | 412 } // namespace gl |
| OLD | NEW |