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

Side by Side Diff: components/cronet/android/test/test_upload_data_stream_handler.cc

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 "test_upload_data_stream_handler.h" 5 #include "test_upload_data_stream_handler.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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 std::string data_read = ""; 162 std::string data_read = "";
163 if (read_buffer_.get() && bytes_read_ > 0) 163 if (read_buffer_.get() && bytes_read_ > 0)
164 data_read = std::string(read_buffer_->data(), bytes_read_); 164 data_read = std::string(read_buffer_->data(), bytes_read_);
165 cronet::Java_TestUploadDataStreamHandler_onReadCompleted( 165 cronet::Java_TestUploadDataStreamHandler_onReadCompleted(
166 env, jtest_upload_data_stream_handler_.obj(), bytes_read_, 166 env, jtest_upload_data_stream_handler_.obj(), bytes_read_,
167 base::android::ConvertUTF8ToJavaString(env, data_read).obj()); 167 base::android::ConvertUTF8ToJavaString(env, data_read).obj());
168 } 168 }
169 169
170 static jlong CreateTestUploadDataStreamHandler( 170 static jlong CreateTestUploadDataStreamHandler(
171 JNIEnv* env, 171 JNIEnv* env,
172 jobject jtest_upload_data_stream_handler, 172 const JavaParamRef<jobject>& jtest_upload_data_stream_handler,
173 jlong jupload_data_stream) { 173 jlong jupload_data_stream) {
174 scoped_ptr<net::UploadDataStream> upload_data_stream( 174 scoped_ptr<net::UploadDataStream> upload_data_stream(
175 reinterpret_cast<net::UploadDataStream*>(jupload_data_stream)); 175 reinterpret_cast<net::UploadDataStream*>(jupload_data_stream));
176 TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler( 176 TestUploadDataStreamHandler* handler = new TestUploadDataStreamHandler(
177 upload_data_stream.Pass(), env, jtest_upload_data_stream_handler); 177 upload_data_stream.Pass(), env, jtest_upload_data_stream_handler);
178 return reinterpret_cast<jlong>(handler); 178 return reinterpret_cast<jlong>(handler);
179 } 179 }
180 180
181 bool TestUploadDataStreamHandlerRegisterJni(JNIEnv* env) { 181 bool TestUploadDataStreamHandlerRegisterJni(JNIEnv* env) {
182 return RegisterNativesImpl(env); 182 return RegisterNativesImpl(env);
183 } 183 }
184 184
185 } // namespace cronet 185 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698