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

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

Issue 2401863003: Move synthetic gesture input to be aligned with BeginFrame. (Closed)
Patch Set: Created 4 years, 2 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 in_shutdown_(false), 433 in_shutdown_(false),
434 in_bounds_changed_(false), 434 in_bounds_changed_(false),
435 is_fullscreen_(false), 435 is_fullscreen_(false),
436 popup_parent_host_view_(nullptr), 436 popup_parent_host_view_(nullptr),
437 popup_child_host_view_(nullptr), 437 popup_child_host_view_(nullptr),
438 is_loading_(false), 438 is_loading_(false),
439 has_composition_text_(false), 439 has_composition_text_(false),
440 accept_return_character_(false), 440 accept_return_character_(false),
441 begin_frame_source_(nullptr), 441 begin_frame_source_(nullptr),
442 needs_begin_frames_(false), 442 needs_begin_frames_(false),
443 needs_flush_input_(false),
443 added_frame_observer_(false), 444 added_frame_observer_(false),
444 synthetic_move_sent_(false), 445 synthetic_move_sent_(false),
445 cursor_visibility_state_in_renderer_(UNKNOWN), 446 cursor_visibility_state_in_renderer_(UNKNOWN),
446 #if defined(OS_WIN) 447 #if defined(OS_WIN)
447 legacy_render_widget_host_HWND_(nullptr), 448 legacy_render_widget_host_HWND_(nullptr),
448 legacy_window_destroyed_(false), 449 legacy_window_destroyed_(false),
449 virtual_keyboard_requested_(false), 450 virtual_keyboard_requested_(false),
450 #endif 451 #endif
451 has_snapped_to_boundary_(false), 452 has_snapped_to_boundary_(false),
452 is_guest_view_hack_(is_guest_view_hack), 453 is_guest_view_hack_(is_guest_view_hack),
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 723
723 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { 724 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() {
724 return this; 725 return this;
725 } 726 }
726 727
727 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) { 728 void RenderWidgetHostViewAura::SetNeedsBeginFrames(bool needs_begin_frames) {
728 needs_begin_frames_ = needs_begin_frames; 729 needs_begin_frames_ = needs_begin_frames;
729 UpdateNeedsBeginFramesInternal(); 730 UpdateNeedsBeginFramesInternal();
730 } 731 }
731 732
733 void RenderWidgetHostViewAura::OnSetNeedsFlushInput() {
734 needs_flush_input_ = true;
735 UpdateNeedsBeginFramesInternal();
736 }
737
732 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { 738 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
733 if (!begin_frame_source_) 739 if (!begin_frame_source_)
734 return; 740 return;
735 741
736 if (added_frame_observer_ == needs_begin_frames_) 742 bool needs_frame = needs_begin_frames_ || needs_flush_input_;
743 if (needs_frame == added_frame_observer_)
737 return; 744 return;
738 745
739 if (needs_begin_frames_) 746 added_frame_observer_ = needs_frame;
747 if (needs_frame)
740 begin_frame_source_->AddObserver(this); 748 begin_frame_source_->AddObserver(this);
741 else 749 else
742 begin_frame_source_->RemoveObserver(this); 750 begin_frame_source_->RemoveObserver(this);
743 added_frame_observer_ = needs_begin_frames_;
744 } 751 }
745 752
746 void RenderWidgetHostViewAura::OnBeginFrame( 753 void RenderWidgetHostViewAura::OnBeginFrame(
747 const cc::BeginFrameArgs& args) { 754 const cc::BeginFrameArgs& args) {
755 needs_flush_input_ = false;
756 host_->FlushInput();
757 UpdateNeedsBeginFramesInternal();
748 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args)); 758 host_->Send(new ViewMsg_BeginFrame(host_->GetRoutingID(), args));
749 last_begin_frame_args_ = args; 759 last_begin_frame_args_ = args;
750 } 760 }
751 761
752 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs() 762 const cc::BeginFrameArgs& RenderWidgetHostViewAura::LastUsedBeginFrameArgs()
753 const { 763 const {
754 return last_begin_frame_args_; 764 return last_begin_frame_args_;
755 } 765 }
756 766
757 void RenderWidgetHostViewAura::OnBeginFrameSourcePausedChanged(bool paused) { 767 void RenderWidgetHostViewAura::OnBeginFrameSourcePausedChanged(bool paused) {
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 ->GetTextSelection(focused_view) 3074 ->GetTextSelection(focused_view)
3065 ->GetSelectedText(&selected_text)) { 3075 ->GetSelectedText(&selected_text)) {
3066 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. 3076 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
3067 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); 3077 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION);
3068 clipboard_writer.WriteText(selected_text); 3078 clipboard_writer.WriteText(selected_text);
3069 } 3079 }
3070 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 3080 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
3071 } 3081 }
3072 3082
3073 } // namespace content 3083 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698