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

Side by Side Diff: webkit/fileapi/file_system_url_request_job.cc

Issue 9373001: net: Rename FileStream::Open/Close with OpenSync/CloseSync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 10 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 | Annotate | Revision Log
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 "webkit/fileapi/file_system_url_request_job.h" 5 #include "webkit/fileapi/file_system_url_request_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 is_directory_(false), 118 is_directory_(false),
119 remaining_bytes_(0) { 119 remaining_bytes_(0) {
120 } 120 }
121 121
122 FileSystemURLRequestJob::~FileSystemURLRequestJob() { 122 FileSystemURLRequestJob::~FileSystemURLRequestJob() {
123 // Since we use the two-arg constructor of FileStream, we need to call Close() 123 // Since we use the two-arg constructor of FileStream, we need to call Close()
124 // manually: ~FileStream won't call it for us. 124 // manually: ~FileStream won't call it for us.
125 if (stream_ != NULL) { 125 if (stream_ != NULL) {
126 // Close() performs file IO: crbug.com/113300. 126 // Close() performs file IO: crbug.com/113300.
127 base::ThreadRestrictions::ScopedAllowIO allow_io; 127 base::ThreadRestrictions::ScopedAllowIO allow_io;
128 stream_->Close(); 128 stream_->CloseSync();
129 } 129 }
130 } 130 }
131 131
132 void FileSystemURLRequestJob::Start() { 132 void FileSystemURLRequestJob::Start() {
133 MessageLoop::current()->PostTask( 133 MessageLoop::current()->PostTask(
134 FROM_HERE, 134 FROM_HERE,
135 base::Bind(&FileSystemURLRequestJob::StartAsync, 135 base::Bind(&FileSystemURLRequestJob::StartAsync,
136 weak_factory_.GetWeakPtr())); 136 weak_factory_.GetWeakPtr()));
137 } 137 }
138 138
139 void FileSystemURLRequestJob::Kill() { 139 void FileSystemURLRequestJob::Kill() {
140 if (stream_ != NULL) { 140 if (stream_ != NULL) {
141 // Close() performs file IO: crbug.com/113300. 141 // Close() performs file IO: crbug.com/113300.
142 base::ThreadRestrictions::ScopedAllowIO allow_io; 142 base::ThreadRestrictions::ScopedAllowIO allow_io;
143 stream_->Close(); 143 stream_->CloseSync();
144 stream_.reset(NULL); 144 stream_.reset(NULL);
145 } 145 }
146 URLRequestJob::Kill(); 146 URLRequestJob::Kill();
147 weak_factory_.InvalidateWeakPtrs(); 147 weak_factory_.InvalidateWeakPtrs();
148 } 148 }
149 149
150 bool FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, 150 bool FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size,
151 int *bytes_read) { 151 int *bytes_read) {
152 DCHECK_NE(dest_size, 0); 152 DCHECK_NE(dest_size, 0);
153 DCHECK(bytes_read); 153 DCHECK(bytes_read);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 } 326 }
327 327
328 return false; 328 return false;
329 } 329 }
330 330
331 void FileSystemURLRequestJob::NotifyFailed(int rv) { 331 void FileSystemURLRequestJob::NotifyFailed(int rv) {
332 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); 332 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
333 } 333 }
334 334
335 } // namespace fileapi 335 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/blob/blob_url_request_job.cc ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698