Chromium Code Reviews| Index: blimp/client/app/android/blimp_view.cc |
| diff --git a/blimp/client/app/android/blimp_view.cc b/blimp/client/app/android/blimp_view.cc |
| index 013c791a2c7533f67c414af209cc6fa5e913b776..02a9696d84362e67f84c524e1c88cb0507e67830 100644 |
| --- a/blimp/client/app/android/blimp_view.cc |
| +++ b/blimp/client/app/android/blimp_view.cc |
| @@ -7,6 +7,8 @@ |
| #include <android/native_window_jni.h> |
| #include "blimp/client/app/android/blimp_client_session_android.h" |
| +#include "blimp/client/core/contents/blimp_contents_impl.h" |
| +#include "blimp/client/core/render_widget/blimp_render_widget.h" |
| #include "jni/BlimpView_jni.h" |
| #include "ui/events/android/motion_event_android.h" |
| #include "ui/gfx/geometry/size.h" |
| @@ -51,15 +53,17 @@ BlimpView::BlimpView(JNIEnv* env, |
| RenderWidgetFeature* render_widget_feature, |
| BlimpConnectionStatistics* blimp_connection_statistics) |
| : device_scale_factor_(dp_to_px), |
| - compositor_manager_( |
| - BlimpCompositorManagerAndroid::Create(real_size, |
| - size, |
| - render_widget_feature, |
| - this)), |
| + blimp_contents_manager_(true, render_widget_feature), |
| current_surface_format_(0), |
| window_(gfx::kNullAcceleratedWidget), |
| - blimp_connection_statistics_(blimp_connection_statistics) { |
| + // blimp_connection_statistics_(blimp_connection_statistics), |
| + weak_ptr_factory_(this) { |
| java_obj_.Reset(env, jobj); |
| + |
| + blimp_contents_ = blimp_contents_manager_.CreateBlimpContents(); |
| + |
| + blimp_contents_->set_did_complete_swap_buffers_callback(base::Bind( |
| + &BlimpView::OnSwapBuffersCompleted, weak_ptr_factory_.GetWeakPtr())); |
| } |
| BlimpView::~BlimpView() { |
| @@ -86,8 +90,8 @@ void BlimpView::OnSurfaceChanged(JNIEnv* env, |
| if (jsurface) { |
| base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
| window_ = ANativeWindow_fromSurface(env, jsurface); |
| - compositor_manager_->SetAcceleratedWidget(window_); |
| - compositor_manager_->SetVisible(true); |
| + blimp_contents_->SetAcceleratedWidget(window_); |
| + blimp_contents_->SetVisible(true); |
| } |
| } |
| } |
| @@ -106,14 +110,14 @@ void BlimpView::OnSurfaceDestroyed(JNIEnv* env, |
| void BlimpView::SetVisibility(JNIEnv* env, |
| const JavaParamRef<jobject>& jobj, |
| jboolean visible) { |
| - compositor_manager_->SetVisible(visible); |
| + blimp_contents_->SetVisible(visible); |
| } |
| void BlimpView::ReleaseAcceleratedWidget() { |
| if (window_ == gfx::kNullAcceleratedWidget) |
| return; |
| - compositor_manager_->ReleaseAcceleratedWidget(); |
| + blimp_contents_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| ANativeWindow_release(window_); |
| window_ = gfx::kNullAcceleratedWidget; |
| } |
| @@ -177,7 +181,10 @@ jboolean BlimpView::OnTouchEvent(JNIEnv* env, |
| pointer0, |
| pointer1); |
| - return compositor_manager_->OnTouchEvent(event); |
| + if (blimp_contents_->GetActiveWidget()) |
| + return blimp_contents_->GetActiveWidget()->OnTouchEvent(event); |
|
nyquist
2016/08/12 07:34:28
Opposite of //cc, where curly brackets are ... "op
Khushal
2016/08/13 00:03:21
Done.
You know I'm in that land most of the time.
|
| + |
| + return false; |
| } |
| void BlimpView::OnSwapBuffersCompleted() { |
| @@ -185,10 +192,5 @@ void BlimpView::OnSwapBuffersCompleted() { |
| Java_BlimpView_onSwapBuffersCompleted(env, java_obj_.obj()); |
| } |
| -void BlimpView::DidCommitAndDrawFrame() { |
| - DCHECK(blimp_connection_statistics_); |
| - blimp_connection_statistics_->Add(BlimpConnectionStatistics::COMMIT, 1); |
| -} |
| - |
| } // namespace client |
| } // namespace blimp |