OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ |
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/trace_event/memory_dump_provider.h" | 10 #include "base/trace_event/memory_dump_provider.h" |
11 | 11 |
12 #if defined(OS_LINUX) || defined(OS_ANDROID) | |
13 #include "base/files/scoped_file.h" | |
14 #endif | |
15 | |
16 namespace base { | 12 namespace base { |
17 namespace trace_event { | 13 namespace trace_event { |
18 | 14 |
19 // Dump provider which collects process-wide memory stats. | 15 // Dump provider which collects process-wide memory stats. |
20 class BASE_EXPORT ProcessMemoryMapsDumpProvider : public MemoryDumpProvider { | 16 class BASE_EXPORT ProcessMemoryMapsDumpProvider : public MemoryDumpProvider { |
21 public: | 17 public: |
22 static ProcessMemoryMapsDumpProvider* GetInstance(); | 18 static ProcessMemoryMapsDumpProvider* GetInstance(); |
23 | 19 |
24 // MemoryDumpProvider implementation. | 20 // MemoryDumpProvider implementation. |
25 bool OnMemoryDump(const MemoryDumpArgs& args, | 21 bool OnMemoryDump(const MemoryDumpArgs& args, |
26 ProcessMemoryDump* pmd) override; | 22 ProcessMemoryDump* pmd) override; |
27 | 23 |
28 private: | 24 private: |
29 friend struct DefaultSingletonTraits<ProcessMemoryMapsDumpProvider>; | 25 friend struct DefaultSingletonTraits<ProcessMemoryMapsDumpProvider>; |
30 FRIEND_TEST_ALL_PREFIXES(ProcessMemoryMapsDumpProviderTest, ParseProcSmaps); | 26 FRIEND_TEST_ALL_PREFIXES(ProcessMemoryMapsDumpProviderTest, ParseProcSmaps); |
31 | 27 |
32 #if defined(OS_LINUX) || defined(OS_ANDROID) | 28 #if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) |
33 static FILE* proc_smaps_for_testing; | 29 static FILE* proc_smaps_for_testing; |
34 #endif | 30 #endif |
35 | 31 |
36 ProcessMemoryMapsDumpProvider(); | 32 ProcessMemoryMapsDumpProvider(); |
37 ~ProcessMemoryMapsDumpProvider() override; | 33 ~ProcessMemoryMapsDumpProvider() override; |
38 | 34 |
39 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMapsDumpProvider); | 35 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMapsDumpProvider); |
40 }; | 36 }; |
41 | 37 |
42 } // namespace trace_event | 38 } // namespace trace_event |
43 } // namespace base | 39 } // namespace base |
44 | 40 |
45 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ | 41 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_ |
OLD | NEW |