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

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

Issue 1016033006: Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable BeginFrame scheduling under flag Created 5 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/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 synthetic_move_sent_(false), 457 synthetic_move_sent_(false),
458 cursor_visibility_state_in_renderer_(UNKNOWN), 458 cursor_visibility_state_in_renderer_(UNKNOWN),
459 #if defined(OS_WIN) 459 #if defined(OS_WIN)
460 legacy_render_widget_host_HWND_(NULL), 460 legacy_render_widget_host_HWND_(NULL),
461 legacy_window_destroyed_(false), 461 legacy_window_destroyed_(false),
462 showing_context_menu_(false), 462 showing_context_menu_(false),
463 #endif 463 #endif
464 has_snapped_to_boundary_(false), 464 has_snapped_to_boundary_(false),
465 touch_editing_client_(NULL), 465 touch_editing_client_(NULL),
466 is_guest_view_hack_(is_guest_view_hack), 466 is_guest_view_hack_(is_guest_view_hack),
467 begin_frame_observer_proxy_(this),
467 weak_ptr_factory_(this) { 468 weak_ptr_factory_(this) {
468 if (!is_guest_view_hack_) 469 if (!is_guest_view_hack_)
469 host_->SetView(this); 470 host_->SetView(this);
470 471
471 window_observer_.reset(new WindowObserver(this)); 472 window_observer_.reset(new WindowObserver(this));
472 473
473 aura::client::SetTooltipText(window_, &tooltip_); 474 aura::client::SetTooltipText(window_, &tooltip_);
474 aura::client::SetActivationDelegate(window_, this); 475 aura::client::SetActivationDelegate(window_, this);
475 aura::client::SetFocusChangeObserver(window_, this); 476 aura::client::SetFocusChangeObserver(window_, this);
476 window_->set_layer_owner_delegate(delegated_frame_host_.get()); 477 window_->set_layer_owner_delegate(delegated_frame_host_.get());
477 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 478 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
478 479
479 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> 480 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()->
480 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 481 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
481 SetOverscrollControllerEnabled(overscroll_enabled); 482 SetOverscrollControllerEnabled(overscroll_enabled);
482 } 483 }
483 484
484 //////////////////////////////////////////////////////////////////////////////// 485 ////////////////////////////////////////////////////////////////////////////////
485 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 486 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
486 487
487 bool RenderWidgetHostViewAura::OnMessageReceived( 488 bool RenderWidgetHostViewAura::OnMessageReceived(
488 const IPC::Message& message) { 489 const IPC::Message& message) {
489 bool handled = true; 490 bool handled = true;
490 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) 491 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
491 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC 492 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC
492 // messages for TextInput<State|Type>Changed. Corresponding code in 493 // messages for TextInput<State|Type>Changed. Corresponding code in
493 // RenderWidgetHostViewAndroid should also be moved at the same time. 494 // RenderWidgetHostViewAndroid should also be moved at the same time.
494 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 495 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
495 OnTextInputStateChanged) 496 OnTextInputStateChanged)
497 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames,
498 OnSetNeedsBeginFrames)
496 IPC_MESSAGE_UNHANDLED(handled = false) 499 IPC_MESSAGE_UNHANDLED(handled = false)
497 IPC_END_MESSAGE_MAP() 500 IPC_END_MESSAGE_MAP()
498 return handled; 501 return handled;
499 } 502 }
500 503
501 void RenderWidgetHostViewAura::InitAsChild( 504 void RenderWidgetHostViewAura::InitAsChild(
502 gfx::NativeView parent_view) { 505 gfx::NativeView parent_view) {
503 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); 506 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
504 window_->Init(ui::LAYER_SOLID_COLOR); 507 window_->Init(ui::LAYER_SOLID_COLOR);
505 window_->SetName("RenderWidgetHostViewAura"); 508 window_->SetName("RenderWidgetHostViewAura");
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 #endif 718 #endif
716 719
717 NOTIMPLEMENTED(); 720 NOTIMPLEMENTED();
718 return static_cast<gfx::NativeViewAccessible>(NULL); 721 return static_cast<gfx::NativeViewAccessible>(NULL);
719 } 722 }
720 723
721 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { 724 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() {
722 return this; 725 return this;
723 } 726 }
724 727
728 void RenderWidgetHostViewAura::OnSetNeedsBeginFrames(bool needs_begin_frames) {
729 begin_frame_observer_proxy_.SetNeedsBeginFrames(needs_begin_frames);
730 }
731
732 void RenderWidgetHostViewAura::SendBeginFrame(const cc::BeginFrameArgs& args) {
733 delegated_frame_host_->SetVSyncParameters(args.frame_time, args.interval);
734 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args));
735 }
736
725 void RenderWidgetHostViewAura::SetKeyboardFocus() { 737 void RenderWidgetHostViewAura::SetKeyboardFocus() {
726 #if defined(OS_WIN) 738 #if defined(OS_WIN)
727 if (CanFocus()) { 739 if (CanFocus()) {
728 aura::WindowTreeHost* host = window_->GetHost(); 740 aura::WindowTreeHost* host = window_->GetHost();
729 if (host) 741 if (host)
730 ::SetFocus(host->GetAcceleratedWidget()); 742 ::SetFocus(host->GetAcceleratedWidget());
731 } 743 }
732 #endif 744 #endif
733 } 745 }
734 746
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 2655
2644 #if defined(OS_WIN) 2656 #if defined(OS_WIN)
2645 // The parent may have changed here. Ensure that the legacy window is 2657 // The parent may have changed here. Ensure that the legacy window is
2646 // reparented accordingly. 2658 // reparented accordingly.
2647 if (legacy_render_widget_host_HWND_) 2659 if (legacy_render_widget_host_HWND_)
2648 legacy_render_widget_host_HWND_->UpdateParent( 2660 legacy_render_widget_host_HWND_->UpdateParent(
2649 reinterpret_cast<HWND>(GetNativeViewId())); 2661 reinterpret_cast<HWND>(GetNativeViewId()));
2650 #endif 2662 #endif
2651 2663
2652 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor()); 2664 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor());
2665 if (window_->GetHost()->compositor())
2666 begin_frame_observer_proxy_.SetCompositor(window_->GetHost()->compositor());
2653 } 2667 }
2654 2668
2655 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 2669 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
2656 aura::client::CursorClient* cursor_client = 2670 aura::client::CursorClient* cursor_client =
2657 aura::client::GetCursorClient(window_->GetRootWindow()); 2671 aura::client::GetCursorClient(window_->GetRootWindow());
2658 if (cursor_client) 2672 if (cursor_client)
2659 cursor_client->RemoveObserver(this); 2673 cursor_client->RemoveObserver(this);
2660 2674
2661 DetachFromInputMethod(); 2675 DetachFromInputMethod();
2662 2676
2663 window_->GetHost()->RemoveObserver(this); 2677 window_->GetHost()->RemoveObserver(this);
2664 delegated_frame_host_->ResetCompositor(); 2678 delegated_frame_host_->ResetCompositor();
2679 begin_frame_observer_proxy_.ResetCompositor();
2665 2680
2666 #if defined(OS_WIN) 2681 #if defined(OS_WIN)
2667 // Update the legacy window's parent temporarily to the desktop window. It 2682 // Update the legacy window's parent temporarily to the desktop window. It
2668 // will eventually get reparented to the right root. 2683 // will eventually get reparented to the right root.
2669 if (legacy_render_widget_host_HWND_) 2684 if (legacy_render_widget_host_HWND_)
2670 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); 2685 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
2671 #endif 2686 #endif
2672 } 2687 }
2673 2688
2674 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2689 void RenderWidgetHostViewAura::DetachFromInputMethod() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 2800
2786 //////////////////////////////////////////////////////////////////////////////// 2801 ////////////////////////////////////////////////////////////////////////////////
2787 // RenderWidgetHostViewBase, public: 2802 // RenderWidgetHostViewBase, public:
2788 2803
2789 // static 2804 // static
2790 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2805 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2791 GetScreenInfoForWindow(results, NULL); 2806 GetScreenInfoForWindow(results, NULL);
2792 } 2807 }
2793 2808
2794 } // namespace content 2809 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698