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

Side by Side Diff: components/cronet/android/cronet_upload_data_stream.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/cronet/android/cronet_upload_data_stream.h" 5 #include "components/cronet/android/cronet_upload_data_stream.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 9
10 namespace cronet { 10 namespace cronet {
11 11
12 CronetUploadDataStream::CronetUploadDataStream(Delegate* delegate, int64 size) 12 CronetUploadDataStream::CronetUploadDataStream(Delegate* delegate, int64_t size)
13 : UploadDataStream(size < 0, 0), 13 : UploadDataStream(size < 0, 0),
14 size_(size), 14 size_(size),
15 waiting_on_read_(false), 15 waiting_on_read_(false),
16 read_in_progress_(false), 16 read_in_progress_(false),
17 waiting_on_rewind_(false), 17 waiting_on_rewind_(false),
18 rewind_in_progress_(false), 18 rewind_in_progress_(false),
19 at_front_of_stream_(true), 19 at_front_of_stream_(true),
20 delegate_(delegate), 20 delegate_(delegate),
21 weak_factory_(this) { 21 weak_factory_(this) {}
22 }
23 22
24 CronetUploadDataStream::~CronetUploadDataStream() { 23 CronetUploadDataStream::~CronetUploadDataStream() {
25 delegate_->OnUploadDataStreamDestroyed(); 24 delegate_->OnUploadDataStreamDestroyed();
26 } 25 }
27 26
28 int CronetUploadDataStream::InitInternal() { 27 int CronetUploadDataStream::InitInternal() {
29 // ResetInternal should have been called before init, if the stream was in 28 // ResetInternal should have been called before init, if the stream was in
30 // use. 29 // use.
31 DCHECK(!waiting_on_read_); 30 DCHECK(!waiting_on_read_);
32 DCHECK(!waiting_on_rewind_); 31 DCHECK(!waiting_on_rewind_);
33 32
34 if (!weak_factory_.HasWeakPtrs()) 33 if (!weak_factory_.HasWeakPtrs())
35 delegate_->InitializeOnNetworkThread(weak_factory_.GetWeakPtr()); 34 delegate_->InitializeOnNetworkThread(weak_factory_.GetWeakPtr());
36 35
37 // Set size of non-chunked uploads. 36 // Set size of non-chunked uploads.
38 if (size_ >= 0) 37 if (size_ >= 0)
39 SetSize(static_cast<uint64>(size_)); 38 SetSize(static_cast<uint64_t>(size_));
40 39
41 // If already at the front of the stream, nothing to do. 40 // If already at the front of the stream, nothing to do.
42 if (at_front_of_stream_) { 41 if (at_front_of_stream_) {
43 // Being at the front of the stream implies there's no read or rewind in 42 // Being at the front of the stream implies there's no read or rewind in
44 // progress. 43 // progress.
45 DCHECK(!read_in_progress_); 44 DCHECK(!read_in_progress_);
46 DCHECK(!rewind_in_progress_); 45 DCHECK(!rewind_in_progress_);
47 return net::OK; 46 return net::OK;
48 } 47 }
49 48
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 DCHECK(!read_in_progress_); 128 DCHECK(!read_in_progress_);
130 DCHECK(waiting_on_rewind_); 129 DCHECK(waiting_on_rewind_);
131 DCHECK(!rewind_in_progress_); 130 DCHECK(!rewind_in_progress_);
132 DCHECK(!at_front_of_stream_); 131 DCHECK(!at_front_of_stream_);
133 132
134 rewind_in_progress_ = true; 133 rewind_in_progress_ = true;
135 delegate_->Rewind(); 134 delegate_->Rewind();
136 } 135 }
137 136
138 } // namespace cronet 137 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/cronet_upload_data_stream.h ('k') | components/cronet/android/cronet_url_request_context_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698