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

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

Issue 2203123003: [Chromecast] Remove usage of nonreentrant functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: slan@ comments Created 4 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
« no previous file with comments | « chromecast/crash/linux/crash_testing_utils.h ('k') | chromecast/crash/linux/crash_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> 7 #include <utility>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (!(contents = ParseLockFile(lockfile_path))) { 136 if (!(contents = ParseLockFile(lockfile_path))) {
137 return false; 137 return false;
138 } 138 }
139 } 139 }
140 140
141 contents->Append(dump.GetAsValue()); 141 contents->Append(dump.GetAsValue());
142 142
143 return WriteLockFile(lockfile_path, contents.get()) == 0; 143 return WriteLockFile(lockfile_path, contents.get()) == 0;
144 } 144 }
145 145
146 bool SetRatelimitPeriodStart(const std::string& metadata_path, time_t start) { 146 bool SetRatelimitPeriodStart(const std::string& metadata_path,
147 const base::Time& start) {
147 std::unique_ptr<base::Value> contents = ParseMetadataFile(metadata_path); 148 std::unique_ptr<base::Value> contents = ParseMetadataFile(metadata_path);
148 149
149 base::DictionaryValue* dict; 150 base::DictionaryValue* dict;
150 base::DictionaryValue* ratelimit_params; 151 base::DictionaryValue* ratelimit_params;
151 if (!contents || !contents->GetAsDictionary(&dict) || 152 if (!contents || !contents->GetAsDictionary(&dict) ||
152 !dict->GetDictionary(kRatelimitKey, &ratelimit_params)) { 153 !dict->GetDictionary(kRatelimitKey, &ratelimit_params)) {
153 return false; 154 return false;
154 } 155 }
155 156
156 std::string period_start_str = 157 ratelimit_params->SetDouble(kRatelimitPeriodStartKey, start.ToDoubleT());
157 base::StringPrintf("%lld", static_cast<long long>(start));
158 ratelimit_params->SetString(kRatelimitPeriodStartKey, period_start_str);
159
160 return WriteMetadataFile(metadata_path, contents.get()) == 0; 158 return WriteMetadataFile(metadata_path, contents.get()) == 0;
161 } 159 }
162 160
163 } // namespace chromecast 161 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/crash/linux/crash_testing_utils.h ('k') | chromecast/crash/linux/crash_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698