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

Side by Side Diff: storage/browser/fileapi/local_file_stream_reader.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "storage/browser/fileapi/local_file_stream_reader.h" 5 #include "storage/browser/fileapi/local_file_stream_reader.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/file_util_proxy.h" 10 #include "base/files/file_util_proxy.h"
(...skipping 25 matching lines...) Expand all
36 36
37 LocalFileStreamReader::~LocalFileStreamReader() { 37 LocalFileStreamReader::~LocalFileStreamReader() {
38 } 38 }
39 39
40 int LocalFileStreamReader::Read(net::IOBuffer* buf, int buf_len, 40 int LocalFileStreamReader::Read(net::IOBuffer* buf, int buf_len,
41 const net::CompletionCallback& callback) { 41 const net::CompletionCallback& callback) {
42 DCHECK(!has_pending_open_); 42 DCHECK(!has_pending_open_);
43 if (stream_impl_) 43 if (stream_impl_)
44 return stream_impl_->Read(buf, buf_len, callback); 44 return stream_impl_->Read(buf, buf_len, callback);
45 return Open(base::Bind(&LocalFileStreamReader::DidOpenForRead, 45 return Open(base::Bind(&LocalFileStreamReader::DidOpenForRead,
46 weak_factory_.GetWeakPtr(), 46 weak_factory_.GetWeakPtr(), base::RetainedRef(buf),
47 make_scoped_refptr(buf), buf_len, callback)); 47 buf_len, callback));
48 } 48 }
49 49
50 int64_t LocalFileStreamReader::GetLength( 50 int64_t LocalFileStreamReader::GetLength(
51 const net::Int64CompletionCallback& callback) { 51 const net::Int64CompletionCallback& callback) {
52 const bool posted = base::FileUtilProxy::GetFileInfo( 52 const bool posted = base::FileUtilProxy::GetFileInfo(
53 task_runner_.get(), 53 task_runner_.get(),
54 file_path_, 54 file_path_,
55 base::Bind(&LocalFileStreamReader::DidGetFileInfoForGetLength, 55 base::Bind(&LocalFileStreamReader::DidGetFileInfoForGetLength,
56 weak_factory_.GetWeakPtr(), 56 weak_factory_.GetWeakPtr(),
57 callback)); 57 callback));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return; 160 return;
161 } 161 }
162 if (!VerifySnapshotTime(expected_modification_time_, file_info)) { 162 if (!VerifySnapshotTime(expected_modification_time_, file_info)) {
163 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); 163 callback.Run(net::ERR_UPLOAD_FILE_CHANGED);
164 return; 164 return;
165 } 165 }
166 callback.Run(file_info.size); 166 callback.Run(file_info.size);
167 } 167 }
168 168
169 } // namespace storage 169 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/file_system_quota_client.cc ('k') | storage/browser/fileapi/local_file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698