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

Side by Side Diff: ui/gl/gl_image_io_surface.mm

Issue 2771923006: Add CVPixelBufferRef memory tracking (Closed)
Patch Set: Created 3 years, 9 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 | « media/gpu/vt_video_decode_accelerator_mac.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/gpu/vt_video_decode_accelerator_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698