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

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

Issue 1040813002: Revert of Enable BeginFrame scheduling on aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 "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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "ui/aura/env.h" 57 #include "ui/aura/env.h"
58 #include "ui/aura/window.h" 58 #include "ui/aura/window.h"
59 #include "ui/aura/window_event_dispatcher.h" 59 #include "ui/aura/window_event_dispatcher.h"
60 #include "ui/aura/window_observer.h" 60 #include "ui/aura/window_observer.h"
61 #include "ui/aura/window_tracker.h" 61 #include "ui/aura/window_tracker.h"
62 #include "ui/aura/window_tree_host.h" 62 #include "ui/aura/window_tree_host.h"
63 #include "ui/base/clipboard/scoped_clipboard_writer.h" 63 #include "ui/base/clipboard/scoped_clipboard_writer.h"
64 #include "ui/base/hit_test.h" 64 #include "ui/base/hit_test.h"
65 #include "ui/base/ime/input_method.h" 65 #include "ui/base/ime/input_method.h"
66 #include "ui/base/ui_base_types.h" 66 #include "ui/base/ui_base_types.h"
67 #include "ui/compositor/compositor_vsync_manager.h"
67 #include "ui/compositor/dip_util.h" 68 #include "ui/compositor/dip_util.h"
68 #include "ui/events/event.h" 69 #include "ui/events/event.h"
69 #include "ui/events/event_utils.h" 70 #include "ui/events/event_utils.h"
70 #include "ui/events/gestures/gesture_recognizer.h" 71 #include "ui/events/gestures/gesture_recognizer.h"
71 #include "ui/gfx/canvas.h" 72 #include "ui/gfx/canvas.h"
72 #include "ui/gfx/display.h" 73 #include "ui/gfx/display.h"
73 #include "ui/gfx/geometry/rect_conversions.h" 74 #include "ui/gfx/geometry/rect_conversions.h"
74 #include "ui/gfx/geometry/size_conversions.h" 75 #include "ui/gfx/geometry/size_conversions.h"
75 #include "ui/gfx/screen.h" 76 #include "ui/gfx/screen.h"
76 #include "ui/gfx/skia_util.h" 77 #include "ui/gfx/skia_util.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 paint_canvas_(NULL), 446 paint_canvas_(NULL),
446 synthetic_move_sent_(false), 447 synthetic_move_sent_(false),
447 cursor_visibility_state_in_renderer_(UNKNOWN), 448 cursor_visibility_state_in_renderer_(UNKNOWN),
448 #if defined(OS_WIN) 449 #if defined(OS_WIN)
449 legacy_render_widget_host_HWND_(NULL), 450 legacy_render_widget_host_HWND_(NULL),
450 legacy_window_destroyed_(false), 451 legacy_window_destroyed_(false),
451 #endif 452 #endif
452 has_snapped_to_boundary_(false), 453 has_snapped_to_boundary_(false),
453 touch_editing_client_(NULL), 454 touch_editing_client_(NULL),
454 is_guest_view_hack_(is_guest_view_hack), 455 is_guest_view_hack_(is_guest_view_hack),
455 begin_frame_observer_proxy_(this),
456 weak_ptr_factory_(this) { 456 weak_ptr_factory_(this) {
457 if (!is_guest_view_hack_) 457 if (!is_guest_view_hack_)
458 host_->SetView(this); 458 host_->SetView(this);
459 459
460 window_observer_.reset(new WindowObserver(this)); 460 window_observer_.reset(new WindowObserver(this));
461 aura::client::SetTooltipText(window_, &tooltip_); 461 aura::client::SetTooltipText(window_, &tooltip_);
462 aura::client::SetActivationDelegate(window_, this); 462 aura::client::SetActivationDelegate(window_, this);
463 aura::client::SetActivationChangeObserver(window_, this); 463 aura::client::SetActivationChangeObserver(window_, this);
464 aura::client::SetFocusChangeObserver(window_, this); 464 aura::client::SetFocusChangeObserver(window_, this);
465 window_->set_layer_owner_delegate(delegated_frame_host_.get()); 465 window_->set_layer_owner_delegate(delegated_frame_host_.get());
466 gfx::Screen::GetScreenFor(window_)->AddObserver(this); 466 gfx::Screen::GetScreenFor(window_)->AddObserver(this);
467 467
468 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()-> 468 bool overscroll_enabled = base::CommandLine::ForCurrentProcess()->
469 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; 469 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0";
470 SetOverscrollControllerEnabled(overscroll_enabled); 470 SetOverscrollControllerEnabled(overscroll_enabled);
471 } 471 }
472 472
473 //////////////////////////////////////////////////////////////////////////////// 473 ////////////////////////////////////////////////////////////////////////////////
474 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: 474 // RenderWidgetHostViewAura, RenderWidgetHostView implementation:
475 475
476 bool RenderWidgetHostViewAura::OnMessageReceived( 476 bool RenderWidgetHostViewAura::OnMessageReceived(
477 const IPC::Message& message) { 477 const IPC::Message& message) {
478 bool handled = true; 478 bool handled = true;
479 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message) 479 IPC_BEGIN_MESSAGE_MAP(RenderWidgetHostViewAura, message)
480 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC 480 // TODO(kevers): Move to RenderWidgetHostViewImpl and consolidate IPC
481 // messages for TextInput<State|Type>Changed. Corresponding code in 481 // messages for TextInput<State|Type>Changed. Corresponding code in
482 // RenderWidgetHostViewAndroid should also be moved at the same time. 482 // RenderWidgetHostViewAndroid should also be moved at the same time.
483 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 483 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
484 OnTextInputStateChanged) 484 OnTextInputStateChanged)
485 IPC_MESSAGE_HANDLER(ViewHostMsg_SetNeedsBeginFrames,
486 OnSetNeedsBeginFrames)
487 IPC_MESSAGE_UNHANDLED(handled = false) 485 IPC_MESSAGE_UNHANDLED(handled = false)
488 IPC_END_MESSAGE_MAP() 486 IPC_END_MESSAGE_MAP()
489 return handled; 487 return handled;
490 } 488 }
491 489
492 void RenderWidgetHostViewAura::InitAsChild( 490 void RenderWidgetHostViewAura::InitAsChild(
493 gfx::NativeView parent_view) { 491 gfx::NativeView parent_view) {
494 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); 492 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL);
495 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR); 493 window_->Init(aura::WINDOW_LAYER_SOLID_COLOR);
496 window_->SetName("RenderWidgetHostViewAura"); 494 window_->SetName("RenderWidgetHostViewAura");
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 #endif 704 #endif
707 705
708 NOTIMPLEMENTED(); 706 NOTIMPLEMENTED();
709 return static_cast<gfx::NativeViewAccessible>(NULL); 707 return static_cast<gfx::NativeViewAccessible>(NULL);
710 } 708 }
711 709
712 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { 710 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() {
713 return this; 711 return this;
714 } 712 }
715 713
716 void RenderWidgetHostViewAura::OnSetNeedsBeginFrames(bool needs_begin_frames) {
717 begin_frame_observer_proxy_.SetNeedsBeginFrames(needs_begin_frames);
718 }
719
720 void RenderWidgetHostViewAura::SendBeginFrame(const cc::BeginFrameArgs& args) {
721 delegated_frame_host_->SetVSyncParameters(args.frame_time, args.interval);
722 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args));
723 }
724
725 void RenderWidgetHostViewAura::SetKeyboardFocus() { 714 void RenderWidgetHostViewAura::SetKeyboardFocus() {
726 #if defined(OS_WIN) 715 #if defined(OS_WIN)
727 if (CanFocus()) { 716 if (CanFocus()) {
728 aura::WindowTreeHost* host = window_->GetHost(); 717 aura::WindowTreeHost* host = window_->GetHost();
729 if (host) 718 if (host)
730 ::SetFocus(host->GetAcceleratedWidget()); 719 ::SetFocus(host->GetAcceleratedWidget());
731 } 720 }
732 #endif 721 #endif
733 } 722 }
734 723
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 2572
2584 #if defined(OS_WIN) 2573 #if defined(OS_WIN)
2585 // The parent may have changed here. Ensure that the legacy window is 2574 // The parent may have changed here. Ensure that the legacy window is
2586 // reparented accordingly. 2575 // reparented accordingly.
2587 if (legacy_render_widget_host_HWND_) 2576 if (legacy_render_widget_host_HWND_)
2588 legacy_render_widget_host_HWND_->UpdateParent( 2577 legacy_render_widget_host_HWND_->UpdateParent(
2589 reinterpret_cast<HWND>(GetNativeViewId())); 2578 reinterpret_cast<HWND>(GetNativeViewId()));
2590 #endif 2579 #endif
2591 2580
2592 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor()); 2581 delegated_frame_host_->SetCompositor(window_->GetHost()->compositor());
2593 if (window_->GetHost()->compositor())
2594 begin_frame_observer_proxy_.SetCompositor(window_->GetHost()->compositor());
2595 } 2582 }
2596 2583
2597 void RenderWidgetHostViewAura::RemovingFromRootWindow() { 2584 void RenderWidgetHostViewAura::RemovingFromRootWindow() {
2598 aura::client::CursorClient* cursor_client = 2585 aura::client::CursorClient* cursor_client =
2599 aura::client::GetCursorClient(window_->GetRootWindow()); 2586 aura::client::GetCursorClient(window_->GetRootWindow());
2600 if (cursor_client) 2587 if (cursor_client)
2601 cursor_client->RemoveObserver(this); 2588 cursor_client->RemoveObserver(this);
2602 2589
2603 DetachFromInputMethod(); 2590 DetachFromInputMethod();
2604 2591
2605 window_->GetHost()->RemoveObserver(this); 2592 window_->GetHost()->RemoveObserver(this);
2606 delegated_frame_host_->ResetCompositor(); 2593 delegated_frame_host_->ResetCompositor();
2607 begin_frame_observer_proxy_.ResetCompositor();
2608 2594
2609 #if defined(OS_WIN) 2595 #if defined(OS_WIN)
2610 // Update the legacy window's parent temporarily to the desktop window. It 2596 // Update the legacy window's parent temporarily to the desktop window. It
2611 // will eventually get reparented to the right root. 2597 // will eventually get reparented to the right root.
2612 if (legacy_render_widget_host_HWND_) 2598 if (legacy_render_widget_host_HWND_)
2613 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow()); 2599 legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
2614 #endif 2600 #endif
2615 } 2601 }
2616 2602
2617 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2603 void RenderWidgetHostViewAura::DetachFromInputMethod() {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 int output_surface_id, 2695 int output_surface_id,
2710 const cc::CompositorFrameAck& ack) { 2696 const cc::CompositorFrameAck& ack) {
2711 host_->Send(new ViewMsg_ReclaimCompositorResources(host_->GetRoutingID(), 2697 host_->Send(new ViewMsg_ReclaimCompositorResources(host_->GetRoutingID(),
2712 output_surface_id, ack)); 2698 output_surface_id, ack));
2713 } 2699 }
2714 2700
2715 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { 2701 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() {
2716 host_->ScheduleComposite(); 2702 host_->ScheduleComposite();
2717 } 2703 }
2718 2704
2705 void RenderWidgetHostViewAura::DelegatedFrameHostUpdateVSyncParameters(
2706 const base::TimeTicks& timebase,
2707 const base::TimeDelta& interval) {
2708 host_->UpdateVSyncParameters(timebase, interval);
2709 }
2710
2719 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() { 2711 void RenderWidgetHostViewAura::OnDidNavigateMainFrameToNewPage() {
2720 ui::GestureRecognizer::Get()->CancelActiveTouches(window_); 2712 ui::GestureRecognizer::Get()->CancelActiveTouches(window_);
2721 } 2713 }
2722 2714
2723 //////////////////////////////////////////////////////////////////////////////// 2715 ////////////////////////////////////////////////////////////////////////////////
2724 // RenderWidgetHostViewBase, public: 2716 // RenderWidgetHostViewBase, public:
2725 2717
2726 // static 2718 // static
2727 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2719 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2728 GetScreenInfoForWindow(results, NULL); 2720 GetScreenInfoForWindow(results, NULL);
2729 } 2721 }
2730 2722
2731 } // namespace content 2723 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698