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/cache_storage/cache_storage_cache.h" | 5 #include "content/browser/cache_storage/cache_storage_cache.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 DCHECK_EQ(std::string::npos, header.value().find('\0')); | 1396 DCHECK_EQ(std::string::npos, header.value().find('\0')); |
1397 request->headers.insert(std::make_pair(header.name(), header.value())); | 1397 request->headers.insert(std::make_pair(header.name(), header.value())); |
1398 } | 1398 } |
1399 } | 1399 } |
1400 | 1400 |
1401 void CacheStorageCache::PopulateResponseMetadata( | 1401 void CacheStorageCache::PopulateResponseMetadata( |
1402 const proto::CacheMetadata& metadata, | 1402 const proto::CacheMetadata& metadata, |
1403 ServiceWorkerResponse* response) { | 1403 ServiceWorkerResponse* response) { |
1404 std::unique_ptr<std::vector<GURL>> url_list = | 1404 std::unique_ptr<std::vector<GURL>> url_list = |
1405 base::MakeUnique<std::vector<GURL>>(); | 1405 base::MakeUnique<std::vector<GURL>>(); |
1406 // TODO(horo) Add UMA for the deprecated URL field. | 1406 // From Chrome 57, proto::CacheMetadata's url field was deprecated. |
| 1407 UMA_HISTOGRAM_BOOLEAN("ServiceWorkerCache.Response.HasDeprecatedURL", |
| 1408 metadata.response().has_url()); |
1407 if (metadata.response().has_url()) { | 1409 if (metadata.response().has_url()) { |
1408 url_list->push_back(GURL(metadata.response().url())); | 1410 url_list->push_back(GURL(metadata.response().url())); |
1409 } else { | 1411 } else { |
1410 url_list->reserve(metadata.response().url_list_size()); | 1412 url_list->reserve(metadata.response().url_list_size()); |
1411 for (int i = 0; i < metadata.response().url_list_size(); ++i) | 1413 for (int i = 0; i < metadata.response().url_list_size(); ++i) |
1412 url_list->push_back(GURL(metadata.response().url_list(i))); | 1414 url_list->push_back(GURL(metadata.response().url_list(i))); |
1413 } | 1415 } |
1414 | 1416 |
1415 std::unique_ptr<ServiceWorkerHeaderMap> headers = | 1417 std::unique_ptr<ServiceWorkerHeaderMap> headers = |
1416 base::MakeUnique<ServiceWorkerHeaderMap>(); | 1418 base::MakeUnique<ServiceWorkerHeaderMap>(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); | 1452 temp_entry, INDEX_RESPONSE_BODY, INDEX_SIDE_DATA); |
1451 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1453 return blob_storage_context_->AddFinishedBlob(&blob_data); |
1452 } | 1454 } |
1453 | 1455 |
1454 std::unique_ptr<CacheStorageCacheHandle> | 1456 std::unique_ptr<CacheStorageCacheHandle> |
1455 CacheStorageCache::CreateCacheHandle() { | 1457 CacheStorageCache::CreateCacheHandle() { |
1456 return cache_storage_->CreateCacheHandle(this); | 1458 return cache_storage_->CreateCacheHandle(this); |
1457 } | 1459 } |
1458 | 1460 |
1459 } // namespace content | 1461 } // namespace content |
OLD | NEW |