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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 10 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 int* num_resources) { | 235 int* num_resources) { |
236 *num_resources = -1; | 236 *num_resources = -1; |
237 | 237 |
238 std::vector<ServiceWorkerRegistrationInfo> infos = | 238 std::vector<ServiceWorkerRegistrationInfo> infos = |
239 wrapper->context()->GetAllLiveRegistrationInfo(); | 239 wrapper->context()->GetAllLiveRegistrationInfo(); |
240 if (infos.empty()) | 240 if (infos.empty()) |
241 return; | 241 return; |
242 | 242 |
243 int version_id; | 243 int version_id; |
244 size_t index = infos.size() - 1; | 244 size_t index = infos.size() - 1; |
245 if (!infos[index].installing_version.is_null) | 245 if (infos[index].installing_version.version_id != |
| 246 kInvalidServiceWorkerVersionId) |
246 version_id = infos[index].installing_version.version_id; | 247 version_id = infos[index].installing_version.version_id; |
247 else if (!infos[index].waiting_version.is_null) | 248 else if (infos[index].waiting_version.version_id != |
| 249 kInvalidServiceWorkerVersionId) |
248 version_id = infos[1].waiting_version.version_id; | 250 version_id = infos[1].waiting_version.version_id; |
249 else if (!infos[index].active_version.is_null) | 251 else if (infos[index].active_version.version_id != |
| 252 kInvalidServiceWorkerVersionId) |
250 version_id = infos[index].active_version.version_id; | 253 version_id = infos[index].active_version.version_id; |
251 else | 254 else |
252 return; | 255 return; |
253 | 256 |
254 ServiceWorkerVersion* version = | 257 ServiceWorkerVersion* version = |
255 wrapper->context()->GetLiveVersion(version_id); | 258 wrapper->context()->GetLiveVersion(version_id); |
256 *num_resources = static_cast<int>(version->script_cache_map()->size()); | 259 *num_resources = static_cast<int>(version->script_cache_map()->size()); |
257 } | 260 } |
258 | 261 |
259 } // namespace | 262 } // namespace |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 RunOnIOThread( | 941 RunOnIOThread( |
939 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, | 942 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, |
940 this, | 943 this, |
941 embedded_test_server()->GetURL("/service_worker/empty.html"), | 944 embedded_test_server()->GetURL("/service_worker/empty.html"), |
942 &status)); | 945 &status)); |
943 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); | 946 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); |
944 } | 947 } |
945 } | 948 } |
946 | 949 |
947 } // namespace content | 950 } // namespace content |
OLD | NEW |