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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 24101003: Make the RenderViewHostImpl update its visibility after a swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add null check around the compositor. Created 7 years, 3 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 | Annotate | Revision Log
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/renderer_host/render_widget_host_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 RenderWidgetHostView* reference_host_view) { 192 RenderWidgetHostView* reference_host_view) {
193 NOTIMPLEMENTED(); 193 NOTIMPLEMENTED();
194 } 194 }
195 195
196 RenderWidgetHost* 196 RenderWidgetHost*
197 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { 197 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const {
198 return host_; 198 return host_;
199 } 199 }
200 200
201 void RenderWidgetHostViewAndroid::WasShown() { 201 void RenderWidgetHostViewAndroid::WasShown() {
202 if (!host_->is_hidden()) 202 if (!host_ || !host_->is_hidden())
piman 2013/09/20 16:51:30 host_ is only reset right before |this| is destroy
203 return; 203 return;
204 204
205 host_->WasShown(); 205 host_->WasShown();
206 } 206 }
207 207
208 void RenderWidgetHostViewAndroid::WasHidden() { 208 void RenderWidgetHostViewAndroid::WasHidden() {
209 RunAckCallbacks(); 209 RunAckCallbacks();
210 210
211 if (host_->is_hidden()) 211 if (!host_ || host_->is_hidden())
212 return; 212 return;
213 213
214 // Inform the renderer that we are being hidden so it can reduce its resource 214 // Inform the renderer that we are being hidden so it can reduce its resource
215 // utilization. 215 // utilization.
216 host_->WasHidden(); 216 host_->WasHidden();
217 } 217 }
218 218
219 void RenderWidgetHostViewAndroid::WasResized() { 219 void RenderWidgetHostViewAndroid::WasResized() {
220 if (surface_texture_transport_.get() && content_view_core_) 220 if (surface_texture_transport_.get() && content_view_core_)
221 surface_texture_transport_->SetSize( 221 surface_texture_transport_->SetSize(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { 349 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const {
350 return HasValidFrame(); 350 return HasValidFrame();
351 } 351 }
352 352
353 void RenderWidgetHostViewAndroid::Show() { 353 void RenderWidgetHostViewAndroid::Show() {
354 if (are_layers_attached_) 354 if (are_layers_attached_)
355 return; 355 return;
356 356
357 are_layers_attached_ = true; 357 are_layers_attached_ = true;
358 AttachLayers(); 358 AttachLayers();
359
360 WasShown();
359 } 361 }
360 362
361 void RenderWidgetHostViewAndroid::Hide() { 363 void RenderWidgetHostViewAndroid::Hide() {
362 if (!are_layers_attached_) 364 if (!are_layers_attached_)
363 return; 365 return;
364 366
365 are_layers_attached_ = false; 367 are_layers_attached_ = false;
366 RemoveLayers(); 368 RemoveLayers();
369
370 WasHidden();
367 } 371 }
368 372
369 bool RenderWidgetHostViewAndroid::IsShowing() { 373 bool RenderWidgetHostViewAndroid::IsShowing() {
370 // ContentViewCoreImpl represents the native side of the Java 374 // ContentViewCoreImpl represents the native side of the Java
371 // ContentViewCore. It being NULL means that it is not attached 375 // ContentViewCore. It being NULL means that it is not attached
372 // to the View system yet, so we treat this RWHVA as hidden. 376 // to the View system yet, so we treat this RWHVA as hidden.
373 return are_layers_attached_ && content_view_core_; 377 return are_layers_attached_ && content_view_core_;
374 } 378 }
375 379
376 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const { 380 gfx::Rect RenderWidgetHostViewAndroid::GetViewBounds() const {
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 // RenderWidgetHostView, public: 1311 // RenderWidgetHostView, public:
1308 1312
1309 // static 1313 // static
1310 RenderWidgetHostView* 1314 RenderWidgetHostView*
1311 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 1315 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
1312 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 1316 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
1313 return new RenderWidgetHostViewAndroid(rwhi, NULL); 1317 return new RenderWidgetHostViewAndroid(rwhi, NULL);
1314 } 1318 }
1315 1319
1316 } // namespace content 1320 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698