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
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_
6 #define CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_
8 #include "base/memory/scoped_vector.h"
9 #include "third_party/WebKit/public/platform/WebProcessMemoryDump.h"
12 namespace trace_event
{
13 class ProcessMemoryDump
;
15 } // namespace trace_event
19 class WebMemoryAllocatorDumpImpl
;
21 // Implements the blink::WebProcessMemoryDump interface by means of proxying the
22 // calls to createMemoryAllocatorDump() to the underlying
23 // base::trace_event::ProcessMemoryDump instance.
24 class WebProcessMemoryDumpImpl
: public blink::WebProcessMemoryDump
{
26 explicit WebProcessMemoryDumpImpl(
27 base::trace_event::ProcessMemoryDump
* process_memory_dump
);
28 virtual ~WebProcessMemoryDumpImpl();
30 // blink::WebProcessMemoryDump implementation.
31 virtual blink::WebMemoryAllocatorDump
* createMemoryAllocatorDump(
32 const blink::WebString
& absolute_name
);
35 // The underlying ProcessMemoryDump instance to which the
36 // createMemoryAllocatorDump() calls will be proxied to.
37 base::trace_event::ProcessMemoryDump
* process_memory_dump_
; // Not owned.
39 // By design WebMemoryDumpProvider(s) are not supposed to hold the pointer
40 // to the WebProcessMemoryDump passed as argument of the onMemoryDump() call.
41 // Those pointers are valid only within the scope of the call and can be
42 // safely torn down once the WebProcessMemoryDumpImpl itself is destroyed.
43 ScopedVector
<WebMemoryAllocatorDumpImpl
> memory_allocator_dumps_
;
45 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDumpImpl
);
48 } // namespace content
50 #endif // CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_