Chromium Code Reviews| Index: base/process/process_metrics_linux.cc |
| diff --git a/base/process/process_metrics_linux.cc b/base/process/process_metrics_linux.cc |
| index 3d27656d6acccaea911a1a0a8f7294c76f720c79..2bf6fcc9780b3acf2aea328b639e76bdd107b044 100644 |
| --- a/base/process/process_metrics_linux.cc |
| +++ b/base/process/process_metrics_linux.cc |
| @@ -17,6 +17,7 @@ |
| #include "base/files/dir_reader_posix.h" |
| #include "base/files/file_util.h" |
| #include "base/logging.h" |
| +#include "base/memory/ptr_util.h" |
| #include "base/process/internal_linux.h" |
| #include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_split.h" |
| @@ -72,8 +73,8 @@ size_t ReadProcStatusAndGetFieldAsSizeT(pid_t pid, const std::string& field) { |
| const std::string& key = pairs[i].first; |
| const std::string& value_str = pairs[i].second; |
| if (key == field) { |
| - std::vector<StringPiece> split_value_str = SplitStringPiece( |
| - value_str, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| + std::vector<StringPiece> split_value_str = |
| + SplitStringPiece(value_str, " ", TRIM_WHITESPACE, SPLIT_WANT_ALL); |
| if (split_value_str.size() != 2 || split_value_str[1] != "kB") { |
| NOTREACHED(); |
| return 0; |
| @@ -163,8 +164,9 @@ int GetProcessCPU(pid_t pid) { |
| } // namespace |
| // static |
| -ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) { |
| - return new ProcessMetrics(process); |
| +std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics( |
| + ProcessHandle process) { |
| + return WrapUnique(new ProcessMetrics(process)); |
|
Lei Zhang
2016/07/25 17:28:20
dcheng: Any suggestions on how to better handle pr
|
| } |
| // On linux, we return vsize. |
| @@ -354,8 +356,7 @@ bool ProcessMetrics::GetWorkingSetKBytesTotmaps(WorkingSetKBytes *ws_usage) |
| } |
| std::vector<std::string> totmaps_fields = SplitString( |
| - totmaps_data, base::kWhitespaceASCII, base::KEEP_WHITESPACE, |
| - base::SPLIT_WANT_NONEMPTY); |
| + totmaps_data, kWhitespaceASCII, KEEP_WHITESPACE, SPLIT_WANT_NONEMPTY); |
| DCHECK_EQ("Pss:", totmaps_fields[kPssIndex-1]); |
| DCHECK_EQ("Private_Clean:", totmaps_fields[kPrivate_CleanIndex - 1]); |
| @@ -406,8 +407,8 @@ bool ProcessMetrics::GetWorkingSetKBytesStatm(WorkingSetKBytes* ws_usage) |
| return false; |
| } |
| - std::vector<StringPiece> statm_vec = SplitStringPiece( |
| - statm, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| + std::vector<StringPiece> statm_vec = |
| + SplitStringPiece(statm, " ", TRIM_WHITESPACE, SPLIT_WANT_ALL); |
| if (statm_vec.size() != 7) |
| return false; // Not the format we expect. |