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 "jni/BlimpView_jni.h" | 10 #include "jni/BlimpView_jni.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 BlimpClientSession* client_session = | 25 BlimpClientSession* client_session = |
26 BlimpClientSessionAndroid::FromJavaObject(env, | 26 BlimpClientSessionAndroid::FromJavaObject(env, |
27 blimp_client_session.obj()); | 27 blimp_client_session.obj()); |
28 | 28 |
29 // TODO(dtrainor): Pull the feature object from the BlimpClientSession and | 29 // TODO(dtrainor): Pull the feature object from the BlimpClientSession and |
30 // pass it through to the BlimpCompositor. | 30 // pass it through to the BlimpCompositor. |
31 ALLOW_UNUSED_LOCAL(client_session); | 31 ALLOW_UNUSED_LOCAL(client_session); |
32 | 32 |
33 return reinterpret_cast<intptr_t>(new BlimpView( | 33 return reinterpret_cast<intptr_t>(new BlimpView( |
34 env, jobj, gfx::Size(real_width, real_height), gfx::Size(width, height), | 34 env, jobj, gfx::Size(real_width, real_height), gfx::Size(width, height), |
35 dp_to_px, client_session->GetRenderWidgetFeature(), | 35 dp_to_px, client_session->GetRenderWidgetFeature())); |
36 client_session->GetBlimpConnectionStatistics())); | |
37 } | 36 } |
38 | 37 |
39 // static | 38 // static |
40 bool BlimpView::RegisterJni(JNIEnv* env) { | 39 bool BlimpView::RegisterJni(JNIEnv* env) { |
41 return RegisterNativesImpl(env); | 40 return RegisterNativesImpl(env); |
42 } | 41 } |
43 | 42 |
44 BlimpView::BlimpView(JNIEnv* env, | 43 BlimpView::BlimpView(JNIEnv* env, |
45 const JavaParamRef<jobject>& jobj, | 44 const JavaParamRef<jobject>& jobj, |
46 const gfx::Size& real_size, | 45 const gfx::Size& real_size, |
47 const gfx::Size& size, | 46 const gfx::Size& size, |
48 float dp_to_px, | 47 float dp_to_px, |
49 RenderWidgetFeature* render_widget_feature, | 48 RenderWidgetFeature* render_widget_feature) |
50 BlimpConnectionStatistics* blimp_connection_statistics) | |
51 : device_scale_factor_(dp_to_px), | 49 : device_scale_factor_(dp_to_px), |
52 compositor_manager_( | 50 compositor_manager_( |
53 BlimpCompositorManagerAndroid::Create(real_size, | 51 BlimpCompositorManagerAndroid::Create(real_size, |
54 size, | 52 size, |
55 render_widget_feature, | 53 render_widget_feature, |
56 this)), | 54 this)), |
57 current_surface_format_(0), | 55 current_surface_format_(0), |
58 window_(gfx::kNullAcceleratedWidget), | 56 window_(gfx::kNullAcceleratedWidget) { |
59 blimp_connection_statistics_(blimp_connection_statistics) { | |
60 java_obj_.Reset(env, jobj); | 57 java_obj_.Reset(env, jobj); |
61 } | 58 } |
62 | 59 |
63 BlimpView::~BlimpView() { | 60 BlimpView::~BlimpView() { |
64 ReleaseAcceleratedWidget(); | 61 ReleaseAcceleratedWidget(); |
65 } | 62 } |
66 | 63 |
67 void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 64 void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
68 delete this; | 65 delete this; |
69 } | 66 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 pointer1); | 173 pointer1); |
177 | 174 |
178 return compositor_manager_->OnTouchEvent(event); | 175 return compositor_manager_->OnTouchEvent(event); |
179 } | 176 } |
180 | 177 |
181 void BlimpView::OnSwapBuffersCompleted() { | 178 void BlimpView::OnSwapBuffersCompleted() { |
182 JNIEnv* env = base::android::AttachCurrentThread(); | 179 JNIEnv* env = base::android::AttachCurrentThread(); |
183 Java_BlimpView_onSwapBuffersCompleted(env, java_obj_.obj()); | 180 Java_BlimpView_onSwapBuffersCompleted(env, java_obj_.obj()); |
184 } | 181 } |
185 | 182 |
186 void BlimpView::DidCommitAndDrawFrame() { | |
187 DCHECK(blimp_connection_statistics_); | |
188 blimp_connection_statistics_->Add(BlimpConnectionStatistics::COMMIT, 1); | |
189 } | |
190 | |
191 } // namespace client | 183 } // namespace client |
192 } // namespace blimp | 184 } // namespace blimp |
OLD | NEW |