| OLD | NEW |
| 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_delegate.h" | 5 #include "components/cronet/android/cronet_upload_data_stream_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CronetUploadDataStreamDelegate::OnReadSucceeded(JNIEnv* env, | 74 void CronetUploadDataStreamDelegate::OnReadSucceeded(JNIEnv* env, |
| 75 jobject jcaller, | 75 jobject jcaller, |
| 76 int bytes_read, | 76 int bytes_read, |
| 77 bool final_chunk) { | 77 bool final_chunk) { |
| 78 DCHECK(!network_task_runner_->BelongsToCurrentThread()); | 78 DCHECK(!network_task_runner_->BelongsToCurrentThread()); |
| 79 DCHECK(bytes_read > 0 || (final_chunk && bytes_read == 0)); | 79 DCHECK(bytes_read > 0 || (final_chunk && bytes_read == 0)); |
| 80 | 80 |
| 81 buffer_ = nullptr; | 81 buffer_ = nullptr; |
| 82 DCHECK(network_task_runner_->PostTask( | 82 network_task_runner_->PostTask( |
| 83 FROM_HERE, base::Bind(&CronetUploadDataStreamAdapter::OnReadSuccess, | 83 FROM_HERE, base::Bind(&CronetUploadDataStreamAdapter::OnReadSuccess, |
| 84 adapter_, bytes_read, final_chunk))); | 84 adapter_, bytes_read, final_chunk)); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void CronetUploadDataStreamDelegate::OnRewindSucceeded(JNIEnv* env, | 87 void CronetUploadDataStreamDelegate::OnRewindSucceeded(JNIEnv* env, |
| 88 jobject jcaller) { | 88 jobject jcaller) { |
| 89 DCHECK(!network_task_runner_->BelongsToCurrentThread()); | 89 DCHECK(!network_task_runner_->BelongsToCurrentThread()); |
| 90 | 90 |
| 91 network_task_runner_->PostTask( | 91 network_task_runner_->PostTask( |
| 92 FROM_HERE, | 92 FROM_HERE, |
| 93 base::Bind(&CronetUploadDataStreamAdapter::OnRewindSuccess, adapter_)); | 93 base::Bind(&CronetUploadDataStreamAdapter::OnRewindSuccess, adapter_)); |
| 94 } | 94 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 jclass jcronet_url_request_adapter, | 138 jclass jcronet_url_request_adapter, |
| 139 jlong jupload_data_stream_delegate) { | 139 jlong jupload_data_stream_delegate) { |
| 140 CronetUploadDataStreamDelegate* delegate = | 140 CronetUploadDataStreamDelegate* delegate = |
| 141 reinterpret_cast<CronetUploadDataStreamDelegate*>( | 141 reinterpret_cast<CronetUploadDataStreamDelegate*>( |
| 142 jupload_data_stream_delegate); | 142 jupload_data_stream_delegate); |
| 143 DCHECK(delegate != nullptr); | 143 DCHECK(delegate != nullptr); |
| 144 delete delegate; | 144 delete delegate; |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace cronet | 147 } // namespace cronet |
| OLD | NEW |