| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/task_profiler/task_profiler_data_serializer.h" | 5 #include "chrome/browser/task_profiler/task_profiler_data_serializer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const std::string& prefix, | 45 const std::string& prefix, |
| 46 base::DictionaryValue* dictionary) { | 46 base::DictionaryValue* dictionary) { |
| 47 DCHECK(!prefix.empty()); | 47 DCHECK(!prefix.empty()); |
| 48 | 48 |
| 49 std::unique_ptr<base::DictionaryValue> location_value( | 49 std::unique_ptr<base::DictionaryValue> location_value( |
| 50 new base::DictionaryValue); | 50 new base::DictionaryValue); |
| 51 LocationSnapshotToValue(birth.location, location_value.get()); | 51 LocationSnapshotToValue(birth.location, location_value.get()); |
| 52 dictionary->Set(prefix + "_location", location_value.release()); | 52 dictionary->Set(prefix + "_location", location_value.release()); |
| 53 | 53 |
| 54 dictionary->Set(prefix + "_thread", | 54 dictionary->Set(prefix + "_thread", |
| 55 new base::StringValue(birth.sanitized_thread_name)); | 55 new base::Value(birth.sanitized_thread_name)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Re-serializes the |death_data| into |dictionary|. | 58 // Re-serializes the |death_data| into |dictionary|. |
| 59 void DeathDataSnapshotToValue(const DeathDataSnapshot& death_data, | 59 void DeathDataSnapshotToValue(const DeathDataSnapshot& death_data, |
| 60 base::DictionaryValue* dictionary) { | 60 base::DictionaryValue* dictionary) { |
| 61 dictionary->SetInteger("count", death_data.count); | 61 dictionary->SetInteger("count", death_data.count); |
| 62 dictionary->SetInteger("run_ms", death_data.run_duration_sum); | 62 dictionary->SetInteger("run_ms", death_data.run_duration_sum); |
| 63 dictionary->SetInteger("run_ms_max", death_data.run_duration_max); | 63 dictionary->SetInteger("run_ms_max", death_data.run_duration_max); |
| 64 dictionary->SetInteger("run_ms_sample", death_data.run_duration_sample); | 64 dictionary->SetInteger("run_ms_sample", death_data.run_duration_sample); |
| 65 dictionary->SetInteger("queue_ms", death_data.queue_duration_sum); | 65 dictionary->SetInteger("queue_ms", death_data.queue_duration_sum); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 tasks_list->Append(std::move(snapshot)); | 139 tasks_list->Append(std::move(snapshot)); |
| 140 } | 140 } |
| 141 dictionary->Set("list", tasks_list.release()); | 141 dictionary->Set("list", tasks_list.release()); |
| 142 | 142 |
| 143 dictionary->SetInteger("process_id", process_id); | 143 dictionary->SetInteger("process_id", process_id); |
| 144 dictionary->SetString("process_type", content::GetProcessTypeNameInEnglish( | 144 dictionary->SetString("process_type", content::GetProcessTypeNameInEnglish( |
| 145 AsChromeProcessType(process_type))); | 145 AsChromeProcessType(process_type))); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace task_profiler | 148 } // namespace task_profiler |
| OLD | NEW |