| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_CHILD_WEB_MEMORY_DUMP_PROVIDER_ADAPTER_H_ | |
| 6 #define CONTENT_CHILD_WEB_MEMORY_DUMP_PROVIDER_ADAPTER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/trace_event/memory_dump_provider.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 class WebMemoryDumpProvider; | |
| 13 } // namespace blink | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 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 { | |
| 23 public: | |
| 24 explicit WebMemoryDumpProviderAdapter(blink::WebMemoryDumpProvider* wmdp); | |
| 25 ~WebMemoryDumpProviderAdapter() override; | |
| 26 | |
| 27 // base::trace_event::MemoryDumpProvider implementation. | |
| 28 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | |
| 29 base::trace_event::ProcessMemoryDump* pmd) override; | |
| 30 | |
| 31 void OnHeapProfilingEnabled(bool enabled) override; | |
| 32 | |
| 33 bool is_registered() const { return is_registered_; } | |
| 34 void set_is_registered(bool is_registered) { is_registered_ = is_registered; } | |
| 35 | |
| 36 private: | |
| 37 // The underlying WebMemoryDumpProvider instance to which the OnMemoryDump() | |
| 38 // calls will be proxied to. | |
| 39 blink::WebMemoryDumpProvider* web_memory_dump_provider_; // Not owned. | |
| 40 | |
| 41 // True iff this has been registered with the MDM (and not unregistered yet). | |
| 42 bool is_registered_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(WebMemoryDumpProviderAdapter); | |
| 45 }; | |
| 46 | |
| 47 } // namespace content | |
| 48 | |
| 49 #endif // CONTENT_CHILD_WEB_MEMORY_DUMP_PROVIDER_ADAPTER_H_ | |
| OLD | NEW |