Commit 948f3666 authored by torne's avatar torne Committed by Commit bot

Remove now-unnecessary .obj() in Java method calls.

Java methods can now be passed JavaRef parameters directly; remove calls
to .obj() that were being used to convert JavaRef to bare jobject, in
preparation for requiring JavaRef to be used.

This CL only fixes cases that can be fixed by removing the precise
string ".obj()" from a function call and does not introduce any other
changes (though it was run through git cl format to rewrap lines
afterward). This is to enable rubberstamp reviews.

There are a much smaller number of nontrivial changes required to
completely eliminate use of bare jobject as Java method parameters,
which will come in followup CLs for proper review.

BUG=506850
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2237943002
Cr-Commit-Position: refs/heads/master@{#412237}
parent c88c2032
......@@ -135,9 +135,7 @@ AndroidStreamReaderURLRequestJobDelegateImpl::OpenInputStream(JNIEnv* env,
ConvertUTF8ToJavaString(env, url.spec());
ScopedJavaLocalRef<jobject> stream =
android_webview::Java_AndroidProtocolHandler_open(
env,
GetResourceContext(env).obj(),
jurl.obj());
env, GetResourceContext(env), jurl);
if (stream.is_null()) {
DLOG(ERROR) << "Unable to open input stream for Android URL";
......@@ -171,9 +169,7 @@ bool AndroidStreamReaderURLRequestJobDelegateImpl::GetMimeType(
InputStreamImpl::FromInputStream(stream);
ScopedJavaLocalRef<jstring> returned_type =
android_webview::Java_AndroidProtocolHandler_getMimeType(
env,
GetResourceContext(env).obj(),
stream_impl->jobj(), url.obj());
env, GetResourceContext(env), stream_impl->jobj(), url);
if (returned_type.is_null())
return false;
......
......@@ -134,8 +134,7 @@ void AwAutofillClient::ShowAutofillPopupImpl(
ScopedJavaLocalRef<jstring> label =
ConvertUTF16ToJavaString(env, suggestions[i].label);
Java_AwAutofillClient_addToAutofillSuggestionArray(
env, data_array.obj(), i, name.obj(), label.obj(),
suggestions[i].frontend_id);
env, data_array, i, name, label, suggestions[i].frontend_id);
}
ui::ViewAndroid* view_android = web_contents_->GetNativeView();
if (!view_android)
......@@ -150,11 +149,7 @@ void AwAutofillClient::ShowAutofillPopupImpl(
return;
view_android->SetAnchorRect(view, element_bounds);
Java_AwAutofillClient_showAutofillPopup(env,
obj.obj(),
view.obj(),
is_rtl,
data_array.obj());
Java_AwAutofillClient_showAutofillPopup(env, obj, view, is_rtl, data_array);
}
void AwAutofillClient::UpdateAutofillPopupDataListValues(
......@@ -171,7 +166,7 @@ void AwAutofillClient::HideAutofillPopup() {
if (obj.is_null())
return;
delegate_.reset();
Java_AwAutofillClient_hideAutofillPopup(env, obj.obj());
Java_AwAutofillClient_hideAutofillPopup(env, obj);
}
bool AwAutofillClient::IsAutocompleteEnabled() {
......
This diff is collapsed.
......@@ -65,8 +65,7 @@ AwContentsClientBridge::~AwContentsClientBridge() {
if (!obj.is_null()) {
// Clear the weak reference from the java peer to the native object since
// it is possible that java object lifetime can exceed the AwContens.
Java_AwContentsClientBridge_setNativeContentsClientBridge(env, obj.obj(),
0);
Java_AwContentsClientBridge_setNativeContentsClientBridge(env, obj, 0);
}
for (IDMap<content::ClientCertificateDelegate>::iterator iter(
......@@ -101,7 +100,7 @@ void AwContentsClientBridge::AllowCertificateError(
int request_id = pending_cert_error_callbacks_.Add(
new CertErrorCallback(callback));
*cancel_request = !Java_AwContentsClientBridge_allowCertificateError(
env, obj.obj(), cert_error, jcert.obj(), jurl.obj(), request_id);
env, obj, cert_error, jcert, jurl, request_id);
// if the request is cancelled, then cancel the stored callback
if (*cancel_request) {
pending_cert_error_callbacks_.Remove(request_id);
......@@ -183,12 +182,7 @@ void AwContentsClientBridge::SelectClientCertificate(
env, cert_request_info->host_and_port.host());
Java_AwContentsClientBridge_selectClientCertificate(
env,
obj.obj(),
request_id,
key_types_ref.obj(),
principals_ref.obj(),
host_name_ref.obj(),
env, obj, request_id, key_types_ref, principals_ref, host_name_ref,
cert_request_info->host_and_port.port());
// Release the guard.
......@@ -291,26 +285,22 @@ void AwContentsClientBridge::RunJavaScriptDialog(
switch (message_type) {
case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: {
devtools_instrumentation::ScopedEmbedderCallbackTask("onJsAlert");
Java_AwContentsClientBridge_handleJsAlert(
env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id);
Java_AwContentsClientBridge_handleJsAlert(env, obj, jurl, jmessage,
callback_id);
break;
}
case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: {
devtools_instrumentation::ScopedEmbedderCallbackTask("onJsConfirm");
Java_AwContentsClientBridge_handleJsConfirm(
env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id);
Java_AwContentsClientBridge_handleJsConfirm(env, obj, jurl, jmessage,
callback_id);
break;
}
case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: {
ScopedJavaLocalRef<jstring> jdefault_value(
ConvertUTF16ToJavaString(env, default_prompt_text));
devtools_instrumentation::ScopedEmbedderCallbackTask("onJsPrompt");
Java_AwContentsClientBridge_handleJsPrompt(env,
obj.obj(),
jurl.obj(),
jmessage.obj(),
jdefault_value.obj(),
callback_id);
Java_AwContentsClientBridge_handleJsPrompt(env, obj, jurl, jmessage,
jdefault_value, callback_id);
break;
}
default:
......@@ -341,8 +331,8 @@ void AwContentsClientBridge::RunBeforeUnloadDialog(
ConvertUTF16ToJavaString(env, message_text));
devtools_instrumentation::ScopedEmbedderCallbackTask("onJsBeforeUnload");
Java_AwContentsClientBridge_handleJsBeforeUnload(
env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id);
Java_AwContentsClientBridge_handleJsBeforeUnload(env, obj, jurl, jmessage,
callback_id);
}
bool AwContentsClientBridge::ShouldOverrideUrlLoading(const base::string16& url,
......@@ -357,7 +347,7 @@ bool AwContentsClientBridge::ShouldOverrideUrlLoading(const base::string16& url,
devtools_instrumentation::ScopedEmbedderCallbackTask(
"shouldOverrideUrlLoading");
return Java_AwContentsClientBridge_shouldOverrideUrlLoading(
env, obj.obj(), jurl.obj(), has_user_gesture, is_redirect, is_main_frame);
env, obj, jurl, has_user_gesture, is_redirect, is_main_frame);
}
void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env,
......
......@@ -111,7 +111,7 @@ void AwContentsClientBridgeTest::TestCertType(SSLClientCertType type,
base::RunLoop().RunUntilIdle();
EXPECT_EQ(0, cert_selected_callbacks_);
ScopedJavaLocalRef<jobjectArray> key_types =
Java_MockAwContentsClientBridge_getKeyTypes(env_, jbridge_.obj());
Java_MockAwContentsClientBridge_getKeyTypes(env_, jbridge_);
std::vector<std::string> vec;
base::android::AppendJavaStringArrayToStringVector(env_,
key_types.obj(),
......@@ -131,8 +131,8 @@ TEST_F(AwContentsClientBridgeTest,
base::WrapUnique(new TestClientCertificateDelegate(this)));
bridge_->ProvideClientCertificateResponse(
env_, jbridge_,
Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_.obj()),
Java_MockAwContentsClientBridge_createTestCertChain(env_, jbridge_.obj()),
Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_),
Java_MockAwContentsClientBridge_createTestCertChain(env_, jbridge_),
nullptr);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(nullptr, selected_cert_);
......@@ -148,8 +148,7 @@ TEST_F(AwContentsClientBridgeTest,
bridge_->SelectClientCertificate(
cert_request_info_.get(),
base::WrapUnique(new TestClientCertificateDelegate(this)));
int requestId =
Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_.obj());
int requestId = Java_MockAwContentsClientBridge_getRequestId(env_, jbridge_);
bridge_->ProvideClientCertificateResponse(env_, jbridge_, requestId, nullptr,
nullptr);
base::RunLoop().RunUntilIdle();
......
......@@ -307,8 +307,7 @@ AwContentsIoThreadClientImpl::GetCacheMode() const {
JNIEnv* env = AttachCurrentThread();
return static_cast<AwContentsIoThreadClient::CacheMode>(
Java_AwContentsIoThreadClient_getCacheMode(
env, java_object_.obj()));
Java_AwContentsIoThreadClient_getCacheMode(env, java_object_));
}
......@@ -356,8 +355,8 @@ void AwContentsIoThreadClientImpl::ShouldInterceptRequestAsync(
JNIEnv* env = AttachCurrentThread();
if (bg_thread_client_object_.is_null() && !java_object_.is_null()) {
bg_thread_client_object_.Reset(
Java_AwContentsIoThreadClient_getBackgroundThreadClient(
env, java_object_.obj()));
Java_AwContentsIoThreadClient_getBackgroundThreadClient(env,
java_object_));
}
if (!bg_thread_client_object_.is_null()) {
get_response = base::Bind(
......@@ -374,8 +373,8 @@ bool AwContentsIoThreadClientImpl::ShouldBlockContentUrls() const {
return false;
JNIEnv* env = AttachCurrentThread();
return Java_AwContentsIoThreadClient_shouldBlockContentUrls(
env, java_object_.obj());
return Java_AwContentsIoThreadClient_shouldBlockContentUrls(env,
java_object_);
}
bool AwContentsIoThreadClientImpl::ShouldBlockFileUrls() const {
......@@ -384,8 +383,7 @@ bool AwContentsIoThreadClientImpl::ShouldBlockFileUrls() const {
return false;
JNIEnv* env = AttachCurrentThread();
return Java_AwContentsIoThreadClient_shouldBlockFileUrls(
env, java_object_.obj());
return Java_AwContentsIoThreadClient_shouldBlockFileUrls(env, java_object_);
}
bool AwContentsIoThreadClientImpl::ShouldAcceptThirdPartyCookies() const {
......@@ -395,7 +393,7 @@ bool AwContentsIoThreadClientImpl::ShouldAcceptThirdPartyCookies() const {
JNIEnv* env = AttachCurrentThread();
return Java_AwContentsIoThreadClient_shouldAcceptThirdPartyCookies(
env, java_object_.obj());
env, java_object_);
}
bool AwContentsIoThreadClientImpl::ShouldBlockNetworkLoads() const {
......@@ -404,8 +402,8 @@ bool AwContentsIoThreadClientImpl::ShouldBlockNetworkLoads() const {
return false;
JNIEnv* env = AttachCurrentThread();
return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads(
env, java_object_.obj());
return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads(env,
java_object_);
}
void AwContentsIoThreadClientImpl::NewDownload(
......@@ -429,13 +427,8 @@ void AwContentsIoThreadClientImpl::NewDownload(
ConvertUTF8ToJavaString(env, mime_type);
Java_AwContentsIoThreadClient_onDownloadStart(
env,
java_object_.obj(),
jstring_url.obj(),
jstring_user_agent.obj(),
jstring_content_disposition.obj(),
jstring_mime_type.obj(),
content_length);
env, java_object_, jstring_url, jstring_user_agent,
jstring_content_disposition, jstring_mime_type, content_length);
}
void AwContentsIoThreadClientImpl::NewLoginRequest(const string& realm,
......@@ -453,8 +446,8 @@ void AwContentsIoThreadClientImpl::NewLoginRequest(const string& realm,
if (!account.empty())
jaccount = ConvertUTF8ToJavaString(env, account);
Java_AwContentsIoThreadClient_newLoginRequest(
env, java_object_.obj(), jrealm.obj(), jaccount.obj(), jargs.obj());
Java_AwContentsIoThreadClient_newLoginRequest(env, java_object_, jrealm,
jaccount, jargs);
}
void AwContentsIoThreadClientImpl::OnReceivedError(
......@@ -471,16 +464,10 @@ void AwContentsIoThreadClientImpl::OnReceivedError(
env, net::ErrorToString(request->status().error()));
Java_AwContentsIoThreadClient_onReceivedError(
env,
java_object_.obj(),
web_request.jstring_url.obj(),
web_request.is_main_frame,
web_request.has_user_gesture,
web_request.jstring_method.obj(),
web_request.jstringArray_header_names.obj(),
web_request.jstringArray_header_values.obj(),
error_code,
jstring_description.obj());
env, java_object_, web_request.jstring_url, web_request.is_main_frame,
web_request.has_user_gesture, web_request.jstring_method,
web_request.jstringArray_header_names,
web_request.jstringArray_header_values, error_code, jstring_description);
}
void AwContentsIoThreadClientImpl::OnReceivedHttpError(
......@@ -520,20 +507,12 @@ void AwContentsIoThreadClientImpl::OnReceivedHttpError(
ToJavaArrayOfStrings(env, response_header_values);
Java_AwContentsIoThreadClient_onReceivedHttpError(
env,
java_object_.obj(),
web_request.jstring_url.obj(),
web_request.is_main_frame,
web_request.has_user_gesture,
web_request.jstring_method.obj(),
web_request.jstringArray_header_names.obj(),
web_request.jstringArray_header_values.obj(),
jstring_mime_type.obj(),
jstring_encoding.obj(),
status_code,
jstring_reason.obj(),
jstringArray_response_header_names.obj(),
jstringArray_response_header_values.obj());
env, java_object_, web_request.jstring_url, web_request.is_main_frame,
web_request.has_user_gesture, web_request.jstring_method,
web_request.jstringArray_header_names,
web_request.jstringArray_header_values, jstring_mime_type,
jstring_encoding, status_code, jstring_reason,
jstringArray_response_header_names, jstringArray_response_header_values);
}
} // namespace android_webview
......@@ -51,7 +51,7 @@ bool AwGLFunctor::RequestInvokeGL(bool wait_for_completion) {
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (obj.is_null())
return false;
return Java_AwGLFunctor_requestInvokeGL(env, obj.obj(), wait_for_completion);
return Java_AwGLFunctor_requestInvokeGL(env, obj, wait_for_completion);
}
void AwGLFunctor::DetachFunctorFromView() {
......@@ -59,7 +59,7 @@ void AwGLFunctor::DetachFunctorFromView() {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (!obj.is_null())
Java_AwGLFunctor_detachFunctorFromView(env, obj.obj());
Java_AwGLFunctor_detachFunctorFromView(env, obj);
}
void AwGLFunctor::Destroy(JNIEnv* env,
......
......@@ -35,7 +35,7 @@ AwHttpAuthHandler::AwHttpAuthHandler(AwLoginDelegate* login_delegate,
AwHttpAuthHandler:: ~AwHttpAuthHandler() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
Java_AwHttpAuthHandler_handlerDestroyed(base::android::AttachCurrentThread(),
http_auth_handler_.obj());
http_auth_handler_);
}
void AwHttpAuthHandler::Proceed(JNIEnv* env,
......
......@@ -40,8 +40,7 @@ AwMessagePortServiceImpl::~AwMessagePortServiceImpl() {
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (obj.is_null())
return;
Java_AwMessagePortService_unregisterNativeAwMessagePortService(env,
obj.obj());
Java_AwMessagePortService_unregisterNativeAwMessagePortService(env, obj);
}
void AwMessagePortServiceImpl::Init(JNIEnv* env, jobject obj) {
......@@ -105,11 +104,8 @@ void AwMessagePortServiceImpl::OnConvertedWebToAppMessage(
ScopedJavaLocalRef<jstring> jmsg = ConvertUTF16ToJavaString(env, value);
ScopedJavaLocalRef<jintArray> jports =
ToJavaIntArray(env, sent_message_port_ids);
Java_AwMessagePortService_onReceivedMessage(env,
jobj.obj(),
message_port_id,
jmsg.obj(),
jports.obj());
Java_AwMessagePortService_onReceivedMessage(env, jobj, message_port_id, jmsg,
jports);
}
void AwMessagePortServiceImpl::OnMessagePortMessageFilterClosing(
......@@ -218,8 +214,8 @@ void AwMessagePortServiceImpl::OnMessageChannelCreated(
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (obj.is_null())
return;
Java_AwMessagePortService_onMessageChannelCreated(env, obj.obj(), *port1,
*port2, ports->obj());
Java_AwMessagePortService_onMessageChannelCreated(env, obj, *port1, *port2,
ports->obj());
}
// Adds a new port to the message port service.
......
......@@ -32,7 +32,7 @@ AwPdfExporter::~AwPdfExporter() {
if (obj.is_null())
return;
// Clear the Java peer's weak pointer to |this| object.
Java_AwPdfExporter_setNativeAwPdfExporter(env, obj.obj(), 0);
Java_AwPdfExporter_setNativeAwPdfExporter(env, obj, 0);
}
void AwPdfExporter::ExportToPdf(JNIEnv* env,
......@@ -98,7 +98,7 @@ void AwPdfExporter::DidExportPdf(int fd, bool success) {
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
if (obj.is_null())
return;
Java_AwPdfExporter_didExportPdf(env, obj.obj(), success);
Java_AwPdfExporter_didExportPdf(env, obj, success);
}
bool RegisterAwPdfExporter(JNIEnv* env) {
......
......@@ -284,12 +284,9 @@ void AwQuotaManagerBridgeImpl::GetOriginsCallbackImpl(
return;
Java_AwQuotaManagerBridge_onGetOriginsCallback(
env,
obj.obj(),
jcallback_id,
base::android::ToJavaArrayOfStrings(env, origin).obj(),
base::android::ToJavaLongArray(env, usage).obj(),
base::android::ToJavaLongArray(env, quota).obj());
env, obj, jcallback_id, base::android::ToJavaArrayOfStrings(env, origin),
base::android::ToJavaLongArray(env, usage),
base::android::ToJavaLongArray(env, quota));
}
namespace {
......@@ -360,7 +357,7 @@ void AwQuotaManagerBridgeImpl::QuotaUsageCallbackImpl(int jcallback_id,
return;
Java_AwQuotaManagerBridge_onGetUsageAndQuotaForOriginCallback(
env, obj.obj(), jcallback_id, is_quota, usage, quota);
env, obj, jcallback_id, is_quota, usage, quota);
}
bool RegisterAwQuotaManagerBridge(JNIEnv* env) {
......
......@@ -143,8 +143,8 @@ void AwWebContentsDelegate::AddNewContents(WebContents* source,
bool create_popup = false;
if (java_delegate.obj()) {
create_popup = Java_AwWebContentsDelegate_addNewContents(env,
java_delegate.obj(), is_dialog, user_gesture);
create_popup = Java_AwWebContentsDelegate_addNewContents(
env, java_delegate, is_dialog, user_gesture);
}
if (create_popup) {
......@@ -178,7 +178,7 @@ void AwWebContentsDelegate::NavigationStateChanged(
ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env);
if (java_delegate.obj()) {
Java_AwWebContentsDelegate_navigationStateChanged(env, java_delegate.obj(),
Java_AwWebContentsDelegate_navigationStateChanged(env, java_delegate,
changed_flags);
}
}
......@@ -199,7 +199,7 @@ void AwWebContentsDelegate::CloseContents(WebContents* source) {
ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env);
if (java_delegate.obj()) {
Java_AwWebContentsDelegate_closeContents(env, java_delegate.obj());
Java_AwWebContentsDelegate_closeContents(env, java_delegate);
}
}
......@@ -208,7 +208,7 @@ void AwWebContentsDelegate::ActivateContents(WebContents* contents) {
ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env);
if (java_delegate.obj()) {
Java_AwWebContentsDelegate_activateContents(env, java_delegate.obj());
Java_AwWebContentsDelegate_activateContents(env, java_delegate);
}
}
......@@ -220,7 +220,7 @@ void AwWebContentsDelegate::LoadingStateChanged(WebContents* source,
ScopedJavaLocalRef<jobject> java_delegate = GetJavaDelegate(env);
if (java_delegate.obj()) {
Java_AwWebContentsDelegate_loadingStateChanged(env, java_delegate.obj());
Java_AwWebContentsDelegate_loadingStateChanged(env, java_delegate);
}
}
......
......@@ -30,7 +30,7 @@ AwWebResourceResponseImpl::~AwWebResourceResponseImpl() {
std::unique_ptr<InputStream> AwWebResourceResponseImpl::GetInputStream(
JNIEnv* env) const {
ScopedJavaLocalRef<jobject> jstream =
Java_AwWebResourceResponse_getData(env, java_object_.obj());
Java_AwWebResourceResponse_getData(env, java_object_);
if (jstream.is_null())
return std::unique_ptr<InputStream>();
return base::WrapUnique(new InputStreamImpl(jstream));
......@@ -39,7 +39,7 @@ std::unique_ptr<InputStream> AwWebResourceResponseImpl::GetInputStream(
bool AwWebResourceResponseImpl::GetMimeType(JNIEnv* env,
std::string* mime_type) const {
ScopedJavaLocalRef<jstring> jstring_mime_type =
Java_AwWebResourceResponse_getMimeType(env, java_object_.obj());
Java_AwWebResourceResponse_getMimeType(env, java_object_);
if (jstring_mime_type.is_null())
return false;
*mime_type = ConvertJavaStringToUTF8(jstring_mime_type);
......@@ -49,7 +49,7 @@ bool AwWebResourceResponseImpl::GetMimeType(JNIEnv* env,
bool AwWebResourceResponseImpl::GetCharset(
JNIEnv* env, std::string* charset) const {
ScopedJavaLocalRef<jstring> jstring_charset =
Java_AwWebResourceResponse_getCharset(env, java_object_.obj());
Java_AwWebResourceResponse_getCharset(env, java_object_);
if (jstring_charset.is_null())
return false;
*charset = ConvertJavaStringToUTF8(jstring_charset);
......@@ -60,10 +60,9 @@ bool AwWebResourceResponseImpl::GetStatusInfo(
JNIEnv* env,
int* status_code,
std::string* reason_phrase) const {
int status =
Java_AwWebResourceResponse_getStatusCode(env, java_object_.obj());
int status = Java_AwWebResourceResponse_getStatusCode(env, java_object_);
ScopedJavaLocalRef<jstring> jstring_reason_phrase =
Java_AwWebResourceResponse_getReasonPhrase(env, java_object_.obj());
Java_AwWebResourceResponse_getReasonPhrase(env, java_object_);
if (status < 100 || status >= 600 || jstring_reason_phrase.is_null())
return false;
*status_code = status;
......@@ -75,11 +74,9 @@ bool AwWebResourceResponseImpl::GetResponseHeaders(
JNIEnv* env,
net::HttpResponseHeaders* headers) const {
ScopedJavaLocalRef<jobjectArray> jstringArray_headerNames =
Java_AwWebResourceResponse_getResponseHeaderNames(env,
java_object_.obj());
Java_AwWebResourceResponse_getResponseHeaderNames(env, java_object_);
ScopedJavaLocalRef<jobjectArray> jstringArray_headerValues =
Java_AwWebResourceResponse_getResponseHeaderValues(env,
java_object_.obj());
Java_AwWebResourceResponse_getResponseHeaderValues(env, java_object_);
if (jstringArray_headerNames.is_null() || jstringArray_headerValues.is_null())
return false;
std::vector<std::string> header_names;
......
......@@ -79,8 +79,7 @@ class BoolCookieCallbackHolder {
void Invoke(bool result) {
if (!callback_.is_null()) {
JNIEnv* env = base::android::AttachCurrentThread();
Java_AwCookieManager_invokeBooleanCookieCallback(env, callback_.obj(),
result);
Java_AwCookieManager_invokeBooleanCookieCallback(env, callback_, result);
}
}
......
......@@ -49,12 +49,12 @@ InputStreamImpl::InputStreamImpl(const JavaRef<jobject>& stream)
InputStreamImpl::~InputStreamImpl() {
JNIEnv* env = AttachCurrentThread();
Java_InputStreamUtil_close(env, jobject_.obj());
Java_InputStreamUtil_close(env, jobject_);
}
bool InputStreamImpl::BytesAvailable(int* bytes_available) const {
JNIEnv* env = AttachCurrentThread();
int bytes = Java_InputStreamUtil_available(env, jobject_.obj());
int bytes = Java_InputStreamUtil_available(env, jobject_);
if (bytes == kExceptionThrownStatusCode)
return false;
*bytes_available = bytes;
......@@ -63,7 +63,7 @@ bool InputStreamImpl::BytesAvailable(int* bytes_available) const {
bool InputStreamImpl::Skip(int64_t n, int64_t* bytes_skipped) {
JNIEnv* env = AttachCurrentThread();
int bytes = Java_InputStreamUtil_skip(env, jobject_.obj(), n);
int bytes = Java_InputStreamUtil_skip(env, jobject_, n);
if (bytes < 0)
return false;
if (bytes > n)
......@@ -91,7 +91,7 @@ bool InputStreamImpl::Read(net::IOBuffer* dest, int length, int* bytes_read) {
while (remaining_length > 0) {
const int max_transfer_length = std::min(remaining_length, kBufferSize);
const int transfer_length = Java_InputStreamUtil_read(
env, jobject_.obj(), buffer, 0, max_transfer_length);