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

Unified Diff: net/base/upload_data.cc

Issue 10878082: net: Move file operation code from UploadData to UploadDataStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: net/base/upload_data.cc
diff --git a/net/base/upload_data.cc b/net/base/upload_data.cc
index f3dc22c03ab2160b76e75e6fb80605eaa56ba8e4..e38b8fdefe65db00598a4aa1819d06bbf2e0b404 100644
--- a/net/base/upload_data.cc
+++ b/net/base/upload_data.cc
@@ -11,17 +11,6 @@
namespace net {
-namespace {
-
-// Helper function for GetContentLength().
-void OnGetContentLengthComplete(
- const UploadData::ContentLengthCallback& callback,
- uint64* content_length) {
- callback.Run(*content_length);
-}
-
-} // namespace
-
UploadData::UploadData()
: identifier_(0),
chunk_callback_(NULL),
@@ -62,23 +51,6 @@ void UploadData::set_chunk_callback(ChunkCallback* callback) {
chunk_callback_ = callback;
}
-void UploadData::GetContentLength(const ContentLengthCallback& callback) {
- uint64* result = new uint64(0);
- const bool task_is_slow = true;
- const bool posted = base::WorkerPool::PostTaskAndReply(
- FROM_HERE,
- base::Bind(&UploadData::DoGetContentLength, this, result),
- base::Bind(&OnGetContentLengthComplete, callback, base::Owned(result)),
- task_is_slow);
- DCHECK(posted);
-}
-
-uint64 UploadData::GetContentLengthSync() {
- uint64 content_length = 0;
- DoGetContentLength(&content_length);
- return content_length;
-}
-
bool UploadData::IsInMemory() const {
// Chunks are in memory, but UploadData does not have all the chunks at
// once. Chunks are provided progressively with AppendChunk() as chunks
@@ -95,25 +67,10 @@ bool UploadData::IsInMemory() const {
return true;
}
-void UploadData::ResetOffset() {
- for (size_t i = 0; i < elements_.size(); ++i)
- elements_[i].ResetOffset();
-}
-
void UploadData::SetElements(const std::vector<UploadElement>& elements) {
elements_ = elements;
}
-void UploadData::DoGetContentLength(uint64* content_length) {
- *content_length = 0;
-
- if (is_chunked_)
- return;
-
- for (size_t i = 0; i < elements_.size(); ++i)
- *content_length += elements_[i].GetContentLength();
-}
-
UploadData::~UploadData() {
}

Powered by Google App Engine
This is Rietveld 408576698