OLD | NEW |
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.h" | 5 #include "net/base/upload_data.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 FileStream* file = file_stream_; | 94 FileStream* file = file_stream_; |
95 file_stream_ = NULL; | 95 file_stream_ = NULL; |
96 return file; | 96 return file; |
97 } | 97 } |
98 | 98 |
99 // TODO(tzik): | 99 // TODO(tzik): |
100 // FileStream::Open and FileStream::Seek may cause blocking IO. | 100 // FileStream::Open and FileStream::Seek may cause blocking IO. |
101 // Temporary allow until fix: http://crbug.com/72001. | 101 // Temporary allow until fix: http://crbug.com/72001. |
102 base::ThreadRestrictions::ScopedAllowIO allow_io; | 102 base::ThreadRestrictions::ScopedAllowIO allow_io; |
103 | 103 |
104 scoped_ptr<FileStream> file(new FileStream()); | 104 scoped_ptr<FileStream> file(new FileStream(NULL)); |
105 int64 rv = file->Open(file_path_, | 105 int64 rv = file->Open(file_path_, |
106 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); | 106 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); |
107 if (rv != OK) { | 107 if (rv != OK) { |
108 // If the file can't be opened, we'll just upload an empty file. | 108 // If the file can't be opened, we'll just upload an empty file. |
109 DLOG(WARNING) << "Failed to open \"" << file_path_.value() | 109 DLOG(WARNING) << "Failed to open \"" << file_path_.value() |
110 << "\" for reading: " << rv; | 110 << "\" for reading: " << rv; |
111 return NULL; | 111 return NULL; |
112 } | 112 } |
113 if (file_range_offset_) { | 113 if (file_range_offset_) { |
114 rv = file->Seek(FROM_BEGIN, file_range_offset_); | 114 rv = file->Seek(FROM_BEGIN, file_range_offset_); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 void UploadData::SetElements(const std::vector<Element>& elements) { | 196 void UploadData::SetElements(const std::vector<Element>& elements) { |
197 elements_ = elements; | 197 elements_ = elements; |
198 } | 198 } |
199 | 199 |
200 UploadData::~UploadData() { | 200 UploadData::~UploadData() { |
201 } | 201 } |
202 | 202 |
203 } // namespace net | 203 } // namespace net |
OLD | NEW |