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

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

Issue 23500006: URLFetcher won't call delegate until file is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke's 3rd review Created 7 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 | « net/base/file_stream_context_posix.cc ('k') | net/base/file_stream_metrics.h » ('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/file_stream_context.h" 5 #include "net/base/file_stream_context.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return IOResult::FromOSError(GetLastError()); 189 return IOResult::FromOSError(GetLastError());
190 } 190 }
191 191
192 FileStream::Context::IOResult FileStream::Context::FlushFileImpl() { 192 FileStream::Context::IOResult FileStream::Context::FlushFileImpl() {
193 if (FlushFileBuffers(file_)) 193 if (FlushFileBuffers(file_))
194 return IOResult(OK, 0); 194 return IOResult(OK, 0);
195 195
196 return IOResult::FromOSError(GetLastError()); 196 return IOResult::FromOSError(GetLastError());
197 } 197 }
198 198
199 FileStream::Context::IOResult FileStream::Context::CloseFileImpl() {
200 bool success = base::ClosePlatformFile(file_);
201 file_ = base::kInvalidPlatformFileValue;
202 if (success)
203 return IOResult(OK, 0);
204
205 return IOResult::FromOSError(GetLastError());
206 }
207
199 void FileStream::Context::IOCompletionIsPending( 208 void FileStream::Context::IOCompletionIsPending(
200 const CompletionCallback& callback, 209 const CompletionCallback& callback,
201 IOBuffer* buf) { 210 IOBuffer* buf) {
202 DCHECK(callback_.is_null()); 211 DCHECK(callback_.is_null());
203 callback_ = callback; 212 callback_ = callback;
204 in_flight_buf_ = buf; // Hold until the async operation ends. 213 in_flight_buf_ = buf; // Hold until the async operation ends.
205 async_in_progress_ = true; 214 async_in_progress_ = true;
206 } 215 }
207 216
208 void FileStream::Context::OnIOCompleted( 217 void FileStream::Context::OnIOCompleted(
(...skipping 25 matching lines...) Expand all
234 } 243 }
235 244
236 CompletionCallback temp_callback = callback_; 245 CompletionCallback temp_callback = callback_;
237 callback_.Reset(); 246 callback_.Reset();
238 scoped_refptr<IOBuffer> temp_buf = in_flight_buf_; 247 scoped_refptr<IOBuffer> temp_buf = in_flight_buf_;
239 in_flight_buf_ = NULL; 248 in_flight_buf_ = NULL;
240 temp_callback.Run(result); 249 temp_callback.Run(result);
241 } 250 }
242 251
243 } // namespace net 252 } // namespace net
OLDNEW
« no previous file with comments | « net/base/file_stream_context_posix.cc ('k') | net/base/file_stream_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698