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

Side by Side Diff: chrome/browser/task_profiler/task_profiler_data_serializer.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
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 9
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
11 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "base/tracked_objects.h" 14 #include "base/tracked_objects.h"
14 #include "chrome/common/chrome_content_client.h" 15 #include "chrome/common/chrome_content_client.h"
15 #include "components/nacl/common/nacl_process_type.h" 16 #include "components/nacl/common/nacl_process_type.h"
16 #include "content/public/common/process_type.h" 17 #include "content/public/common/process_type.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // static 120 // static
120 void TaskProfilerDataSerializer::ToValue( 121 void TaskProfilerDataSerializer::ToValue(
121 const ProcessDataPhaseSnapshot& process_data_phase, 122 const ProcessDataPhaseSnapshot& process_data_phase,
122 base::ProcessId process_id, 123 base::ProcessId process_id,
123 metrics::ProfilerEventProto::TrackedObject::ProcessType process_type, 124 metrics::ProfilerEventProto::TrackedObject::ProcessType process_type,
124 base::DictionaryValue* dictionary) { 125 base::DictionaryValue* dictionary) {
125 std::unique_ptr<base::ListValue> tasks_list(new base::ListValue); 126 std::unique_ptr<base::ListValue> tasks_list(new base::ListValue);
126 for (const auto& task : process_data_phase.tasks) { 127 for (const auto& task : process_data_phase.tasks) {
127 std::unique_ptr<base::DictionaryValue> snapshot(new base::DictionaryValue); 128 std::unique_ptr<base::DictionaryValue> snapshot(new base::DictionaryValue);
128 TaskSnapshotToValue(task, snapshot.get()); 129 TaskSnapshotToValue(task, snapshot.get());
129 tasks_list->Append(snapshot.release()); 130 tasks_list->Append(std::move(snapshot));
130 } 131 }
131 dictionary->Set("list", tasks_list.release()); 132 dictionary->Set("list", tasks_list.release());
132 133
133 dictionary->SetInteger("process_id", process_id); 134 dictionary->SetInteger("process_id", process_id);
134 dictionary->SetString("process_type", content::GetProcessTypeNameInEnglish( 135 dictionary->SetString("process_type", content::GetProcessTypeNameInEnglish(
135 AsChromeProcessType(process_type))); 136 AsChromeProcessType(process_type)));
136 } 137 }
137 138
138 } // namespace task_profiler 139 } // namespace task_profiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698