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

Side by Side Diff: client/settings.cc

Issue 1001713002: Use new ScopedGeneric move support. (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 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 | « no previous file | util/mach/child_port_handshake.cc » ('j') | util/mach/child_port_handshake.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 PLOG(ERROR) << "ftruncate settings file"; 209 PLOG(ERROR) << "ftruncate settings file";
210 return false; 210 return false;
211 } 211 }
212 212
213 return LoggingWriteFile(handle, &data, sizeof(Data)); 213 return LoggingWriteFile(handle, &data, sizeof(Data));
214 } 214 }
215 215
216 bool Settings::RecoverSettings(FileHandle handle, Data* out_data) { 216 bool Settings::RecoverSettings(FileHandle handle, Data* out_data) {
217 ScopedFileHandle scoped_handle; 217 ScopedFileHandle scoped_handle;
218 if (handle == kInvalidFileHandle) { 218 if (handle == kInvalidFileHandle) {
219 scoped_handle.reset(OpenForReadingAndWriting().release()); 219 scoped_handle = OpenForReadingAndWriting();
220 handle = scoped_handle.get(); 220 handle = scoped_handle.get();
221 221
222 // Test if the file has already been recovered now that the exclusive lock 222 // Test if the file has already been recovered now that the exclusive lock
223 // is held. 223 // is held.
224 if (ReadSettings(handle, out_data)) 224 if (ReadSettings(handle, out_data))
225 return true; 225 return true;
226 } 226 }
227 227
228 LOG(INFO) << "Recovering settings file " << file_path().value(); 228 LOG(INFO) << "Recovering settings file " << file_path().value();
229 229
(...skipping 12 matching lines...) Expand all
242 uuid_t uuid; 242 uuid_t uuid;
243 uuid_generate(uuid); 243 uuid_generate(uuid);
244 244
245 Data settings; 245 Data settings;
246 settings.client_id.InitializeFromBytes(uuid); 246 settings.client_id.InitializeFromBytes(uuid);
247 247
248 return WriteSettings(handle, settings); 248 return WriteSettings(handle, settings);
249 } 249 }
250 250
251 } // namespace crashpad 251 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | util/mach/child_port_handshake.cc » ('j') | util/mach/child_port_handshake.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698