OLD | NEW |
---|---|
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 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3207 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( | 3207 void RenderWidgetHostViewAura::OnCompositingLockStateChanged( |
3208 ui::Compositor* compositor) { | 3208 ui::Compositor* compositor) { |
3209 // A compositor lock that is part of a resize lock timed out. We | 3209 // A compositor lock that is part of a resize lock timed out. We |
3210 // should display a renderer frame. | 3210 // should display a renderer frame. |
3211 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { | 3211 if (!compositor->IsLocked() && can_lock_compositor_ == YES_DID_LOCK) { |
3212 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; | 3212 can_lock_compositor_ = NO_PENDING_RENDERER_FRAME; |
3213 } | 3213 } |
3214 } | 3214 } |
3215 | 3215 |
3216 void RenderWidgetHostViewAura::OnUpdateVSyncParameters( | 3216 void RenderWidgetHostViewAura::OnUpdateVSyncParameters( |
3217 ui::Compositor* compositor, | |
3218 base::TimeTicks timebase, | 3217 base::TimeTicks timebase, |
3219 base::TimeDelta interval) { | 3218 base::TimeDelta interval) { |
3220 if (IsShowing()) { | 3219 if (IsShowing()) { |
3221 if (IsDeadlineSchedulingEnabled()) { | 3220 if (IsDeadlineSchedulingEnabled()) { |
3222 // The deadline scheduler has logic to stagger the draws of the | 3221 // The deadline scheduler has logic to stagger the draws of the |
3223 // Renderer and Browser built-in, so send it an accurate timebase. | 3222 // Renderer and Browser built-in, so send it an accurate timebase. |
3224 host_->UpdateVSyncParameters(timebase, interval); | 3223 host_->UpdateVSyncParameters(timebase, interval); |
3225 } else if (!last_draw_ended_.is_null()) { | 3224 } else if (!last_draw_ended_.is_null()) { |
3226 // For the non-deadline scheduler, we send the Renderer an offset | 3225 // For the non-deadline scheduler, we send the Renderer an offset |
3227 // vsync timebase to avoid its draws racing the Browser's draws. | 3226 // vsync timebase to avoid its draws racing the Browser's draws. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3504 cursor_client->AddObserver(this); | 3503 cursor_client->AddObserver(this); |
3505 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 3504 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
3506 } | 3505 } |
3507 if (current_surface_.get()) | 3506 if (current_surface_.get()) |
3508 UpdateExternalTexture(); | 3507 UpdateExternalTexture(); |
3509 if (HasFocus()) { | 3508 if (HasFocus()) { |
3510 ui::InputMethod* input_method = GetInputMethod(); | 3509 ui::InputMethod* input_method = GetInputMethod(); |
3511 if (input_method) | 3510 if (input_method) |
3512 input_method->SetFocusedTextInputClient(this); | 3511 input_method->SetFocusedTextInputClient(this); |
3513 } | 3512 } |
3513 | |
3514 ui::Compositor* compositor = GetCompositor(); | |
3515 if (compositor) | |
3516 compositor->vsync_manager()->AddObserver(this); | |
sheu
2014/02/04 03:23:21
Not sure where I should be adding and removing thi
piman
2014/02/04 04:51:01
This is I think the right place.
| |
3514 } | 3517 } |
3515 | 3518 |
3516 void RenderWidgetHostViewAura::RemovingFromRootWindow() { | 3519 void RenderWidgetHostViewAura::RemovingFromRootWindow() { |
3517 aura::client::CursorClient* cursor_client = | 3520 aura::client::CursorClient* cursor_client = |
3518 aura::client::GetCursorClient(window_->GetRootWindow()); | 3521 aura::client::GetCursorClient(window_->GetRootWindow()); |
3519 if (cursor_client) | 3522 if (cursor_client) |
3520 cursor_client->RemoveObserver(this); | 3523 cursor_client->RemoveObserver(this); |
3521 | 3524 |
3522 DetachFromInputMethod(); | 3525 DetachFromInputMethod(); |
3523 | 3526 |
3524 window_->GetDispatcher()->RemoveRootWindowObserver(this); | 3527 window_->GetDispatcher()->RemoveRootWindowObserver(this); |
3525 host_->ParentChanged(0); | 3528 host_->ParentChanged(0); |
3526 ui::Compositor* compositor = GetCompositor(); | 3529 ui::Compositor* compositor = GetCompositor(); |
3527 if (current_surface_.get()) { | 3530 if (current_surface_.get()) { |
3528 // We can't get notification for commits after this point, which would | 3531 // We can't get notification for commits after this point, which would |
3529 // guarantee that the compositor isn't using an old texture any more, so | 3532 // guarantee that the compositor isn't using an old texture any more, so |
3530 // instead we force the layer to stop using any external resources which | 3533 // instead we force the layer to stop using any external resources which |
3531 // synchronizes with the compositor thread, and makes it safe to run the | 3534 // synchronizes with the compositor thread, and makes it safe to run the |
3532 // callback. | 3535 // callback. |
3533 window_->layer()->SetShowPaintedContent(); | 3536 window_->layer()->SetShowPaintedContent(); |
3534 } | 3537 } |
3535 RunOnCommitCallbacks(); | 3538 RunOnCommitCallbacks(); |
3536 resize_lock_.reset(); | 3539 resize_lock_.reset(); |
3537 host_->WasResized(); | 3540 host_->WasResized(); |
3538 if (compositor && compositor->HasObserver(this)) | 3541 if (compositor) { |
3539 compositor->RemoveObserver(this); | 3542 if (compositor->HasObserver(this)) |
3543 compositor->RemoveObserver(this); | |
3544 compositor->vsync_manager()->RemoveObserver(this); | |
sheu
2014/02/04 03:23:21
See above.
piman
2014/02/04 04:51:01
Here too.
| |
3545 } | |
3540 } | 3546 } |
3541 | 3547 |
3542 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { | 3548 ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { |
3543 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); | 3549 aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); |
3544 return dispatcher ? dispatcher->host()->compositor() : NULL; | 3550 return dispatcher ? dispatcher->host()->compositor() : NULL; |
3545 } | 3551 } |
3546 | 3552 |
3547 void RenderWidgetHostViewAura::DetachFromInputMethod() { | 3553 void RenderWidgetHostViewAura::DetachFromInputMethod() { |
3548 ui::InputMethod* input_method = GetInputMethod(); | 3554 ui::InputMethod* input_method = GetInputMethod(); |
3549 if (input_method && input_method->GetTextInputClient() == this) | 3555 if (input_method && input_method->GetTextInputClient() == this) |
(...skipping 18 matching lines...) Expand all Loading... | |
3568 RenderWidgetHost* widget) { | 3574 RenderWidgetHost* widget) { |
3569 return new RenderWidgetHostViewAura(widget); | 3575 return new RenderWidgetHostViewAura(widget); |
3570 } | 3576 } |
3571 | 3577 |
3572 // static | 3578 // static |
3573 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3579 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3574 GetScreenInfoForWindow(results, NULL); | 3580 GetScreenInfoForWindow(results, NULL); |
3575 } | 3581 } |
3576 | 3582 |
3577 } // namespace content | 3583 } // namespace content |
OLD | NEW |