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

Side by Side Diff: content/renderer/render_widget.cc

Issue 10826189: Allow disabling input throttle through RendererPreference (for Browser Plugin guests) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 using WebKit::WebTextDirection; 69 using WebKit::WebTextDirection;
70 using WebKit::WebTouchEvent; 70 using WebKit::WebTouchEvent;
71 using WebKit::WebVector; 71 using WebKit::WebVector;
72 using WebKit::WebWidget; 72 using WebKit::WebWidget;
73 using content::RenderThread; 73 using content::RenderThread;
74 74
75 static const float kStandardDPI = 160; 75 static const float kStandardDPI = 160;
76 76
77 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, 77 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
78 const WebKit::WebScreenInfo& screen_info, 78 const WebKit::WebScreenInfo& screen_info,
79 bool swapped_out) 79 bool swapped_out,
80 bool disable_input_throttle)
80 : routing_id_(MSG_ROUTING_NONE), 81 : routing_id_(MSG_ROUTING_NONE),
81 surface_id_(0), 82 surface_id_(0),
82 webwidget_(NULL), 83 webwidget_(NULL),
83 opener_id_(MSG_ROUTING_NONE), 84 opener_id_(MSG_ROUTING_NONE),
84 host_window_(0), 85 host_window_(0),
85 host_window_set_(false), 86 host_window_set_(false),
86 current_paint_buf_(NULL), 87 current_paint_buf_(NULL),
87 next_paint_flags_(0), 88 next_paint_flags_(0),
88 filtered_time_per_frame_(0.0f), 89 filtered_time_per_frame_(0.0f),
89 update_reply_pending_(false), 90 update_reply_pending_(false),
(...skipping 11 matching lines...) Expand all
101 input_method_is_active_(false), 102 input_method_is_active_(false),
102 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 103 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
103 can_compose_inline_(true), 104 can_compose_inline_(true),
104 popup_type_(popup_type), 105 popup_type_(popup_type),
105 pending_window_rect_count_(0), 106 pending_window_rect_count_(0),
106 suppress_next_char_events_(false), 107 suppress_next_char_events_(false),
107 is_accelerated_compositing_active_(false), 108 is_accelerated_compositing_active_(false),
108 animation_update_pending_(false), 109 animation_update_pending_(false),
109 invalidation_task_posted_(false), 110 invalidation_task_posted_(false),
110 screen_info_(screen_info), 111 screen_info_(screen_info),
111 device_scale_factor_(1) { 112 device_scale_factor_(1),
113 disable_input_throttle_(disable_input_throttle) {
112 if (!swapped_out) 114 if (!swapped_out)
113 RenderProcess::current()->AddRefProcess(); 115 RenderProcess::current()->AddRefProcess();
114 DCHECK(RenderThread::Get()); 116 DCHECK(RenderThread::Get());
115 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( 117 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
116 switches::kDisableGpuVsync); 118 switches::kDisableGpuVsync);
117 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) 119 #if defined(OS_CHROMEOS) || defined(OS_MACOSX)
118 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; 120 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI;
119 // Unless an explicit scale factor was provided for testing, ensure the scale 121 // Unless an explicit scale factor was provided for testing, ensure the scale
120 // is integral. 122 // is integral.
121 if (!CommandLine::ForCurrentProcess()->HasSwitch( 123 if (!CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 14 matching lines...) Expand all
136 if (!is_swapped_out_) 138 if (!is_swapped_out_)
137 RenderProcess::current()->ReleaseProcess(); 139 RenderProcess::current()->ReleaseProcess();
138 } 140 }
139 141
140 // static 142 // static
141 RenderWidget* RenderWidget::Create(int32 opener_id, 143 RenderWidget* RenderWidget::Create(int32 opener_id,
142 WebKit::WebPopupType popup_type, 144 WebKit::WebPopupType popup_type,
143 const WebKit::WebScreenInfo& screen_info) { 145 const WebKit::WebScreenInfo& screen_info) {
144 DCHECK(opener_id != MSG_ROUTING_NONE); 146 DCHECK(opener_id != MSG_ROUTING_NONE);
145 scoped_refptr<RenderWidget> widget( 147 scoped_refptr<RenderWidget> widget(
146 new RenderWidget(popup_type, screen_info, false)); 148 new RenderWidget(popup_type, screen_info, false, false));
darin (slow to review) 2012/08/07 21:54:39 nit: it is unfortunate to have methods with lists
Fady Samuel 2012/08/07 22:17:22 Done.
147 widget->Init(opener_id); // adds reference 149 widget->Init(opener_id); // adds reference
148 return widget; 150 return widget;
149 } 151 }
150 152
151 // static 153 // static
152 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { 154 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) {
153 switch (render_widget->popup_type_) { 155 switch (render_widget->popup_type_) {
154 case WebKit::WebPopupTypeNone: // Nothing to create. 156 case WebKit::WebPopupTypeNone: // Nothing to create.
155 break; 157 break;
156 case WebKit::WebPopupTypeSelect: 158 case WebKit::WebPopupTypeSelect:
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 suppress_next_char_events_ = true; 578 suppress_next_char_events_ = true;
577 579
578 IPC::Message* response = 580 IPC::Message* response =
579 new ViewHostMsg_HandleInputEvent_ACK(routing_id_, input_event->type, 581 new ViewHostMsg_HandleInputEvent_ACK(routing_id_, input_event->type,
580 processed); 582 processed);
581 bool event_type_gets_rate_limited = 583 bool event_type_gets_rate_limited =
582 input_event->type == WebInputEvent::MouseMove || 584 input_event->type == WebInputEvent::MouseMove ||
583 input_event->type == WebInputEvent::MouseWheel || 585 input_event->type == WebInputEvent::MouseWheel ||
584 WebInputEvent::isTouchEventType(input_event->type); 586 WebInputEvent::isTouchEventType(input_event->type);
585 bool is_input_throttled = 587 bool is_input_throttled =
586 (webwidget_ ? webwidget_->isInputThrottled() : false) || 588 !disable_input_throttle_ &&
587 paint_aggregator_.HasPendingUpdate(); 589 ((webwidget_ ? webwidget_->isInputThrottled() : false) ||
590 paint_aggregator_.HasPendingUpdate());
588 591
589 if (event_type_gets_rate_limited && is_input_throttled && !is_hidden_) { 592 if (event_type_gets_rate_limited && is_input_throttled && !is_hidden_) {
590 // We want to rate limit the input events in this case, so we'll wait for 593 // We want to rate limit the input events in this case, so we'll wait for
591 // painting to finish before ACKing this message. 594 // painting to finish before ACKing this message.
592 if (pending_input_event_ack_.get()) { 595 if (pending_input_event_ack_.get()) {
593 // As two different kinds of events could cause us to postpone an ack 596 // As two different kinds of events could cause us to postpone an ack
594 // we send it now, if we have one pending. The Browser should never 597 // we send it now, if we have one pending. The Browser should never
595 // send us the same kind of event we are delaying the ack for. 598 // send us the same kind of event we are delaying the ack for.
596 Send(pending_input_event_ack_.release()); 599 Send(pending_input_event_ack_.release());
597 } 600 }
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); 1796 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far));
1794 } 1797 }
1795 1798
1796 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1799 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1797 return false; 1800 return false;
1798 } 1801 }
1799 1802
1800 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1803 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1801 return false; 1804 return false;
1802 } 1805 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698