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

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

Issue 10837330: Add a completion callback to gpuBenchmarking.beginSmoothScroll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: virtual and todo note 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
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 102 text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
103 can_compose_inline_(true), 103 can_compose_inline_(true),
104 popup_type_(popup_type), 104 popup_type_(popup_type),
105 pending_window_rect_count_(0), 105 pending_window_rect_count_(0),
106 suppress_next_char_events_(false), 106 suppress_next_char_events_(false),
107 is_accelerated_compositing_active_(false), 107 is_accelerated_compositing_active_(false),
108 animation_update_pending_(false), 108 animation_update_pending_(false),
109 invalidation_task_posted_(false), 109 invalidation_task_posted_(false),
110 screen_info_(screen_info), 110 screen_info_(screen_info),
111 device_scale_factor_(1), 111 device_scale_factor_(1),
112 throttle_input_events_(true) { 112 throttle_input_events_(true),
113 next_smooth_scroll_gesture_id_(0) {
113 if (!swapped_out) 114 if (!swapped_out)
114 RenderProcess::current()->AddRefProcess(); 115 RenderProcess::current()->AddRefProcess();
115 DCHECK(RenderThread::Get()); 116 DCHECK(RenderThread::Get());
116 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( 117 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
117 switches::kDisableGpuVsync); 118 switches::kDisableGpuVsync);
118 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) 119 #if defined(OS_CHROMEOS) || defined(OS_MACOSX)
119 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI; 120 device_scale_factor_ = screen_info.verticalDPI / kStandardDPI;
120 // 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
121 // is integral. 122 // is integral.
122 if (!CommandLine::ForCurrentProcess()->HasSwitch( 123 if (!CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) 241 IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck)
241 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, OnSwapBuffersComplete) 242 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, OnSwapBuffersComplete)
242 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) 243 IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent)
243 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) 244 IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost)
244 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) 245 IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus)
245 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) 246 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive)
246 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) 247 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition)
247 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) 248 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition)
248 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnMsgPaintAtSize) 249 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnMsgPaintAtSize)
249 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) 250 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint)
251 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted,
252 OnMsgSmoothScrollCompleted)
250 IPC_MESSAGE_HANDLER(ViewMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor) 253 IPC_MESSAGE_HANDLER(ViewMsg_SetDeviceScaleFactor, OnSetDeviceScaleFactor)
251 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) 254 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection)
252 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) 255 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck)
253 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged) 256 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged)
254 IPC_MESSAGE_UNHANDLED(handled = false) 257 IPC_MESSAGE_UNHANDLED(handled = false)
255 IPC_END_MESSAGE_MAP() 258 IPC_END_MESSAGE_MAP()
256 return handled; 259 return handled;
257 } 260 }
258 261
259 bool RenderWidget::Send(IPC::Message* message) { 262 bool RenderWidget::Send(IPC::Message* message) {
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 1527
1525 device_scale_factor_ = device_scale_factor; 1528 device_scale_factor_ = device_scale_factor;
1526 1529
1527 if (!is_accelerated_compositing_active_) { 1530 if (!is_accelerated_compositing_active_) {
1528 didInvalidateRect(gfx::Rect(size_.width(), size_.height())); 1531 didInvalidateRect(gfx::Rect(size_.width(), size_.height()));
1529 } else { 1532 } else {
1530 scheduleComposite(); 1533 scheduleComposite();
1531 } 1534 }
1532 } 1535 }
1533 1536
1537 void RenderWidget::OnMsgSmoothScrollCompleted(int gesture_id) {
1538 PendingSmoothScrollGestureMap::iterator it =
1539 pending_smooth_scroll_gestures_.find(gesture_id);
1540 DCHECK(it != pending_smooth_scroll_gestures_.end());
1541 it->second.Run();
1542 pending_smooth_scroll_gestures_.erase(it);
1543 }
1544
1534 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { 1545 void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
1535 if (!webwidget_) 1546 if (!webwidget_)
1536 return; 1547 return;
1537 webwidget_->setTextDirection(direction); 1548 webwidget_->setTextDirection(direction);
1538 } 1549 }
1539 1550
1540 void RenderWidget::OnScreenInfoChanged( 1551 void RenderWidget::OnScreenInfoChanged(
1541 const WebKit::WebScreenInfo& screen_info) { 1552 const WebKit::WebScreenInfo& screen_info) {
1542 screen_info_ = screen_info; 1553 screen_info_ = screen_info;
1543 } 1554 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 } 1800 }
1790 } 1801 }
1791 1802
1792 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const { 1803 void RenderWidget::GetRenderingStats(WebKit::WebRenderingStats& stats) const {
1793 webwidget()->renderingStats(stats); 1804 webwidget()->renderingStats(stats);
1794 stats.numAnimationFrames += software_stats_.numAnimationFrames; 1805 stats.numAnimationFrames += software_stats_.numAnimationFrames;
1795 stats.numFramesSentToScreen += software_stats_.numFramesSentToScreen; 1806 stats.numFramesSentToScreen += software_stats_.numFramesSentToScreen;
1796 stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds; 1807 stats.totalPaintTimeInSeconds += software_stats_.totalPaintTimeInSeconds;
1797 } 1808 }
1798 1809
1799 void RenderWidget::BeginSmoothScroll(bool down, bool scroll_far) { 1810 void RenderWidget::BeginSmoothScroll(
1800 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, down, scroll_far)); 1811 bool down,
1812 bool scroll_far,
1813 const SmoothScrollCompletionCallback& callback) {
1814 DCHECK(!callback.is_null());
1815 int id = next_smooth_scroll_gesture_id_++;
1816 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, id, down, scroll_far));
1817 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback));
1801 } 1818 }
1802 1819
1803 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1820 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1804 return false; 1821 return false;
1805 } 1822 }
1806 1823
1807 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1824 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1808 return false; 1825 return false;
1809 } 1826 }
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698