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

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

Issue 3347005: Moving file_util::FileInfo to base::PlatformFileInfo, and adding the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 next_element_offset_ += bytes_copied; 75 next_element_offset_ += bytes_copied;
76 } 76 }
77 } else { 77 } else {
78 DCHECK(element.type() == UploadData::TYPE_FILE); 78 DCHECK(element.type() == UploadData::TYPE_FILE);
79 79
80 if (!next_element_remaining_) { 80 if (!next_element_remaining_) {
81 // If the underlying file has been changed, treat it as error. 81 // If the underlying file has been changed, treat it as error.
82 // Note that the expected modification time from WebKit is based on 82 // Note that the expected modification time from WebKit is based on
83 // time_t precision. So we have to convert both to time_t to compare. 83 // time_t precision. So we have to convert both to time_t to compare.
84 if (!element.expected_file_modification_time().is_null()) { 84 if (!element.expected_file_modification_time().is_null()) {
85 file_util::FileInfo info; 85 base::PlatformFileInfo info;
86 if (file_util::GetFileInfo(element.file_path(), &info) && 86 if (file_util::GetFileInfo(element.file_path(), &info) &&
87 element.expected_file_modification_time().ToTimeT() != 87 element.expected_file_modification_time().ToTimeT() !=
88 info.last_modified.ToTimeT()) { 88 info.last_modified.ToTimeT()) {
89 return ERR_UPLOAD_FILE_CHANGED; 89 return ERR_UPLOAD_FILE_CHANGED;
90 } 90 }
91 } 91 }
92 next_element_remaining_ = element.GetContentLength(); 92 next_element_remaining_ = element.GetContentLength();
93 next_element_stream_.reset(element.NewFileStreamForReading()); 93 next_element_stream_.reset(element.NewFileStreamForReading());
94 } 94 }
95 95
(...skipping 29 matching lines...) Expand all
125 } 125 }
126 } 126 }
127 127
128 if (next_element_ == end && !buf_len_) 128 if (next_element_ == end && !buf_len_)
129 eof_ = true; 129 eof_ = true;
130 130
131 return OK; 131 return OK;
132 } 132 }
133 133
134 } // namespace net 134 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698