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

Side by Side Diff: media/video/gpu_memory_buffer_video_frame_pool.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Implement buckets Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "media/video/gpu_memory_buffer_video_frame_pool.h" 5 #include "media/video/gpu_memory_buffer_video_frame_pool.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <algorithm> 12 #include <algorithm>
13 #include <list> 13 #include <list>
14 #include <memory> 14 #include <memory>
15 #include <utility> 15 #include <utility>
16 16
17 #include "base/barrier_closure.h" 17 #include "base/barrier_closure.h"
18 #include "base/bind.h" 18 #include "base/bind.h"
19 #include "base/containers/stack_container.h" 19 #include "base/containers/stack_container.h"
20 #include "base/location.h" 20 #include "base/location.h"
21 #include "base/macros.h" 21 #include "base/macros.h"
22 #include "base/memory/shared_memory_tracker.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "base/trace_event/memory_dump_manager.h" 24 #include "base/trace_event/memory_dump_manager.h"
24 #include "base/trace_event/memory_dump_provider.h" 25 #include "base/trace_event/memory_dump_provider.h"
25 #include "base/trace_event/trace_event.h" 26 #include "base/trace_event/trace_event.h"
26 #include "gpu/GLES2/gl2extchromium.h" 27 #include "gpu/GLES2/gl2extchromium.h"
27 #include "gpu/command_buffer/client/gles2_interface.h" 28 #include "gpu/command_buffer/client/gles2_interface.h"
28 #include "media/base/bind_to_current_loop.h" 29 #include "media/base/bind_to_current_loop.h"
29 #include "media/renderers/gpu_video_accelerator_factories.h" 30 #include "media/renderers/gpu_video_accelerator_factories.h"
30 #include "third_party/libyuv/include/libyuv.h" 31 #include "third_party/libyuv/include/libyuv.h"
31 #include "ui/gfx/buffer_format_util.h" 32 #include "ui/gfx/buffer_format_util.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 471 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
471 buffer_size_in_bytes); 472 buffer_size_in_bytes);
472 dump->AddScalar("free_size", 473 dump->AddScalar("free_size",
473 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 474 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
474 frame_resources->IsInUse() ? 0 : buffer_size_in_bytes); 475 frame_resources->IsInUse() ? 0 : buffer_size_in_bytes);
475 base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid = 476 base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid =
476 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, 477 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id,
477 buffer_id); 478 buffer_id);
478 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); 479 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid);
479 pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid, kImportance); 480 pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid, kImportance);
481 base::SharedMemoryHandle shared_memory_handle =
482 plane_resource.gpu_memory_buffer->GetHandle().handle;
483 base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump(
484 pmd, shared_buffer_guid, shared_memory_handle,
485 buffer_size_in_bytes);
480 } 486 }
481 } 487 }
482 } 488 }
483 return true; 489 return true;
484 } 490 }
485 491
486 void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDone( 492 void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDone(
487 const scoped_refptr<VideoFrame>& video_frame, 493 const scoped_refptr<VideoFrame>& video_frame,
488 FrameResources* frame_resources, 494 FrameResources* frame_resources,
489 const FrameReadyCB& frame_ready_cb) { 495 const FrameReadyCB& frame_ready_cb) {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 832 }
827 833
828 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( 834 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame(
829 const scoped_refptr<VideoFrame>& video_frame, 835 const scoped_refptr<VideoFrame>& video_frame,
830 const FrameReadyCB& frame_ready_cb) { 836 const FrameReadyCB& frame_ready_cb) {
831 DCHECK(video_frame); 837 DCHECK(video_frame);
832 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); 838 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb);
833 } 839 }
834 840
835 } // namespace media 841 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698