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

Side by Side Diff: components/tracing/graphics_memory_dump_provider_android.h

Issue 2028043002: tracing: restructure to the components/tracing folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
(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 COMPONENTS_TRACING_GRAPHICS_MEMORY_DUMP_PROVIDER_ANDROID_H_
6 #define COMPONENTS_TRACING_GRAPHICS_MEMORY_DUMP_PROVIDER_ANDROID_H_
7
8 #include <stddef.h>
9
10 #include <string>
11
12 #include "base/containers/hash_tables.h"
13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h"
15 #include "base/memory/singleton.h"
16 #include "base/trace_event/memory_dump_provider.h"
17 #include "components/tracing/tracing_export.h"
18
19 namespace tracing {
20
21 // Dump provider which collects memory stats about graphics memory on Android.
22 // This requires the presence of the memtrack_helper daemon, which must be
23 // executed separetely via a (root) adb shell command. The dump provider will
24 // fail (and hence disabled by the MemoryDumpManager) in absence of the helper.
25 // See the design-doc https://goo.gl/4Y30p9 for more details.
26 class TRACING_EXPORT GraphicsMemoryDumpProvider
27 : public base::trace_event::MemoryDumpProvider {
28 public:
29 static GraphicsMemoryDumpProvider* GetInstance();
30
31 // MemoryDumpProvider implementation.
32 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
33 base::trace_event::ProcessMemoryDump* pmd) override;
34
35 private:
36 FRIEND_TEST_ALL_PREFIXES(GraphicsMemoryDumpProviderTest, ParseResponse);
37 friend struct base::DefaultSingletonTraits<GraphicsMemoryDumpProvider>;
38
39 void ParseResponseAndAddToDump(const char* buf,
40 size_t length,
41 base::trace_event::ProcessMemoryDump* pmd);
42
43 GraphicsMemoryDumpProvider();
44 ~GraphicsMemoryDumpProvider() override;
45
46 static const char kDumpBaseName[]; // Used by the unittest.
47
48 // Stores key names coming from the memtrack helper in long-lived storage.
49 // This is to allow using cheap char* strings in tracing without copies.
50 base::hash_set<std::string> key_names_;
51
52 DISALLOW_COPY_AND_ASSIGN(GraphicsMemoryDumpProvider);
53 };
54
55 } // namespace tracing
56
57 #endif // COMPONENTS_TRACING_GRAPHICS_MEMORY_DUMP_PROVIDER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698