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

Side by Side Diff: storage/browser/fileapi/sandbox_file_stream_writer.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/sandbox_file_stream_writer.h" 5 #include "storage/browser/fileapi/sandbox_file_stream_writer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <tuple> 10 #include <tuple>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 SandboxFileStreamWriter::~SandboxFileStreamWriter() {} 64 SandboxFileStreamWriter::~SandboxFileStreamWriter() {}
65 65
66 int SandboxFileStreamWriter::Write( 66 int SandboxFileStreamWriter::Write(
67 net::IOBuffer* buf, int buf_len, 67 net::IOBuffer* buf, int buf_len,
68 const net::CompletionCallback& callback) { 68 const net::CompletionCallback& callback) {
69 has_pending_operation_ = true; 69 has_pending_operation_ = true;
70 if (local_file_writer_) 70 if (local_file_writer_)
71 return WriteInternal(buf, buf_len, callback); 71 return WriteInternal(buf, buf_len, callback);
72 72
73 net::CompletionCallback write_task = 73 net::CompletionCallback write_task = base::Bind(
74 base::Bind(&SandboxFileStreamWriter::DidInitializeForWrite, 74 &SandboxFileStreamWriter::DidInitializeForWrite,
75 weak_factory_.GetWeakPtr(), 75 weak_factory_.GetWeakPtr(), base::RetainedRef(buf), buf_len, callback);
76 make_scoped_refptr(buf), buf_len, callback);
77 file_system_context_->operation_runner()->CreateSnapshotFile( 76 file_system_context_->operation_runner()->CreateSnapshotFile(
78 url_, base::Bind(&SandboxFileStreamWriter::DidCreateSnapshotFile, 77 url_, base::Bind(&SandboxFileStreamWriter::DidCreateSnapshotFile,
79 weak_factory_.GetWeakPtr(), write_task)); 78 weak_factory_.GetWeakPtr(), write_task));
80 return net::ERR_IO_PENDING; 79 return net::ERR_IO_PENDING;
81 } 80 }
82 81
83 int SandboxFileStreamWriter::Cancel(const net::CompletionCallback& callback) { 82 int SandboxFileStreamWriter::Cancel(const net::CompletionCallback& callback) {
84 if (!has_pending_operation_) 83 if (!has_pending_operation_)
85 return net::ERR_UNEXPECTED; 84 return net::ERR_UNEXPECTED;
86 85
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 DCHECK(cancel_callback_.is_null()); 252 DCHECK(cancel_callback_.is_null());
254 253
255 // Write() is not called yet, so there's nothing to flush. 254 // Write() is not called yet, so there's nothing to flush.
256 if (!local_file_writer_) 255 if (!local_file_writer_)
257 return net::OK; 256 return net::OK;
258 257
259 return local_file_writer_->Flush(callback); 258 return local_file_writer_->Flush(callback);
260 } 259 }
261 260
262 } // namespace storage 261 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/local_file_stream_writer.cc ('k') | storage/browser/quota/quota_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698