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

Side by Side Diff: media/filters/vpx_video_decoder.cc

Issue 1262333005: [tracing] Introduce MemoryDumpArgs to enable light and heavy dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | skia/ext/skia_memory_dump_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/filters/vpx_video_decoder.h" 5 #include "media/filters/vpx_video_decoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // being used by libvpx. Parameters: 95 // being used by libvpx. Parameters:
96 // |user_priv| Private data passed to libvpx (pointer to memory pool). 96 // |user_priv| Private data passed to libvpx (pointer to memory pool).
97 // |fb| Pointer to the frame buffer that's being released. 97 // |fb| Pointer to the frame buffer that's being released.
98 static int32 ReleaseVP9FrameBuffer(void *user_priv, 98 static int32 ReleaseVP9FrameBuffer(void *user_priv,
99 vpx_codec_frame_buffer *fb); 99 vpx_codec_frame_buffer *fb);
100 100
101 // Generates a "no_longer_needed" closure that holds a reference 101 // Generates a "no_longer_needed" closure that holds a reference
102 // to this pool. 102 // to this pool.
103 base::Closure CreateFrameCallback(void* fb_priv_data); 103 base::Closure CreateFrameCallback(void* fb_priv_data);
104 104
105 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) override; 105 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
106 base::trace_event::ProcessMemoryDump* pmd) override;
106 107
107 private: 108 private:
108 friend class base::RefCountedThreadSafe<VpxVideoDecoder::MemoryPool>; 109 friend class base::RefCountedThreadSafe<VpxVideoDecoder::MemoryPool>;
109 ~MemoryPool() override; 110 ~MemoryPool() override;
110 111
111 // Reference counted frame buffers used for VP9 decoding. Reference counting 112 // Reference counted frame buffers used for VP9 decoding. Reference counting
112 // is done manually because both chromium and libvpx has to release this 113 // is done manually because both chromium and libvpx has to release this
113 // before a buffer can be re-used. 114 // before a buffer can be re-used.
114 struct VP9FrameBuffer { 115 struct VP9FrameBuffer {
115 VP9FrameBuffer() : ref_cnt(0) {} 116 VP9FrameBuffer() : ref_cnt(0) {}
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 base::Closure VpxVideoDecoder::MemoryPool::CreateFrameCallback( 188 base::Closure VpxVideoDecoder::MemoryPool::CreateFrameCallback(
188 void* fb_priv_data) { 189 void* fb_priv_data) {
189 VP9FrameBuffer* frame_buffer = static_cast<VP9FrameBuffer*>(fb_priv_data); 190 VP9FrameBuffer* frame_buffer = static_cast<VP9FrameBuffer*>(fb_priv_data);
190 ++frame_buffer->ref_cnt; 191 ++frame_buffer->ref_cnt;
191 return BindToCurrentLoop( 192 return BindToCurrentLoop(
192 base::Bind(&MemoryPool::OnVideoFrameDestroyed, this, 193 base::Bind(&MemoryPool::OnVideoFrameDestroyed, this,
193 frame_buffer)); 194 frame_buffer));
194 } 195 }
195 196
196 bool VpxVideoDecoder::MemoryPool::OnMemoryDump( 197 bool VpxVideoDecoder::MemoryPool::OnMemoryDump(
198 const base::trace_event::MemoryDumpArgs& args,
197 base::trace_event::ProcessMemoryDump* pmd) { 199 base::trace_event::ProcessMemoryDump* pmd) {
198 base::trace_event::MemoryAllocatorDump* memory_dump = 200 base::trace_event::MemoryAllocatorDump* memory_dump =
199 pmd->CreateAllocatorDump("media/vpx/memory_pool"); 201 pmd->CreateAllocatorDump("media/vpx/memory_pool");
200 base::trace_event::MemoryAllocatorDump* used_memory_dump = 202 base::trace_event::MemoryAllocatorDump* used_memory_dump =
201 pmd->CreateAllocatorDump("media/vpx/memory_pool/used"); 203 pmd->CreateAllocatorDump("media/vpx/memory_pool/used");
202 204
203 pmd->AddSuballocation(memory_dump->guid(), 205 pmd->AddSuballocation(memory_dump->guid(),
204 base::trace_event::MemoryDumpManager::GetInstance() 206 base::trace_event::MemoryDumpManager::GetInstance()
205 ->system_allocator_pool_name()); 207 ->system_allocator_pool_name());
206 size_t bytes_used = 0; 208 size_t bytes_used = 0;
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); 573 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get());
572 return; 574 return;
573 } 575 }
574 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], 576 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
575 vpx_image_alpha->stride[VPX_PLANE_Y], 577 vpx_image_alpha->stride[VPX_PLANE_Y],
576 vpx_image_alpha->d_h, 578 vpx_image_alpha->d_h,
577 video_frame->get()); 579 video_frame->get());
578 } 580 }
579 581
580 } // namespace media 582 } // namespace media
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | skia/ext/skia_memory_dump_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698