Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / child / web_memory_dump_provider_adapter.h
blob7f30a44353af2659c883a2f94f18b511497b7afb
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"
11 namespace blink {
12 class WebMemoryDumpProvider;
13 } // namespace blink
15 namespace content {
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;
27 // base::trace_event::MemoryDumpProvider implementation.
28 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
29 base::trace_event::ProcessMemoryDump* pmd) override;
31 bool is_registered() const { return is_registered_; }
32 void set_is_registered(bool is_registered) { is_registered_ = is_registered; }
34 private:
35 // The underlying WebMemoryDumpProvider instance to which the OnMemoryDump()
36 // calls will be proxied to.
37 blink::WebMemoryDumpProvider* web_memory_dump_provider_; // Not owned.
39 // True iff this has been registered with the MDM (and not unregistered yet).
40 bool is_registered_;
42 DISALLOW_COPY_AND_ASSIGN(WebMemoryDumpProviderAdapter);
45 } // namespace content
47 #endif // CONTENT_CHILD_WEB_MEMORY_DUMP_PROVIDER_ADAPTER_H_