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

Side by Side Diff: base/trace_event/process_memory_maps_dump_provider.cc

Issue 1273413002: [tracing] Mechanical rename of LevelOfDetail enum to enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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 #include "base/trace_event/process_memory_maps_dump_provider.h" 5 #include "base/trace_event/process_memory_maps_dump_provider.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 #include <fstream> 8 #include <fstream>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 ProcessMemoryMapsDumpProvider::~ProcessMemoryMapsDumpProvider() { 163 ProcessMemoryMapsDumpProvider::~ProcessMemoryMapsDumpProvider() {
164 } 164 }
165 165
166 // Called at trace dump point time. Creates a snapshot of the memory maps for 166 // Called at trace dump point time. Creates a snapshot of the memory maps for
167 // the current process. 167 // the current process.
168 bool ProcessMemoryMapsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, 168 bool ProcessMemoryMapsDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
169 ProcessMemoryDump* pmd) { 169 ProcessMemoryDump* pmd) {
170 // Snapshot of memory maps is not taken for light dump requests. 170 // Snapshot of memory maps is not taken for light dump requests.
171 if (args.level_of_detail == MemoryDumpArgs::LEVEL_OF_DETAIL_LOW) 171 if (args.level_of_detail == MemoryDumpArgs::LevelOfDetail::LOW)
172 return true; 172 return true;
173 173
174 uint32 res = 0; 174 uint32 res = 0;
175 175
176 #if defined(OS_LINUX) || defined(OS_ANDROID) 176 #if defined(OS_LINUX) || defined(OS_ANDROID)
177 if (UNLIKELY(proc_smaps_for_testing)) { 177 if (UNLIKELY(proc_smaps_for_testing)) {
178 res = ReadLinuxProcSmapsFile(proc_smaps_for_testing, pmd->process_mmaps()); 178 res = ReadLinuxProcSmapsFile(proc_smaps_for_testing, pmd->process_mmaps());
179 } else { 179 } else {
180 std::ifstream proc_self_smaps("/proc/self/smaps"); 180 std::ifstream proc_self_smaps("/proc/self/smaps");
181 res = ReadLinuxProcSmapsFile(&proc_self_smaps, pmd->process_mmaps()); 181 res = ReadLinuxProcSmapsFile(&proc_self_smaps, pmd->process_mmaps());
182 } 182 }
183 #else 183 #else
184 LOG(ERROR) << "ProcessMemoryMaps dump provider is supported only on Linux"; 184 LOG(ERROR) << "ProcessMemoryMaps dump provider is supported only on Linux";
185 #endif 185 #endif
186 186
187 if (res > 0) { 187 if (res > 0) {
188 pmd->set_has_process_mmaps(); 188 pmd->set_has_process_mmaps();
189 return true; 189 return true;
190 } 190 }
191 191
192 return false; 192 return false;
193 } 193 }
194 194
195 } // namespace trace_event 195 } // namespace trace_event
196 } // namespace base 196 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_provider.h ('k') | base/trace_event/process_memory_maps_dump_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698