summaryrefslogtreecommitdiffstats
path: root/blimp
diff options
context:
space:
mode:
authortorne <torne@chromium.org>2015-12-17 08:22:11 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-17 16:23:12 +0000
commit270402789b8e60ccbeb19229e681ae9bb02aebf5 (patch)
tree82db99816a88aff1e9ccefa974e1d0eb7653df5d /blimp
parentd501894251559fe547bda9381bdeb98d229f6e7c (diff)
downloadchromium_src-270402789b8e60ccbeb19229e681ae9bb02aebf5.zip
chromium_src-270402789b8e60ccbeb19229e681ae9bb02aebf5.tar.gz
chromium_src-270402789b8e60ccbeb19229e681ae9bb02aebf5.tar.bz2
Pass method parameters as JavaParamRef in remaining cases.
Pass all object parameters to JNI methods in JavaParamRef<> wrappers. BUG=506850 Review URL: https://codereview.chromium.org/1525743003 Cr-Commit-Position: refs/heads/master@{#365835}
Diffstat (limited to 'blimp')
-rw-r--r--blimp/client/android/blimp_view.cc73
-rw-r--r--blimp/client/android/blimp_view.h76
-rw-r--r--blimp/client/android/toolbar.cc13
-rw-r--r--blimp/client/android/toolbar.h15
-rw-r--r--blimp/client/session/blimp_client_session_android.cc3
-rw-r--r--blimp/client/session/blimp_client_session_android.h2
-rw-r--r--blimp/client/session/tab_control_feature_android.cc14
-rw-r--r--blimp/client/session/tab_control_feature_android.h13
8 files changed, 116 insertions, 93 deletions
diff --git a/blimp/client/android/blimp_view.cc b/blimp/client/android/blimp_view.cc
index 3fdbe26..650b51b 100644
--- a/blimp/client/android/blimp_view.cc
+++ b/blimp/client/android/blimp_view.cc
@@ -60,18 +60,19 @@ BlimpView::~BlimpView() {
ReleaseAcceleratedWidget();
}
-void BlimpView::Destroy(JNIEnv* env, jobject jobj) {
+void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
delete this;
}
-void BlimpView::SetNeedsComposite(JNIEnv* env, jobject jobj) {}
+void BlimpView::SetNeedsComposite(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj) {}
void BlimpView::OnSurfaceChanged(JNIEnv* env,
- jobject jobj,
+ const JavaParamRef<jobject>& jobj,
jint format,
jint width,
jint height,
- jobject jsurface) {
+ const JavaParamRef<jobject>& jsurface) {
if (current_surface_format_ != format) {
current_surface_format_ = format;
ReleaseAcceleratedWidget();
@@ -87,16 +88,20 @@ void BlimpView::OnSurfaceChanged(JNIEnv* env,
compositor_->SetSize(gfx::Size(width, height));
}
-void BlimpView::OnSurfaceCreated(JNIEnv* env, jobject jobj) {
+void BlimpView::OnSurfaceCreated(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj) {
current_surface_format_ = 0 /** PixelFormat.UNKNOWN */;
}
-void BlimpView::OnSurfaceDestroyed(JNIEnv* env, jobject jobj) {
+void BlimpView::OnSurfaceDestroyed(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj) {
current_surface_format_ = 0 /** PixelFormat.UNKNOWN */;
ReleaseAcceleratedWidget();
}
-void BlimpView::SetVisibility(JNIEnv* env, jobject jobj, jboolean visible) {
+void BlimpView::SetVisibility(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj,
+ jboolean visible) {
compositor_->SetVisible(visible);
}
@@ -110,33 +115,33 @@ void BlimpView::ReleaseAcceleratedWidget() {
}
jboolean BlimpView::OnTouchEvent(JNIEnv* env,
- jobject obj,
- jobject motion_event,
- jlong time_ms,
- jint android_action,
- jint pointer_count,
- jint history_size,
- jint action_index,
- jfloat pos_x_0,
- jfloat pos_y_0,
- jfloat pos_x_1,
- jfloat pos_y_1,
- jint pointer_id_0,
- jint pointer_id_1,
- jfloat touch_major_0,
- jfloat touch_major_1,
- jfloat touch_minor_0,
- jfloat touch_minor_1,
- jfloat orientation_0,
- jfloat orientation_1,
- jfloat tilt_0,
- jfloat tilt_1,
- jfloat raw_pos_x,
- jfloat raw_pos_y,
- jint android_tool_type_0,
- jint android_tool_type_1,
- jint android_button_state,
- jint android_meta_state) {
+ const JavaParamRef<jobject>& obj,
+ const JavaParamRef<jobject>& motion_event,
+ jlong time_ms,
+ jint android_action,
+ jint pointer_count,
+ jint history_size,
+ jint action_index,
+ jfloat pos_x_0,
+ jfloat pos_y_0,
+ jfloat pos_x_1,
+ jfloat pos_y_1,
+ jint pointer_id_0,
+ jint pointer_id_1,
+ jfloat touch_major_0,
+ jfloat touch_major_1,
+ jfloat touch_minor_0,
+ jfloat touch_minor_1,
+ jfloat orientation_0,
+ jfloat orientation_1,
+ jfloat tilt_0,
+ jfloat tilt_1,
+ jfloat raw_pos_x,
+ jfloat raw_pos_y,
+ jint android_tool_type_0,
+ jint android_tool_type_1,
+ jint android_button_state,
+ jint android_meta_state) {
ui::MotionEventAndroid::Pointer pointer0(pointer_id_0,
pos_x_0,
pos_y_0,
diff --git a/blimp/client/android/blimp_view.h b/blimp/client/android/blimp_view.h
index 748199d..94270f8 100644
--- a/blimp/client/android/blimp_view.h
+++ b/blimp/client/android/blimp_view.h
@@ -39,45 +39,51 @@ class BlimpView {
RenderWidgetFeature* render_widget_feature);
// Methods called from Java via JNI.
- void Destroy(JNIEnv* env, jobject jobj);
- void SetNeedsComposite(JNIEnv* env, jobject jobj);
+ void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj);
+ void SetNeedsComposite(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj);
void OnSurfaceChanged(JNIEnv* env,
- jobject jobj,
+ const base::android::JavaParamRef<jobject>& jobj,
jint format,
jint width,
jint height,
- jobject jsurface);
- void OnSurfaceCreated(JNIEnv* env, jobject jobj);
- void OnSurfaceDestroyed(JNIEnv* env, jobject jobj);
- void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible);
- jboolean OnTouchEvent(JNIEnv* env,
- jobject obj,
- jobject motion_event,
- jlong time_ms,
- jint android_action,
- jint pointer_count,
- jint history_size,
- jint action_index,
- jfloat pos_x_0,
- jfloat pos_y_0,
- jfloat pos_x_1,
- jfloat pos_y_1,
- jint pointer_id_0,
- jint pointer_id_1,
- jfloat touch_major_0,
- jfloat touch_major_1,
- jfloat touch_minor_0,
- jfloat touch_minor_1,
- jfloat orientation_0,
- jfloat orientation_1,
- jfloat tilt_0,
- jfloat tilt_1,
- jfloat raw_pos_x,
- jfloat raw_pos_y,
- jint android_tool_type_0,
- jint android_tool_type_1,
- jint android_button_state,
- jint android_meta_state);
+ const base::android::JavaParamRef<jobject>& jsurface);
+ void OnSurfaceCreated(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj);
+ void OnSurfaceDestroyed(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj);
+ void SetVisibility(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj,
+ jboolean visible);
+ jboolean OnTouchEvent(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jobject>& motion_event,
+ jlong time_ms,
+ jint android_action,
+ jint pointer_count,
+ jint history_size,
+ jint action_index,
+ jfloat pos_x_0,
+ jfloat pos_y_0,
+ jfloat pos_x_1,
+ jfloat pos_y_1,
+ jint pointer_id_0,
+ jint pointer_id_1,
+ jfloat touch_major_0,
+ jfloat touch_major_1,
+ jfloat touch_minor_0,
+ jfloat touch_minor_1,
+ jfloat orientation_0,
+ jfloat orientation_1,
+ jfloat tilt_0,
+ jfloat tilt_1,
+ jfloat raw_pos_x,
+ jfloat raw_pos_y,
+ jint android_tool_type_0,
+ jint android_tool_type_1,
+ jint android_button_state,
+ jint android_meta_state);
private:
virtual ~BlimpView();
diff --git a/blimp/client/android/toolbar.cc b/blimp/client/android/toolbar.cc
index abb6962..4773105 100644
--- a/blimp/client/android/toolbar.cc
+++ b/blimp/client/android/toolbar.cc
@@ -48,24 +48,27 @@ Toolbar::~Toolbar() {
navigation_feature_->RemoveDelegate(kDummyTabId);
}
-void Toolbar::Destroy(JNIEnv* env, jobject jobj) {
+void Toolbar::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
delete this;
}
-void Toolbar::OnUrlTextEntered(JNIEnv* env, jobject jobj, jstring text) {
+void Toolbar::OnUrlTextEntered(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj,
+ const JavaParamRef<jstring>& text) {
navigation_feature_->NavigateToUrlText(
kDummyTabId, base::android::ConvertJavaStringToUTF8(env, text));
}
-void Toolbar::OnReloadPressed(JNIEnv* env, jobject jobj) {
+void Toolbar::OnReloadPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
navigation_feature_->Reload(kDummyTabId);
}
-void Toolbar::OnForwardPressed(JNIEnv* env, jobject jobj) {
+void Toolbar::OnForwardPressed(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
navigation_feature_->GoForward(kDummyTabId);
}
-jboolean Toolbar::OnBackPressed(JNIEnv* env, jobject jobj) {
+jboolean Toolbar::OnBackPressed(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj) {
navigation_feature_->GoBack(kDummyTabId);
// TODO(dtrainor): Find a way to determine whether or not we're at the end of
diff --git a/blimp/client/android/toolbar.h b/blimp/client/android/toolbar.h
index df4203b..209ebd2 100644
--- a/blimp/client/android/toolbar.h
+++ b/blimp/client/android/toolbar.h
@@ -26,11 +26,16 @@ class Toolbar : public NavigationFeature::NavigationFeatureDelegate {
NavigationFeature* navigation_feature);
// Methods called from Java via JNI.
- void Destroy(JNIEnv* env, jobject jobj);
- void OnUrlTextEntered(JNIEnv* env, jobject jobj, jstring text);
- void OnReloadPressed(JNIEnv* env, jobject jobj);
- void OnForwardPressed(JNIEnv* env, jobject jobj);
- jboolean OnBackPressed(JNIEnv* env, jobject jobj);
+ void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj);
+ void OnUrlTextEntered(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj,
+ const base::android::JavaParamRef<jstring>& text);
+ void OnReloadPressed(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj);
+ void OnForwardPressed(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj);
+ jboolean OnBackPressed(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj);
// NavigationFeatureDelegate implementation.
void OnUrlChanged(int tab_id, const GURL& url) override;
diff --git a/blimp/client/session/blimp_client_session_android.cc b/blimp/client/session/blimp_client_session_android.cc
index a877877..a33e54a 100644
--- a/blimp/client/session/blimp_client_session_android.cc
+++ b/blimp/client/session/blimp_client_session_android.cc
@@ -34,7 +34,8 @@ BlimpClientSessionAndroid::BlimpClientSessionAndroid(
BlimpClientSessionAndroid::~BlimpClientSessionAndroid() {}
-void BlimpClientSessionAndroid::Destroy(JNIEnv* env, jobject jobj) {
+void BlimpClientSessionAndroid::Destroy(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj) {
delete this;
}
diff --git a/blimp/client/session/blimp_client_session_android.h b/blimp/client/session/blimp_client_session_android.h
index fe552bf..e752f0b 100644
--- a/blimp/client/session/blimp_client_session_android.h
+++ b/blimp/client/session/blimp_client_session_android.h
@@ -20,7 +20,7 @@ class BlimpClientSessionAndroid : public BlimpClientSession {
const base::android::JavaParamRef<jobject>& jobj);
// Methods called from Java via JNI.
- void Destroy(JNIEnv* env, jobject jobj);
+ void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj);
private:
~BlimpClientSessionAndroid() override;
diff --git a/blimp/client/session/tab_control_feature_android.cc b/blimp/client/session/tab_control_feature_android.cc
index 20da386..6eb4937 100644
--- a/blimp/client/session/tab_control_feature_android.cc
+++ b/blimp/client/session/tab_control_feature_android.cc
@@ -39,15 +39,17 @@ TabControlFeatureAndroid::TabControlFeatureAndroid(
TabControlFeatureAndroid::~TabControlFeatureAndroid() {}
-void TabControlFeatureAndroid::Destroy(JNIEnv* env, jobject jobj) {
+void TabControlFeatureAndroid::Destroy(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj) {
delete this;
}
-void TabControlFeatureAndroid::OnContentAreaSizeChanged(JNIEnv* env,
- jobject jobj,
- jint width,
- jint height,
- jfloat dp_to_px) {
+void TabControlFeatureAndroid::OnContentAreaSizeChanged(
+ JNIEnv* env,
+ const JavaParamRef<jobject>& jobj,
+ jint width,
+ jint height,
+ jfloat dp_to_px) {
tab_control_feature_->SetSizeAndScale(gfx::Size(width, height), dp_to_px);
}
diff --git a/blimp/client/session/tab_control_feature_android.h b/blimp/client/session/tab_control_feature_android.h
index 81aa6c5..a7f4b5a 100644
--- a/blimp/client/session/tab_control_feature_android.h
+++ b/blimp/client/session/tab_control_feature_android.h
@@ -21,12 +21,13 @@ class TabControlFeatureAndroid {
TabControlFeature* tab_control_feature);
// Methods called from Java via JNI.
- void Destroy(JNIEnv* env, jobject jobj);
- void OnContentAreaSizeChanged(JNIEnv* env,
- jobject jobj,
- jint width,
- jint height,
- jfloat dp_to_px);
+ void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& jobj);
+ void OnContentAreaSizeChanged(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jobj,
+ jint width,
+ jint height,
+ jfloat dp_to_px);
private:
virtual ~TabControlFeatureAndroid();