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

Side by Side Diff: chromecast/crash/linux/crash_testing_utils.cc

Issue 1553503002: Convert Pass()→std::move() in //chromecast (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 "chromecast/crash/linux/crash_testing_utils.h" 5 #include "chromecast/crash/linux/crash_testing_utils.h"
6 6
7 #include <utility>
8
7 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
8 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
9 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "chromecast/base/path_utils.h" 13 #include "chromecast/base/path_utils.h"
12 #include "chromecast/base/serializers.h" 14 #include "chromecast/base/serializers.h"
13 #include "chromecast/crash/linux/dump_info.h" 15 #include "chromecast/crash/linux/dump_info.h"
14 16
15 #define RCHECK(cond, retval, err) \ 17 #define RCHECK(cond, retval, err) \
16 do { \ 18 do { \
(...skipping 21 matching lines...) Expand all
38 40
39 scoped_ptr<base::ListValue> dumps = make_scoped_ptr(new base::ListValue()); 41 scoped_ptr<base::ListValue> dumps = make_scoped_ptr(new base::ListValue());
40 42
41 // Validate dumps 43 // Validate dumps
42 for (const std::string& line : lines) { 44 for (const std::string& line : lines) {
43 if (line.size() == 0) 45 if (line.size() == 0)
44 continue; 46 continue;
45 scoped_ptr<base::Value> dump_info = DeserializeFromJson(line); 47 scoped_ptr<base::Value> dump_info = DeserializeFromJson(line);
46 DumpInfo info(dump_info.get()); 48 DumpInfo info(dump_info.get());
47 RCHECK(info.valid(), nullptr, "Invalid DumpInfo"); 49 RCHECK(info.valid(), nullptr, "Invalid DumpInfo");
48 dumps->Append(dump_info.Pass()); 50 dumps->Append(std::move(dump_info));
49 } 51 }
50 52
51 return dumps; 53 return dumps;
52 } 54 }
53 55
54 scoped_ptr<base::Value> ParseMetadataFile(const std::string& path) { 56 scoped_ptr<base::Value> ParseMetadataFile(const std::string& path) {
55 return DeserializeJsonFromFile(base::FilePath(path)); 57 return DeserializeJsonFromFile(base::FilePath(path));
56 } 58 }
57 59
58 int WriteLockFile(const std::string& path, base::ListValue* contents) { 60 int WriteLockFile(const std::string& path, base::ListValue* contents) {
(...skipping 28 matching lines...) Expand all
87 ScopedVector<DumpInfo>* dumps) { 89 ScopedVector<DumpInfo>* dumps) {
88 DCHECK(dumps); 90 DCHECK(dumps);
89 scoped_ptr<base::ListValue> dump_list = ParseLockFile(lockfile_path); 91 scoped_ptr<base::ListValue> dump_list = ParseLockFile(lockfile_path);
90 RCHECK(dump_list, false, "Failed to parse lockfile"); 92 RCHECK(dump_list, false, "Failed to parse lockfile");
91 93
92 dumps->clear(); 94 dumps->clear();
93 95
94 for (base::Value* elem : *dump_list) { 96 for (base::Value* elem : *dump_list) {
95 scoped_ptr<DumpInfo> dump = make_scoped_ptr(new DumpInfo(elem)); 97 scoped_ptr<DumpInfo> dump = make_scoped_ptr(new DumpInfo(elem));
96 RCHECK(dump->valid(), false, "Invalid DumpInfo"); 98 RCHECK(dump->valid(), false, "Invalid DumpInfo");
97 dumps->push_back(dump.Pass()); 99 dumps->push_back(std::move(dump));
98 } 100 }
99 101
100 return true; 102 return true;
101 } 103 }
102 104
103 bool ClearDumps(const std::string& lockfile_path) { 105 bool ClearDumps(const std::string& lockfile_path) {
104 scoped_ptr<base::ListValue> dump_list = 106 scoped_ptr<base::ListValue> dump_list =
105 make_scoped_ptr(new base::ListValue()); 107 make_scoped_ptr(new base::ListValue());
106 return WriteLockFile(lockfile_path, dump_list.get()) == 0; 108 return WriteLockFile(lockfile_path, dump_list.get()) == 0;
107 } 109 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 151 }
150 152
151 std::string period_start_str = 153 std::string period_start_str =
152 base::StringPrintf("%lld", static_cast<long long>(start)); 154 base::StringPrintf("%lld", static_cast<long long>(start));
153 ratelimit_params->SetString(kRatelimitPeriodStartKey, period_start_str); 155 ratelimit_params->SetString(kRatelimitPeriodStartKey, period_start_str);
154 156
155 return WriteMetadataFile(metadata_path, contents.get()) == 0; 157 return WriteMetadataFile(metadata_path, contents.get()) == 0;
156 } 158 }
157 159
158 } // namespace chromecast 160 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/common/media/shared_memory_chunk.cc ('k') | chromecast/crash/linux/synchronized_minidump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698