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_stream.h" | 5 #include "net/base/upload_data_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.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" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 UploadDataStream::UploadDataStream(bool is_chunked, int64 identifier) | 14 UploadDataStream::UploadDataStream(bool is_chunked, int64_t identifier) |
15 : total_size_(0), | 15 : total_size_(0), |
16 current_position_(0), | 16 current_position_(0), |
17 identifier_(identifier), | 17 identifier_(identifier), |
18 is_chunked_(is_chunked), | 18 is_chunked_(is_chunked), |
19 initialized_successfully_(false), | 19 initialized_successfully_(false), |
20 is_eof_(false) { | 20 is_eof_(false) { |
21 } | 21 } |
22 | 22 |
23 UploadDataStream::~UploadDataStream() { | 23 UploadDataStream::~UploadDataStream() { |
24 } | 24 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 void UploadDataStream::Reset() { | 65 void UploadDataStream::Reset() { |
66 current_position_ = 0; | 66 current_position_ = 0; |
67 initialized_successfully_ = false; | 67 initialized_successfully_ = false; |
68 is_eof_ = false; | 68 is_eof_ = false; |
69 total_size_ = 0; | 69 total_size_ = 0; |
70 callback_.Reset(); | 70 callback_.Reset(); |
71 ResetInternal(); | 71 ResetInternal(); |
72 } | 72 } |
73 | 73 |
74 void UploadDataStream::SetSize(uint64 size) { | 74 void UploadDataStream::SetSize(uint64_t size) { |
75 DCHECK(!initialized_successfully_); | 75 DCHECK(!initialized_successfully_); |
76 DCHECK(!is_chunked_); | 76 DCHECK(!is_chunked_); |
77 total_size_ = size; | 77 total_size_ = size; |
78 } | 78 } |
79 | 79 |
80 void UploadDataStream::SetIsFinalChunk() { | 80 void UploadDataStream::SetIsFinalChunk() { |
81 DCHECK(initialized_successfully_); | 81 DCHECK(initialized_successfully_); |
82 DCHECK(is_chunked_); | 82 DCHECK(is_chunked_); |
83 DCHECK(!is_eof_); | 83 DCHECK(!is_eof_); |
84 is_eof_ = true; | 84 is_eof_ = true; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 is_eof_ = true; | 119 is_eof_ = true; |
120 } | 120 } |
121 | 121 |
122 DCHECK(result > 0 || is_eof_); | 122 DCHECK(result > 0 || is_eof_); |
123 | 123 |
124 if (!callback_.is_null()) | 124 if (!callback_.is_null()) |
125 base::ResetAndReturn(&callback_).Run(result); | 125 base::ResetAndReturn(&callback_).Run(result); |
126 } | 126 } |
127 | 127 |
128 } // namespace net | 128 } // namespace net |
OLD | NEW |