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

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

Issue 10692114: Fixes black flash when accelerated composited paints the tab background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 is_fullscreen_(false), 211 is_fullscreen_(false),
212 popup_parent_host_view_(NULL), 212 popup_parent_host_view_(NULL),
213 popup_child_host_view_(NULL), 213 popup_child_host_view_(NULL),
214 is_loading_(false), 214 is_loading_(false),
215 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 215 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
216 can_compose_inline_(true), 216 can_compose_inline_(true),
217 has_composition_text_(false), 217 has_composition_text_(false),
218 current_surface_(0), 218 current_surface_(0),
219 paint_canvas_(NULL), 219 paint_canvas_(NULL),
220 synthetic_move_sent_(false), 220 synthetic_move_sent_(false),
221 needs_update_texture_(false) { 221 accelerated_compositing_state_changed_(false) {
222 host_->SetView(this); 222 host_->SetView(this);
223 window_observer_.reset(new WindowObserver(this)); 223 window_observer_.reset(new WindowObserver(this));
224 window_->AddObserver(window_observer_.get()); 224 window_->AddObserver(window_observer_.get());
225 aura::client::SetTooltipText(window_, &tooltip_); 225 aura::client::SetTooltipText(window_, &tooltip_);
226 aura::client::SetActivationDelegate(window_, this); 226 aura::client::SetActivationDelegate(window_, this);
227 } 227 }
228 228
229 //////////////////////////////////////////////////////////////////////////////// 229 ////////////////////////////////////////////////////////////////////////////////
230 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 230 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
231 231
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 const std::vector<gfx::Rect>& character_bounds) { 372 const std::vector<gfx::Rect>& character_bounds) {
373 composition_character_bounds_ = character_bounds; 373 composition_character_bounds_ = character_bounds;
374 } 374 }
375 375
376 void RenderWidgetHostViewAura::DidUpdateBackingStore( 376 void RenderWidgetHostViewAura::DidUpdateBackingStore(
377 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, 377 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy,
378 const std::vector<gfx::Rect>& copy_rects) { 378 const std::vector<gfx::Rect>& copy_rects) {
379 if (!window_->IsVisible()) 379 if (!window_->IsVisible())
380 return; 380 return;
381 381
382 if (needs_update_texture_) 382 if (accelerated_compositing_state_changed_)
383 UpdateExternalTexture(); 383 UpdateExternalTexture();
384 384
385 gfx::Rect clip_rect; 385 gfx::Rect clip_rect;
386 if (paint_canvas_) { 386 if (paint_canvas_) {
387 SkRect sk_clip_rect; 387 SkRect sk_clip_rect;
388 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect)) 388 if (paint_canvas_->sk_canvas()->getClipBounds(&sk_clip_rect))
389 clip_rect = gfx::SkRectToRect(sk_clip_rect); 389 clip_rect = gfx::SkRectToRect(sk_clip_rect);
390 } 390 }
391 391
392 if (!scroll_rect.IsEmpty()) 392 if (!scroll_rect.IsEmpty())
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 output->getTopDevice()->accessBitmap(true).getPixels()); 470 output->getTopDevice()->accessBitmap(true).getPixels());
471 scoped_callback_runner.Release(); 471 scoped_callback_runner.Release();
472 gl_helper->CopyTextureTo(container->texture_id(), 472 gl_helper->CopyTextureTo(container->texture_id(),
473 container->size(), 473 container->size(),
474 size_in_pixel, 474 size_in_pixel,
475 addr, 475 addr,
476 callback); 476 callback);
477 } 477 }
478 478
479 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { 479 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() {
480 // Delay UpdateExternalTexture until we actually got a software frame. 480 // Delay processing the state change until we either get a software frame if
481 // switching to software mode or receive a buffers swapped notification
482 // if switching to accelerated mode.
481 // Sometimes (e.g. on a page load) the renderer will spuriously disable then 483 // Sometimes (e.g. on a page load) the renderer will spuriously disable then
482 // re-enable accelerated compositing, causing us to flash. 484 // re-enable accelerated compositing, causing us to flash.
483 // TODO(piman): factor the enable/disable accelerated compositing message into 485 // TODO(piman): factor the enable/disable accelerated compositing message into
484 // the UpdateRect/AcceleratedSurfaceBuffersSwapped messages so that we have 486 // the UpdateRect/AcceleratedSurfaceBuffersSwapped messages so that we have
485 // fewer inconsistent temporary states. 487 // fewer inconsistent temporary states.
486 needs_update_texture_ = true; 488 accelerated_compositing_state_changed_ = true;
487
488 // Don't scale the contents in accelerated mode because the renderer takes
489 // care of it.
490 window_->layer()->set_scale_content(
491 !host_->is_accelerated_compositing_active());
492 } 489 }
493 490
494 void RenderWidgetHostViewAura::UpdateExternalTexture() { 491 void RenderWidgetHostViewAura::UpdateExternalTexture() {
495 needs_update_texture_ = false; 492 // Delay processing accelerated compositing state change till here where we
493 // act upon the state change. (Clear the external texture if switching to
494 // software mode or set the external texture if going to accelerated mode).
495 if (accelerated_compositing_state_changed_) {
496 // Don't scale the contents in accelerated mode because the renderer takes
497 // care of it.
498 window_->layer()->set_scale_content(
499 !host_->is_accelerated_compositing_active());
500
501 accelerated_compositing_state_changed_ = false;
502 }
503
496 if (current_surface_ != 0 && 504 if (current_surface_ != 0 &&
497 host_->is_accelerated_compositing_active()) { 505 host_->is_accelerated_compositing_active()) {
498 ImageTransportClient* container = 506 ImageTransportClient* container =
499 image_transport_clients_[current_surface_]; 507 image_transport_clients_[current_surface_];
500 if (container) 508 if (container)
501 container->Update(); 509 container->Update();
502 window_->SetExternalTexture(container); 510 window_->SetExternalTexture(container);
503 511
504 released_front_lock_ = NULL; 512 released_front_lock_ = NULL;
505 513
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 1421 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
1414 RenderWidgetHost* widget) { 1422 RenderWidgetHost* widget) {
1415 return new RenderWidgetHostViewAura(widget); 1423 return new RenderWidgetHostViewAura(widget);
1416 } 1424 }
1417 1425
1418 // static 1426 // static
1419 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( 1427 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
1420 WebKit::WebScreenInfo* results) { 1428 WebKit::WebScreenInfo* results) {
1421 GetScreenInfoForWindow(results, NULL); 1429 GetScreenInfoForWindow(results, NULL);
1422 } 1430 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698