Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: content/browser/service_worker/service_worker_cache.cc

Issue 506093002: Remove implicit conversions from scoped_refptr to T* in content/*/service_worker/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_job_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_cache.h" 5 #include "content/browser/service_worker/service_worker_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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return; 124 return;
125 } 125 }
126 126
127 net::CompletionCallback cache_write_callback = 127 net::CompletionCallback cache_write_callback =
128 base::Bind(&BlobReader::DidWriteDataToEntry, 128 base::Bind(&BlobReader::DidWriteDataToEntry,
129 weak_ptr_factory_.GetWeakPtr(), 129 weak_ptr_factory_.GetWeakPtr(),
130 bytes_read); 130 bytes_read);
131 131
132 int rv = entry_->WriteData(INDEX_RESPONSE_BODY, 132 int rv = entry_->WriteData(INDEX_RESPONSE_BODY,
133 cache_entry_offset_, 133 cache_entry_offset_,
134 buffer_, 134 buffer_.get(),
135 bytes_read, 135 bytes_read,
136 cache_write_callback, 136 cache_write_callback,
137 true /* truncate */); 137 true /* truncate */);
138 if (rv != net::ERR_IO_PENDING) 138 if (rv != net::ERR_IO_PENDING)
139 cache_write_callback.Run(rv); 139 cache_write_callback.Run(rv);
140 } 140 }
141 141
142 void DidWriteDataToEntry(int expected_bytes, int rv) { 142 void DidWriteDataToEntry(int expected_bytes, int rv) {
143 if (rv != expected_bytes) { 143 if (rv != expected_bytes) {
144 callback_.Run(entry_.Pass(), false); 144 callback_.Run(entry_.Pass(), false);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 base::Bind(PutDidWriteHeaders, 273 base::Bind(PutDidWriteHeaders,
274 response, 274 response,
275 callback, 275 callback,
276 base::Passed(entry.Pass()), 276 base::Passed(entry.Pass()),
277 base::Passed(blob_data_handle.Pass()), 277 base::Passed(blob_data_handle.Pass()),
278 request_context, 278 request_context,
279 buffer->size()); 279 buffer->size());
280 280
281 rv = tmp_entry_ptr->WriteData(INDEX_HEADERS, 281 rv = tmp_entry_ptr->WriteData(INDEX_HEADERS,
282 0 /* offset */, 282 0 /* offset */,
283 buffer, 283 buffer.get(),
284 buffer->size(), 284 buffer->size(),
285 write_headers_callback, 285 write_headers_callback,
286 true /* truncate */); 286 true /* truncate */);
287 287
288 if (rv != net::ERR_IO_PENDING) 288 if (rv != net::ERR_IO_PENDING)
289 write_headers_callback.Run(rv); 289 write_headers_callback.Run(rv);
290 } 290 }
291 291
292 void PutDidWriteHeaders(ServiceWorkerResponse* response, 292 void PutDidWriteHeaders(ServiceWorkerResponse* response,
293 const ServiceWorkerCache::ErrorCallback& callback, 293 const ServiceWorkerCache::ErrorCallback& callback,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 } 484 }
485 485
486 // TODO(jkarlin): This copying of the the entire cache response into memory is 486 // TODO(jkarlin): This copying of the the entire cache response into memory is
487 // awful. Create a new interface around SimpleCache that provides access the 487 // awful. Create a new interface around SimpleCache that provides access the
488 // data directly from the file. See bug http://crbug.com/403493. 488 // data directly from the file. See bug http://crbug.com/403493.
489 response_context->blob_data->AppendData(response_context->buffer->data(), rv); 489 response_context->blob_data->AppendData(response_context->buffer->data(), rv);
490 response_context->total_bytes_read += rv; 490 response_context->total_bytes_read += rv;
491 int total_bytes_read = response_context->total_bytes_read; 491 int total_bytes_read = response_context->total_bytes_read;
492 492
493 // Grab some pointers before passing them in bind. 493 // Grab some pointers before passing them in bind.
494 net::IOBufferWithSize* buffer = response_context->buffer; 494 net::IOBufferWithSize* buffer = response_context->buffer.get();
dcheng 2014/08/26 17:10:57 Note: the tool believes this to be safe because it
495 disk_cache::Entry* tmp_entry_ptr = entry.get(); 495 disk_cache::Entry* tmp_entry_ptr = entry.get();
496 496
497 net::CompletionCallback read_callback = 497 net::CompletionCallback read_callback =
498 base::Bind(MatchDidReadResponseBodyData, 498 base::Bind(MatchDidReadResponseBodyData,
499 request, 499 request,
500 callback, 500 callback,
501 blob_storage, 501 blob_storage,
502 base::Passed(entry.Pass()), 502 base::Passed(entry.Pass()),
503 base::Passed(response.Pass()), 503 base::Passed(response.Pass()),
504 base::Passed(response_context.Pass())); 504 base::Passed(response_context.Pass()));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 const base::FilePath& path, 709 const base::FilePath& path,
710 net::URLRequestContext* request_context, 710 net::URLRequestContext* request_context,
711 base::WeakPtr<storage::BlobStorageContext> blob_context) 711 base::WeakPtr<storage::BlobStorageContext> blob_context)
712 : path_(path), 712 : path_(path),
713 request_context_(request_context), 713 request_context_(request_context),
714 blob_storage_context_(blob_context), 714 blob_storage_context_(blob_context),
715 weak_ptr_factory_(this) { 715 weak_ptr_factory_(this) {
716 } 716 }
717 717
718 } // namespace content 718 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698