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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ServiceWorkerEnv() | 115 ServiceWorkerEnv() |
116 : ChromiumEnv("LevelDBEnv.ServiceWorker", false /* make_backup */) {} | 116 : ChromiumEnv("LevelDBEnv.ServiceWorker", false /* make_backup */) {} |
117 }; | 117 }; |
118 | 118 |
119 base::LazyInstance<ServiceWorkerEnv>::Leaky g_service_worker_env = | 119 base::LazyInstance<ServiceWorkerEnv>::Leaky g_service_worker_env = |
120 LAZY_INSTANCE_INITIALIZER; | 120 LAZY_INSTANCE_INITIALIZER; |
121 | 121 |
122 bool RemovePrefix(const std::string& str, | 122 bool RemovePrefix(const std::string& str, |
123 const std::string& prefix, | 123 const std::string& prefix, |
124 std::string* out) { | 124 std::string* out) { |
125 if (!base::StartsWithASCII(str, prefix, true)) | 125 if (!base::StartsWith(str, prefix, base::CompareCase::SENSITIVE)) |
126 return false; | 126 return false; |
127 if (out) | 127 if (out) |
128 *out = str.substr(prefix.size()); | 128 *out = str.substr(prefix.size()); |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
132 std::string CreateRegistrationKeyPrefix(const GURL& origin) { | 132 std::string CreateRegistrationKeyPrefix(const GURL& origin) { |
133 return base::StringPrintf("%s%s%c", kRegKeyPrefix, | 133 return base::StringPrintf("%s%s%c", kRegKeyPrefix, |
134 origin.GetOrigin().spec().c_str(), kKeySeparator); | 134 origin.GetOrigin().spec().c_str(), kKeySeparator); |
135 } | 135 } |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 if (status != STATUS_OK) | 1598 if (status != STATUS_OK) |
1599 Disable(from_here, status); | 1599 Disable(from_here, status); |
1600 ServiceWorkerMetrics::CountWriteDatabaseResult(status); | 1600 ServiceWorkerMetrics::CountWriteDatabaseResult(status); |
1601 } | 1601 } |
1602 | 1602 |
1603 bool ServiceWorkerDatabase::IsDatabaseInMemory() const { | 1603 bool ServiceWorkerDatabase::IsDatabaseInMemory() const { |
1604 return path_.empty(); | 1604 return path_.empty(); |
1605 } | 1605 } |
1606 | 1606 |
1607 } // namespace content | 1607 } // namespace content |
OLD | NEW |