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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/guid.h" | 11 #include "base/guid.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "content/browser/cache_storage/cache_storage.pb.h" | 15 #include "content/browser/cache_storage/cache_storage.pb.h" |
16 #include "content/browser/cache_storage/cache_storage_blob_to_disk_cache.h" | 16 #include "content/browser/cache_storage/cache_storage_blob_to_disk_cache.h" |
17 #include "content/browser/cache_storage/cache_storage_scheduler.h" | 17 #include "content/browser/cache_storage/cache_storage_scheduler.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/common/referrer.h" | 19 #include "content/public/common/referrer.h" |
20 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
21 #include "net/base/io_buffer.h" | 21 #include "net/base/io_buffer.h" |
22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
23 #include "net/disk_cache/disk_cache.h" | 23 #include "net/disk_cache/disk_cache.h" |
24 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
25 #include "storage/browser/blob/blob_data_builder.h" | 25 #include "storage/browser/blob/blob_data_builder.h" |
26 #include "storage/browser/blob/blob_data_handle.h" | 26 #include "storage/browser/blob/blob_data_handle.h" |
27 #include "storage/browser/blob/blob_storage_context.h" | 27 #include "storage/browser/blob/blob_storage_context.h" |
28 #include "storage/browser/blob/blob_url_request_job_factory.h" | 28 #include "storage/browser/blob/blob_url_request_job_factory.h" |
29 #include "storage/browser/quota/quota_manager_proxy.h" | 29 #include "storage/browser/quota/quota_manager_proxy.h" |
30 #include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h" | 30 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseType.h" |
31 | 31 |
32 namespace content { | 32 namespace content { |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 // This class ensures that the cache and the entry have a lifetime as long as | 36 // This class ensures that the cache and the entry have a lifetime as long as |
37 // the blob that is created to contain them. | 37 // the blob that is created to contain them. |
38 class CacheStorageCacheDataHandle | 38 class CacheStorageCacheDataHandle |
39 : public storage::BlobDataBuilder::DataHandle { | 39 : public storage::BlobDataBuilder::DataHandle { |
40 public: | 40 public: |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 storage::BlobDataBuilder blob_data(response->blob_uuid); | 1246 storage::BlobDataBuilder blob_data(response->blob_uuid); |
1247 | 1247 |
1248 disk_cache::Entry* temp_entry = entry.get(); | 1248 disk_cache::Entry* temp_entry = entry.get(); |
1249 blob_data.AppendDiskCacheEntry( | 1249 blob_data.AppendDiskCacheEntry( |
1250 new CacheStorageCacheDataHandle(this, entry.Pass()), temp_entry, | 1250 new CacheStorageCacheDataHandle(this, entry.Pass()), temp_entry, |
1251 INDEX_RESPONSE_BODY); | 1251 INDEX_RESPONSE_BODY); |
1252 return blob_storage_context_->AddFinishedBlob(&blob_data); | 1252 return blob_storage_context_->AddFinishedBlob(&blob_data); |
1253 } | 1253 } |
1254 | 1254 |
1255 } // namespace content | 1255 } // namespace content |
OLD | NEW |