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_MEMORY_DUMP_PROVIDER_ADAPTER_H_
6 #define CONTENT_CHILD_WEB_MEMORY_DUMP_PROVIDER_ADAPTER_H_
8 #include "base/macros.h"
9 #include "base/trace_event/memory_dump_provider.h"
12 class WebMemoryDumpProvider
;
17 // Adapter class which makes it possible to register a WebMemoryDumpProvider (
18 // from blink) to base::trace_event::MemoryDumpManager, which expects a
19 // MemoryDumpProvider instead.
20 // This is essentially proxying the OnMemoryDump from chromium base to blink.
21 class WebMemoryDumpProviderAdapter
22 : public base::trace_event::MemoryDumpProvider
{
24 explicit WebMemoryDumpProviderAdapter(blink::WebMemoryDumpProvider
* wmdp
);
25 ~WebMemoryDumpProviderAdapter() override
;
27 // base::trace_event::MemoryDumpProvider implementation.
28 bool OnMemoryDump(base::trace_event::ProcessMemoryDump
* pmd
) override
;
30 bool is_registered() const { return is_registered_
; }
31 void set_is_registered(bool is_registered
) { is_registered_
= is_registered
; }
34 // The underlying WebMemoryDumpProvider instance to which the OnMemoryDump()
35 // calls will be proxied to.
36 blink::WebMemoryDumpProvider
* web_memory_dump_provider_
; // Not owned.
38 // True iff this has been registered with the MDM (and not unregistered yet).
41 DISALLOW_COPY_AND_ASSIGN(WebMemoryDumpProviderAdapter
);
44 } // namespace content
46 #endif // CONTENT_CHILD_WEB_MEMORY_DUMP_PROVIDER_ADAPTER_H_