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

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

Issue 11858007: Splits SmoothGestureController from RenderWidgetHostImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds missing ifdef for aura Created 7 years, 8 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') | tools/telemetry/telemetry/page/actions/scroll.js » ('j') | 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 can_compose_inline_(true), 164 can_compose_inline_(true),
165 popup_type_(popup_type), 165 popup_type_(popup_type),
166 pending_window_rect_count_(0), 166 pending_window_rect_count_(0),
167 suppress_next_char_events_(false), 167 suppress_next_char_events_(false),
168 is_accelerated_compositing_active_(false), 168 is_accelerated_compositing_active_(false),
169 animation_update_pending_(false), 169 animation_update_pending_(false),
170 invalidation_task_posted_(false), 170 invalidation_task_posted_(false),
171 screen_info_(screen_info), 171 screen_info_(screen_info),
172 device_scale_factor_(screen_info_.deviceScaleFactor), 172 device_scale_factor_(screen_info_.deviceScaleFactor),
173 throttle_input_events_(true), 173 throttle_input_events_(true),
174 next_smooth_scroll_gesture_id_(0),
175 is_threaded_compositing_enabled_(false), 174 is_threaded_compositing_enabled_(false),
176 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 175 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
177 if (!swapped_out) 176 if (!swapped_out)
178 RenderProcess::current()->AddRefProcess(); 177 RenderProcess::current()->AddRefProcess();
179 DCHECK(RenderThread::Get()); 178 DCHECK(RenderThread::Get());
180 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch( 179 has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
181 switches::kDisableGpuVsync); 180 switches::kDisableGpuVsync);
182 is_threaded_compositing_enabled_ = 181 is_threaded_compositing_enabled_ =
183 CommandLine::ForCurrentProcess()->HasSwitch( 182 CommandLine::ForCurrentProcess()->HasSwitch(
184 switches::kEnableThreadedCompositing); 183 switches::kEnableThreadedCompositing);
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 if (is_accelerated_compositing_active_) { 1882 if (is_accelerated_compositing_active_) {
1884 if (compositor_) 1883 if (compositor_)
1885 compositor_->setNeedsRedraw(); 1884 compositor_->setNeedsRedraw();
1886 scheduleComposite(); 1885 scheduleComposite();
1887 } else { 1886 } else {
1888 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); 1887 gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height());
1889 didInvalidateRect(repaint_rect); 1888 didInvalidateRect(repaint_rect);
1890 } 1889 }
1891 } 1890 }
1892 1891
1893 void RenderWidget::OnSmoothScrollCompleted(int gesture_id) { 1892 void RenderWidget::OnSmoothScrollCompleted() {
1894 PendingSmoothScrollGestureMap::iterator it = 1893 pending_smooth_scroll_gesture_.Run();
1895 pending_smooth_scroll_gestures_.find(gesture_id);
1896 DCHECK(it != pending_smooth_scroll_gestures_.end());
1897 it->second.Run();
1898 pending_smooth_scroll_gestures_.erase(it);
1899 } 1894 }
1900 1895
1901 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { 1896 void RenderWidget::OnSetTextDirection(WebTextDirection direction) {
1902 if (!webwidget_) 1897 if (!webwidget_)
1903 return; 1898 return;
1904 webwidget_->setTextDirection(direction); 1899 webwidget_->setTextDirection(direction);
1905 } 1900 }
1906 1901
1907 void RenderWidget::OnScreenInfoChanged( 1902 void RenderWidget::OnScreenInfoChanged(
1908 const WebKit::WebScreenInfo& screen_info) { 1903 const WebKit::WebScreenInfo& screen_info) {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 } 2253 }
2259 2254
2260 bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const { 2255 bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const {
2261 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); 2256 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel();
2262 if (!gpu_channel) 2257 if (!gpu_channel)
2263 return false; 2258 return false;
2264 2259
2265 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats); 2260 return gpu_channel->CollectRenderingStatsForSurface(surface_id(), stats);
2266 } 2261 }
2267 2262
2268 void RenderWidget::BeginSmoothScroll( 2263 bool RenderWidget::BeginSmoothScroll(
2269 bool down, 2264 bool down,
2270 const SmoothScrollCompletionCallback& callback, 2265 const SmoothScrollCompletionCallback& callback,
2271 int pixels_to_scroll, 2266 int pixels_to_scroll,
2272 int mouse_event_x, 2267 int mouse_event_x,
2273 int mouse_event_y) { 2268 int mouse_event_y) {
2274 DCHECK(!callback.is_null()); 2269 DCHECK(!callback.is_null());
2275 int id = next_smooth_scroll_gesture_id_++;
2276 2270
2277 ViewHostMsg_BeginSmoothScroll_Params params; 2271 ViewHostMsg_BeginSmoothScroll_Params params;
2278 params.scroll_down = down; 2272 params.scroll_down = down;
2279 params.pixels_to_scroll = pixels_to_scroll; 2273 params.pixels_to_scroll = pixels_to_scroll;
2280 params.mouse_event_x = mouse_event_x; 2274 params.mouse_event_x = mouse_event_x;
2281 params.mouse_event_y = mouse_event_y; 2275 params.mouse_event_y = mouse_event_y;
2282 2276
2283 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, id, params)); 2277 bool ret = false;
2284 pending_smooth_scroll_gestures_.insert(std::make_pair(id, callback)); 2278 Send(new ViewHostMsg_BeginSmoothScroll(routing_id_, params, &ret));
2279 pending_smooth_scroll_gesture_ = callback;
2280 return ret;
2285 } 2281 }
2286 2282
2287 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 2283 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
2288 return false; 2284 return false;
2289 } 2285 }
2290 2286
2291 bool RenderWidget::WillHandleGestureEvent( 2287 bool RenderWidget::WillHandleGestureEvent(
2292 const WebKit::WebGestureEvent& event) { 2288 const WebKit::WebGestureEvent& event) {
2293 return false; 2289 return false;
2294 } 2290 }
(...skipping 15 matching lines...) Expand all
2310 2306
2311 if (!context->Initialize( 2307 if (!context->Initialize(
2312 attributes, 2308 attributes,
2313 false /* bind generates resources */, 2309 false /* bind generates resources */,
2314 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) ) 2310 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE) )
2315 return NULL; 2311 return NULL;
2316 return context.release(); 2312 return context.release();
2317 } 2313 }
2318 2314
2319 } // namespace content 2315 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | tools/telemetry/telemetry/page/actions/scroll.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698