Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: content/browser/android/content_view_render_view.cc

Issue 2842693005: Store physical backing size in ViewAndroid (Closed)
Patch Set: no UpdateLayerBounds Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/android/content_view_render_view.h" 5 #include "content/browser/android/content_view_render_view.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 JNIEnv* env, 64 JNIEnv* env,
65 const JavaParamRef<jobject>& obj, 65 const JavaParamRef<jobject>& obj,
66 const JavaParamRef<jobject>& jweb_contents) { 66 const JavaParamRef<jobject>& jweb_contents) {
67 InitCompositor(); 67 InitCompositor();
68 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents); 68 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents);
69 compositor_->SetRootLayer(web_contents 69 compositor_->SetRootLayer(web_contents
70 ? web_contents->GetNativeView()->GetLayer() 70 ? web_contents->GetNativeView()->GetLayer()
71 : scoped_refptr<cc::Layer>()); 71 : scoped_refptr<cc::Layer>());
72 } 72 }
73 73
74 void ContentViewRenderView::OnPhysicalBackingSizeChanged(
75 JNIEnv* env,
76 const JavaParamRef<jobject>& obj,
77 const JavaParamRef<jobject>& jweb_contents,
78 jint width,
79 jint height) {
80 WebContents* web_contents = WebContents::FromJavaWebContents(jweb_contents);
81 gfx::Size size(width, height);
82 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size);
83 }
84
74 void ContentViewRenderView::SurfaceCreated(JNIEnv* env, 85 void ContentViewRenderView::SurfaceCreated(JNIEnv* env,
75 const JavaParamRef<jobject>& obj) { 86 const JavaParamRef<jobject>& obj) {
76 current_surface_format_ = 0; 87 current_surface_format_ = 0;
77 InitCompositor(); 88 InitCompositor();
78 } 89 }
79 90
80 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env, 91 void ContentViewRenderView::SurfaceDestroyed(JNIEnv* env,
81 const JavaParamRef<jobject>& obj) { 92 const JavaParamRef<jobject>& obj) {
82 compositor_->SetSurface(NULL); 93 compositor_->SetSurface(NULL);
83 current_surface_format_ = 0; 94 current_surface_format_ = 0;
(...skipping 30 matching lines...) Expand all
114 JNIEnv* env = base::android::AttachCurrentThread(); 125 JNIEnv* env = base::android::AttachCurrentThread();
115 Java_ContentViewRenderView_didSwapFrame(env, java_obj_); 126 Java_ContentViewRenderView_didSwapFrame(env, java_obj_);
116 } 127 }
117 128
118 void ContentViewRenderView::InitCompositor() { 129 void ContentViewRenderView::InitCompositor() {
119 if (!compositor_) 130 if (!compositor_)
120 compositor_.reset(Compositor::Create(this, root_window_)); 131 compositor_.reset(Compositor::Create(this, root_window_));
121 } 132 }
122 133
123 } // namespace content 134 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698