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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 ServiceWorkerEnv() | 100 ServiceWorkerEnv() |
101 : ChromiumEnv("LevelDBEnv.ServiceWorker", false /* make_backup */) {} | 101 : ChromiumEnv("LevelDBEnv.ServiceWorker", false /* make_backup */) {} |
102 }; | 102 }; |
103 | 103 |
104 base::LazyInstance<ServiceWorkerEnv>::Leaky g_service_worker_env = | 104 base::LazyInstance<ServiceWorkerEnv>::Leaky g_service_worker_env = |
105 LAZY_INSTANCE_INITIALIZER; | 105 LAZY_INSTANCE_INITIALIZER; |
106 | 106 |
107 bool RemovePrefix(const std::string& str, | 107 bool RemovePrefix(const std::string& str, |
108 const std::string& prefix, | 108 const std::string& prefix, |
109 std::string* out) { | 109 std::string* out) { |
110 if (!StartsWithASCII(str, prefix, true)) | 110 if (!base::StartsWithASCII(str, prefix, true)) |
111 return false; | 111 return false; |
112 if (out) | 112 if (out) |
113 *out = str.substr(prefix.size()); | 113 *out = str.substr(prefix.size()); |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 std::string CreateRegistrationKeyPrefix(const GURL& origin) { | 117 std::string CreateRegistrationKeyPrefix(const GURL& origin) { |
118 return base::StringPrintf("%s%s%c", kRegKeyPrefix, | 118 return base::StringPrintf("%s%s%c", kRegKeyPrefix, |
119 origin.GetOrigin().spec().c_str(), kKeySeparator); | 119 origin.GetOrigin().spec().c_str(), kKeySeparator); |
120 } | 120 } |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 | 1497 |
1498 void ServiceWorkerDatabase::HandleWriteResult( | 1498 void ServiceWorkerDatabase::HandleWriteResult( |
1499 const tracked_objects::Location& from_here, | 1499 const tracked_objects::Location& from_here, |
1500 Status status) { | 1500 Status status) { |
1501 if (status != STATUS_OK) | 1501 if (status != STATUS_OK) |
1502 Disable(from_here, status); | 1502 Disable(from_here, status); |
1503 ServiceWorkerMetrics::CountWriteDatabaseResult(status); | 1503 ServiceWorkerMetrics::CountWriteDatabaseResult(status); |
1504 } | 1504 } |
1505 | 1505 |
1506 } // namespace content | 1506 } // namespace content |
OLD | NEW |