OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_database.h" | 5 #include "content/browser/service_worker/service_worker_database.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 status = LevelDBStatusToStatus(itr->status()); | 1207 status = LevelDBStatusToStatus(itr->status()); |
1208 if (status != STATUS_OK) { | 1208 if (status != STATUS_OK) { |
1209 HandleReadResult(FROM_HERE, status); | 1209 HandleReadResult(FROM_HERE, status); |
1210 return status; | 1210 return status; |
1211 } | 1211 } |
1212 | 1212 |
1213 std::string key; | 1213 std::string key; |
1214 if (!RemovePrefix(itr->key().ToString(), kRegKeyPrefix, &key)) | 1214 if (!RemovePrefix(itr->key().ToString(), kRegKeyPrefix, &key)) |
1215 break; | 1215 break; |
1216 | 1216 |
1217 std::vector<std::string> parts; | 1217 std::vector<std::string> parts = |
1218 base::SplitStringDontTrim(key, kKeySeparator, &parts); | 1218 base::SplitString(key, std::string(1, kKeySeparator), |
| 1219 base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); |
1219 if (parts.size() != 2) { | 1220 if (parts.size() != 2) { |
1220 status = STATUS_ERROR_CORRUPTED; | 1221 status = STATUS_ERROR_CORRUPTED; |
1221 HandleReadResult(FROM_HERE, status); | 1222 HandleReadResult(FROM_HERE, status); |
1222 return status; | 1223 return status; |
1223 } | 1224 } |
1224 | 1225 |
1225 int64 registration_id; | 1226 int64 registration_id; |
1226 status = ParseId(parts[1], ®istration_id); | 1227 status = ParseId(parts[1], ®istration_id); |
1227 if (status != STATUS_OK) { | 1228 if (status != STATUS_OK) { |
1228 HandleReadResult(FROM_HERE, status); | 1229 HandleReadResult(FROM_HERE, status); |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 if (status != STATUS_OK) | 1599 if (status != STATUS_OK) |
1599 Disable(from_here, status); | 1600 Disable(from_here, status); |
1600 ServiceWorkerMetrics::CountWriteDatabaseResult(status); | 1601 ServiceWorkerMetrics::CountWriteDatabaseResult(status); |
1601 } | 1602 } |
1602 | 1603 |
1603 bool ServiceWorkerDatabase::IsDatabaseInMemory() const { | 1604 bool ServiceWorkerDatabase::IsDatabaseInMemory() const { |
1604 return path_.empty(); | 1605 return path_.empty(); |
1605 } | 1606 } |
1606 | 1607 |
1607 } // namespace content | 1608 } // namespace content |
OLD | NEW |