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

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

Issue 138903025: Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 287efe04 Rebase, oshima@ nits. Created 6 years, 10 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_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( 3222 void RenderWidgetHostViewAura::OnCompositingLockStateChanged(
3223 ui::Compositor* compositor) { 3223 ui::Compositor* compositor) {
3224 // A compositor lock that is part of a resize lock timed out. We 3224 // A compositor lock that is part of a resize lock timed out. We
3225 // should display a renderer frame. 3225 // should display a renderer frame.
3226 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { 3226 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) {
3227 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; 3227 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME;
3228 } 3228 }
3229 } 3229 }
3230 3230
3231 void RenderWidgetHostViewAura::OnUpdateVSyncParameters( 3231 void RenderWidgetHostViewAura::OnUpdateVSyncParameters(
3232 ui::Compositor* compositor,
3233 base::TimeTicks timebase, 3232 base::TimeTicks timebase,
3234 base::TimeDelta interval) { 3233 base::TimeDelta interval) {
3235 if (IsShowing()) { 3234 if (IsShowing()) {
3236 if (IsDeadlineSchedulingEnabled()) { 3235 if (IsDeadlineSchedulingEnabled()) {
3237 // The deadline scheduler has logic to stagger the draws of the 3236 // The deadline scheduler has logic to stagger the draws of the
3238 // Renderer and Browser built-in, so send it an accurate timebase. 3237 // Renderer and Browser built-in, so send it an accurate timebase.
3239 host_->UpdateVSyncParameters(timebase, interval); 3238 host_->UpdateVSyncParameters(timebase, interval);
3240 } else if (!last_draw_ended_.is_null()) { 3239 } else if (!last_draw_ended_.is_null()) {
3241 // For the non-deadline scheduler, we send the Renderer an offset 3240 // For the non-deadline scheduler, we send the Renderer an offset
3242 // vsync timebase to avoid its draws racing the Browser's draws. 3241 // vsync timebase to avoid its draws racing the Browser's draws.
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 input_method->SetFocusedTextInputClient(this); 3522 input_method->SetFocusedTextInputClient(this);
3524 } 3523 }
3525 3524
3526 #if defined(OS_WIN) 3525 #if defined(OS_WIN)
3527 // The parent may have changed here. Ensure that the legacy window is 3526 // The parent may have changed here. Ensure that the legacy window is
3528 // reparented accordingly. 3527 // reparented accordingly.
3529 if (legacy_render_widget_host_HWND_) 3528 if (legacy_render_widget_host_HWND_)
3530 legacy_render_widget_host_HWND_->UpdateParent( 3529 legacy_render_widget_host_HWND_->UpdateParent(
3531 reinterpret_cast<HWND>(GetNativeViewId())); 3530 reinterpret_cast<HWND>(GetNativeViewId()));
3532 #endif 3531 #endif
3532
3533 ui::Compositor* compositor = GetCompositor();
3534 if (compositor)
3535 compositor->vsync_manager()->AddObserver(this);
3533 } 3536 }
3534 3537
3535 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 3538 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
3536 aura::client::CursorClient* cursor_client = 3539 aura::client::CursorClient* cursor_client =
3537 aura::client::GetCursorClient(window_->GetRootWindow()); 3540 aura::client::GetCursorClient(window_->GetRootWindow());
3538 if (cursor_client) 3541 if (cursor_client)
3539 cursor_client->RemoveObserver(this); 3542 cursor_client->RemoveObserver(this);
3540 3543
3541 DetachFromInputMethod(); 3544 DetachFromInputMethod();
3542 3545
3543 window_->GetDispatcher()->RemoveRootWindowObserver(this); 3546 window_->GetDispatcher()->RemoveRootWindowObserver(this);
3544 ui::Compositor* compositor = GetCompositor(); 3547 ui::Compositor* compositor = GetCompositor();
3545 if (current_surface_.get()) { 3548 if (current_surface_.get()) {
3546 // We can't get notification for commits after this point, which would 3549 // We can't get notification for commits after this point, which would
3547 // guarantee that the compositor isn't using an old texture any more, so 3550 // guarantee that the compositor isn't using an old texture any more, so
3548 // instead we force the layer to stop using any external resources which 3551 // instead we force the layer to stop using any external resources which
3549 // synchronizes with the compositor thread, and makes it safe to run the 3552 // synchronizes with the compositor thread, and makes it safe to run the
3550 // callback. 3553 // callback.
3551 window_->layer()->SetShowPaintedContent(); 3554 window_->layer()->SetShowPaintedContent();
3552 } 3555 }
3553 RunOnCommitCallbacks(); 3556 RunOnCommitCallbacks();
3554 resize_lock_.reset(); 3557 resize_lock_.reset();
3555 host_->WasResized(); 3558 host_->WasResized();
3556 if (compositor && compositor->HasObserver(this)) 3559
3557 compositor->RemoveObserver(this); 3560 if (compositor) {
3561 if (compositor->HasObserver(this))
3562 compositor->RemoveObserver(this);
3563 compositor->vsync_manager()->RemoveObserver(this);
3564 }
3558 3565
3559 #if defined(OS_WIN) 3566 #if defined(OS_WIN)
3560 // Update the legacy window's parent temporarily to the desktop window. It 3567 // Update the legacy window's parent temporarily to the desktop window. It
3561 // will eventually get reparented to the right root. 3568 // will eventually get reparented to the right root.
3562 if (legacy_render_widget_host_HWND_) 3569 if (legacy_render_widget_host_HWND_)
3563 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); 3570 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
3564 #endif 3571 #endif
3565 } 3572 }
3566 3573
3567 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { 3574 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const {
(...skipping 25 matching lines...) Expand all
3593 RenderWidgetHost* widget) { 3600 RenderWidgetHost* widget) {
3594 return new RenderWidgetHostViewAura(widget); 3601 return new RenderWidgetHostViewAura(widget);
3595 } 3602 }
3596 3603
3597 // static 3604 // static
3598 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 3605 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
3599 GetScreenInfoForWindow(results, NULL); 3606 GetScreenInfoForWindow(results, NULL);
3600 } 3607 }
3601 3608
3602 } // namespace content 3609 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/renderer/gpu/compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698