| OLD | NEW |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 version(kSettingsVersion), | 48 version(kSettingsVersion), |
| 49 options(0), | 49 options(0), |
| 50 padding_0(0), | 50 padding_0(0), |
| 51 last_upload_attempt_time(0), | 51 last_upload_attempt_time(0), |
| 52 client_id() {} | 52 client_id() {} |
| 53 | 53 |
| 54 uint32_t magic; | 54 uint32_t magic; |
| 55 uint32_t version; | 55 uint32_t version; |
| 56 uint32_t options; | 56 uint32_t options; |
| 57 uint32_t padding_0; | 57 uint32_t padding_0; |
| 58 uint64_t last_upload_attempt_time; // time_t | 58 int64_t last_upload_attempt_time; // time_t |
| 59 UUID client_id; | 59 UUID client_id; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 Settings::Settings(const base::FilePath& file_path) | 62 Settings::Settings(const base::FilePath& file_path) |
| 63 : file_path_(file_path), | 63 : file_path_(file_path), |
| 64 initialized_() { | 64 initialized_() { |
| 65 } | 65 } |
| 66 | 66 |
| 67 Settings::~Settings() { | 67 Settings::~Settings() { |
| 68 } | 68 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool Settings::SetLastUploadAttemptTime(time_t time) { | 131 bool Settings::SetLastUploadAttemptTime(time_t time) { |
| 132 DCHECK(initialized_.is_valid()); | 132 DCHECK(initialized_.is_valid()); |
| 133 | 133 |
| 134 Data settings; | 134 Data settings; |
| 135 ScopedLockedFileHandle handle = OpenForWritingAndReadSettings(&settings); | 135 ScopedLockedFileHandle handle = OpenForWritingAndReadSettings(&settings); |
| 136 if (!handle.is_valid()) | 136 if (!handle.is_valid()) |
| 137 return false; | 137 return false; |
| 138 | 138 |
| 139 settings.last_upload_attempt_time = InRangeCast<uint64_t>(time, 0); | 139 settings.last_upload_attempt_time = InRangeCast<int64_t>(time, 0); |
| 140 | 140 |
| 141 return WriteSettings(handle.get(), settings); | 141 return WriteSettings(handle.get(), settings); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // static | 144 // static |
| 145 Settings::ScopedLockedFileHandle Settings::MakeScopedLockedFileHandle( | 145 Settings::ScopedLockedFileHandle Settings::MakeScopedLockedFileHandle( |
| 146 FileHandle file, | 146 FileHandle file, |
| 147 FileLocking locking) { | 147 FileLocking locking) { |
| 148 ScopedFileHandle scoped(file); | 148 ScopedFileHandle scoped(file); |
| 149 if (scoped.is_valid()) { | 149 if (scoped.is_valid()) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 bool Settings::InitializeSettings(FileHandle handle) { | 307 bool Settings::InitializeSettings(FileHandle handle) { |
| 308 Data settings; | 308 Data settings; |
| 309 if (!settings.client_id.InitializeWithNew()) | 309 if (!settings.client_id.InitializeWithNew()) |
| 310 return false; | 310 return false; |
| 311 | 311 |
| 312 return WriteSettings(handle, settings); | 312 return WriteSettings(handle, settings); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace crashpad | 315 } // namespace crashpad |
| OLD | NEW |