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

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

Issue 947203002: [Cronet] Move PostTask out of DCHECK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698