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

Side by Side Diff: net/base/upload_data_stream.cc

Issue 9349005: 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
« no previous file with comments | « net/base/upload_data.cc ('k') | net/tools/dump_cache/dump_files.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 (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 "net/base/upload_data_stream.h" 5 #include "net/base/upload_data_stream.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "net/base/file_stream.h" 10 #include "net/base/file_stream.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return bytes_copied; 147 return bytes_copied;
148 } 148 }
149 149
150 void UploadDataStream::AdvanceToNextElement() { 150 void UploadDataStream::AdvanceToNextElement() {
151 ++element_index_; 151 ++element_index_;
152 element_offset_ = 0; 152 element_offset_ = 0;
153 element_file_bytes_remaining_ = 0; 153 element_file_bytes_remaining_ = 0;
154 if (element_file_stream_.get()) { 154 if (element_file_stream_.get()) {
155 // Temporarily allow until fix: http://crbug.com/72001. 155 // Temporarily allow until fix: http://crbug.com/72001.
156 base::ThreadRestrictions::ScopedAllowIO allow_io; 156 base::ThreadRestrictions::ScopedAllowIO allow_io;
157 element_file_stream_->Close(); 157 element_file_stream_->CloseSync();
158 element_file_stream_.reset(); 158 element_file_stream_.reset();
159 } 159 }
160 } 160 }
161 161
162 bool UploadDataStream::IsEOF() const { 162 bool UploadDataStream::IsEOF() const {
163 const std::vector<UploadData::Element>& elements = *upload_data_->elements(); 163 const std::vector<UploadData::Element>& elements = *upload_data_->elements();
164 164
165 // Check if all elements are consumed. 165 // Check if all elements are consumed.
166 if (element_index_ == elements.size()) { 166 if (element_index_ == elements.size()) {
167 // If the upload data is chunked, check if the last element is the 167 // If the upload data is chunked, check if the last element is the
168 // last chunk. 168 // last chunk.
169 if (!upload_data_->is_chunked() || 169 if (!upload_data_->is_chunked() ||
170 (!elements.empty() && elements.back().is_last_chunk())) { 170 (!elements.empty() && elements.back().is_last_chunk())) {
171 return true; 171 return true;
172 } 172 }
173 } 173 }
174 return false; 174 return false;
175 } 175 }
176 176
177 bool UploadDataStream::IsInMemory() const { 177 bool UploadDataStream::IsInMemory() const {
178 DCHECK(initialized_successfully_); 178 DCHECK(initialized_successfully_);
179 179
180 return upload_data_->IsInMemory(); 180 return upload_data_->IsInMemory();
181 } 181 }
182 182
183 } // namespace net 183 } // namespace net
OLDNEW
« no previous file with comments | « net/base/upload_data.cc ('k') | net/tools/dump_cache/dump_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698