| OLD | NEW |
| 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 "blimp/client/app/android/blimp_view.h" | 5 #include "blimp/client/app/android/blimp_view.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 | 8 |
| 9 #include "blimp/client/app/android/blimp_client_session_android.h" | 9 #include "blimp/client/app/android/blimp_client_session_android.h" |
| 10 #include "blimp/client/app/compositor/browser_compositor.h" | 10 #include "blimp/client/app/compositor/browser_compositor.h" |
| 11 #include "jni/BlimpView_jni.h" | 11 #include "jni/BlimpView_jni.h" |
| 12 #include "ui/events/android/motion_event_android.h" | 12 #include "ui/events/android/motion_event_android.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 | 14 |
| 15 using base::android::JavaParamRef; | 15 using base::android::JavaParamRef; |
| 16 | 16 |
| 17 namespace blimp { | 17 namespace blimp { |
| 18 namespace client { | 18 namespace client { |
| 19 namespace app { |
| 19 | 20 |
| 20 static jlong Init(JNIEnv* env, | 21 static jlong Init(JNIEnv* env, |
| 21 const JavaParamRef<jobject>& jobj, | 22 const JavaParamRef<jobject>& jobj, |
| 22 const JavaParamRef<jobject>& blimp_client_session, | 23 const JavaParamRef<jobject>& blimp_client_session, |
| 23 jint real_width, | 24 jint real_width, |
| 24 jint real_height, | 25 jint real_height, |
| 25 jint width, | 26 jint width, |
| 26 jint height, | 27 jint height, |
| 27 jfloat dp_to_px) { | 28 jfloat dp_to_px) { |
| 28 BlimpClientSession* client_session = | 29 BlimpClientSession* client_session = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 // static | 42 // static |
| 42 bool BlimpView::RegisterJni(JNIEnv* env) { | 43 bool BlimpView::RegisterJni(JNIEnv* env) { |
| 43 return RegisterNativesImpl(env); | 44 return RegisterNativesImpl(env); |
| 44 } | 45 } |
| 45 | 46 |
| 46 BlimpView::BlimpView(JNIEnv* env, | 47 BlimpView::BlimpView(JNIEnv* env, |
| 47 const JavaParamRef<jobject>& jobj, | 48 const JavaParamRef<jobject>& jobj, |
| 48 const gfx::Size& real_size, | 49 const gfx::Size& real_size, |
| 49 const gfx::Size& size, | 50 const gfx::Size& size, |
| 50 float dp_to_px, | 51 float dp_to_px, |
| 51 RenderWidgetFeature* render_widget_feature) | 52 blimp::client::RenderWidgetFeature* render_widget_feature) |
| 52 : device_scale_factor_(dp_to_px), | 53 : device_scale_factor_(dp_to_px), |
| 53 compositor_(base::MakeUnique<BrowserCompositor>()), | 54 compositor_(base::MakeUnique<BrowserCompositor>()), |
| 54 current_surface_format_(0), | 55 current_surface_format_(0), |
| 55 window_(gfx::kNullAcceleratedWidget), | 56 window_(gfx::kNullAcceleratedWidget), |
| 56 weak_ptr_factory_(this) { | 57 weak_ptr_factory_(this) { |
| 57 compositor_manager_ = BlimpCompositorManagerAndroid::Create( | 58 compositor_manager_ = BlimpCompositorManagerAndroid::Create( |
| 58 real_size, size, render_widget_feature, | 59 real_size, size, render_widget_feature, |
| 59 BrowserCompositor::GetSurfaceManager(), | 60 BrowserCompositor::GetSurfaceManager(), |
| 60 BrowserCompositor::GetGpuMemoryBufferManager(), | 61 BrowserCompositor::GetGpuMemoryBufferManager(), |
| 61 base::Bind(&BrowserCompositor::AllocateSurfaceClientId)); | 62 base::Bind(&BrowserCompositor::AllocateSurfaceClientId)); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 pointer1); | 188 pointer1); |
| 188 | 189 |
| 189 return compositor_manager_->OnTouchEvent(event); | 190 return compositor_manager_->OnTouchEvent(event); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void BlimpView::OnSwapBuffersCompleted() { | 193 void BlimpView::OnSwapBuffersCompleted() { |
| 193 JNIEnv* env = base::android::AttachCurrentThread(); | 194 JNIEnv* env = base::android::AttachCurrentThread(); |
| 194 Java_BlimpView_onSwapBuffersCompleted(env, java_obj_); | 195 Java_BlimpView_onSwapBuffersCompleted(env, java_obj_); |
| 195 } | 196 } |
| 196 | 197 |
| 198 } // namespace app |
| 197 } // namespace client | 199 } // namespace client |
| 198 } // namespace blimp | 200 } // namespace blimp |
| OLD | NEW |