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

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

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (wip) 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
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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 auto guid = 364 auto guid =
365 GetGenericSharedMemoryGUIDForTracing(process_tracing_id, io_surface_id_); 365 GetGenericSharedMemoryGUIDForTracing(process_tracing_id, io_surface_id_);
366 pmd->CreateSharedGlobalAllocatorDump(guid); 366 pmd->CreateSharedGlobalAllocatorDump(guid);
367 pmd->AddOwnershipEdge(dump->guid(), guid); 367 pmd->AddOwnershipEdge(dump->guid(), guid);
368 // TODO(hajimehoshi): Call
369 // base::SharedMemoryDumpProvider::AddOwnershipEdgeToSharedGlobalDump to
370 // report shared memory usage correctly.
368 } 371 }
369 372
370 bool GLImageIOSurface::EmulatingRGB() const { 373 bool GLImageIOSurface::EmulatingRGB() const {
371 return client_internalformat_ == GL_RGB; 374 return client_internalformat_ == GL_RGB;
372 } 375 }
373 376
374 bool GLImageIOSurface::CanCheckIOSurfaceIsInUse() const { 377 bool GLImageIOSurface::CanCheckIOSurfaceIsInUse() const {
375 return !cv_pixel_buffer_; 378 return !cv_pixel_buffer_;
376 } 379 }
377 380
(...skipping 17 matching lines...) Expand all
395 } 398 }
396 399
397 // static 400 // static
398 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { 401 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) {
399 if (!image || image->GetType() != Type::IOSURFACE) 402 if (!image || image->GetType() != Type::IOSURFACE)
400 return nullptr; 403 return nullptr;
401 return static_cast<GLImageIOSurface*>(image); 404 return static_cast<GLImageIOSurface*>(image);
402 } 405 }
403 406
404 } // namespace gl 407 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698