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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void ReadMetadata(disk_cache::Entry* entry, const MetadataCallback& callback) { | 132 void ReadMetadata(disk_cache::Entry* entry, const MetadataCallback& callback) { |
133 DCHECK(entry); | 133 DCHECK(entry); |
134 | 134 |
135 scoped_refptr<net::IOBufferWithSize> buffer( | 135 scoped_refptr<net::IOBufferWithSize> buffer( |
136 new net::IOBufferWithSize(entry->GetDataSize(INDEX_HEADERS))); | 136 new net::IOBufferWithSize(entry->GetDataSize(INDEX_HEADERS))); |
137 | 137 |
138 net::CompletionCallback read_header_callback = | 138 net::CompletionCallback read_header_callback = |
139 base::Bind(ReadMetadataDidReadMetadata, entry, callback, buffer); | 139 base::Bind(ReadMetadataDidReadMetadata, entry, callback, buffer); |
140 | 140 |
141 int read_rv = entry->ReadData( | 141 int read_rv = entry->ReadData(INDEX_HEADERS, 0, buffer.get(), buffer->size(), |
142 INDEX_HEADERS, 0, buffer.get(), buffer->size(), | 142 read_header_callback); |
143 tracked_objects::ScopedTracker::TrackCallback( | |
144 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 ReadMetadata"), | |
145 read_header_callback)); | |
146 | 143 |
147 if (read_rv != net::ERR_IO_PENDING) | 144 if (read_rv != net::ERR_IO_PENDING) |
148 read_header_callback.Run(read_rv); | 145 read_header_callback.Run(read_rv); |
149 } | 146 } |
150 | 147 |
151 void ReadMetadataDidReadMetadata( | 148 void ReadMetadataDidReadMetadata( |
152 disk_cache::Entry* entry, | 149 disk_cache::Entry* entry, |
153 const MetadataCallback& callback, | 150 const MetadataCallback& callback, |
154 const scoped_refptr<net::IOBufferWithSize>& buffer, | 151 const scoped_refptr<net::IOBufferWithSize>& buffer, |
155 int rv) { | 152 int rv) { |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 tmp_entry_ptr->ReadData(INDEX_RESPONSE_BODY, 0, response_body_buffer, | 707 tmp_entry_ptr->ReadData(INDEX_RESPONSE_BODY, 0, response_body_buffer, |
711 response_body_buffer->size(), read_callback); | 708 response_body_buffer->size(), read_callback); |
712 | 709 |
713 if (read_rv != net::ERR_IO_PENDING) | 710 if (read_rv != net::ERR_IO_PENDING) |
714 read_callback.Run(read_rv); | 711 read_callback.Run(read_rv); |
715 } | 712 } |
716 | 713 |
717 void CacheStorageCache::MatchDidReadResponseBodyData( | 714 void CacheStorageCache::MatchDidReadResponseBodyData( |
718 scoped_ptr<MatchContext> match_context, | 715 scoped_ptr<MatchContext> match_context, |
719 int rv) { | 716 int rv) { |
720 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | |
721 tracked_objects::ScopedTracker tracking_profile( | |
722 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
723 "422516 CacheStorageCache::MatchDidReadResponseBodyData")); | |
724 | |
725 if (rv < 0) { | 717 if (rv < 0) { |
726 match_context->original_callback.Run(CacheStorageCache::ERROR_TYPE_STORAGE, | 718 match_context->original_callback.Run(CacheStorageCache::ERROR_TYPE_STORAGE, |
727 scoped_ptr<ServiceWorkerResponse>(), | 719 scoped_ptr<ServiceWorkerResponse>(), |
728 scoped_ptr<storage::BlobDataHandle>()); | 720 scoped_ptr<storage::BlobDataHandle>()); |
729 return; | 721 return; |
730 } | 722 } |
731 | 723 |
732 if (rv == 0) { | 724 if (rv == 0) { |
733 match_context->response->blob_uuid = match_context->blob_data->uuid(); | 725 match_context->response->blob_uuid = match_context->blob_data->uuid(); |
734 match_context->response->blob_size = match_context->total_bytes_read; | 726 match_context->response->blob_size = match_context->total_bytes_read; |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 ErrorType error, | 1230 ErrorType error, |
1239 scoped_ptr<Requests> requests) { | 1231 scoped_ptr<Requests> requests) { |
1240 base::WeakPtr<CacheStorageCache> cache = weak_ptr_factory_.GetWeakPtr(); | 1232 base::WeakPtr<CacheStorageCache> cache = weak_ptr_factory_.GetWeakPtr(); |
1241 | 1233 |
1242 callback.Run(error, requests.Pass()); | 1234 callback.Run(error, requests.Pass()); |
1243 if (cache) | 1235 if (cache) |
1244 scheduler_->CompleteOperationAndRunNext(); | 1236 scheduler_->CompleteOperationAndRunNext(); |
1245 } | 1237 } |
1246 | 1238 |
1247 } // namespace content | 1239 } // namespace content |
OLD | NEW |