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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 586933003: fling: Remove a bunch of code for configuring fling curves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Created 6 years, 3 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
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/fling_curve_configuration.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
26 #include "base/synchronization/waitable_event.h" 26 #include "base/synchronization/waitable_event.h"
27 #include "base/sys_info.h" 27 #include "base/sys_info.h"
28 #include "base/time/time.h" 28 #include "base/time/time.h"
29 #include "blink/public/resources/grit/blink_resources.h" 29 #include "blink/public/resources/grit/blink_resources.h"
30 #include "content/app/resources/grit/content_resources.h" 30 #include "content/app/resources/grit/content_resources.h"
31 #include "content/app/strings/grit/content_strings.h" 31 #include "content/app/strings/grit/content_strings.h"
32 #include "content/child/child_thread.h" 32 #include "content/child/child_thread.h"
33 #include "content/child/content_child_helpers.h" 33 #include "content/child/content_child_helpers.h"
34 #include "content/child/fling_curve_configuration.h" 34 #include "content/child/touch_fling_gesture_curve.h"
35 #include "content/child/web_discardable_memory_impl.h" 35 #include "content/child/web_discardable_memory_impl.h"
36 #include "content/child/web_socket_stream_handle_impl.h" 36 #include "content/child/web_socket_stream_handle_impl.h"
37 #include "content/child/web_url_loader_impl.h" 37 #include "content/child/web_url_loader_impl.h"
38 #include "content/child/websocket_bridge.h" 38 #include "content/child/websocket_bridge.h"
39 #include "content/child/webthread_impl.h" 39 #include "content/child/webthread_impl.h"
40 #include "content/child/worker_task_runner.h" 40 #include "content/child/worker_task_runner.h"
41 #include "content/public/common/content_client.h" 41 #include "content/public/common/content_client.h"
42 #include "net/base/data_url.h" 42 #include "net/base/data_url.h"
43 #include "net/base/mime_util.h" 43 #include "net/base/mime_util.h"
44 #include "net/base/net_errors.h" 44 #include "net/base/net_errors.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 } 412 }
413 return -1; 413 return -1;
414 } 414 }
415 415
416 BlinkPlatformImpl::BlinkPlatformImpl() 416 BlinkPlatformImpl::BlinkPlatformImpl()
417 : main_loop_(base::MessageLoop::current()), 417 : main_loop_(base::MessageLoop::current()),
418 shared_timer_func_(NULL), 418 shared_timer_func_(NULL),
419 shared_timer_fire_time_(0.0), 419 shared_timer_fire_time_(0.0),
420 shared_timer_fire_time_was_set_while_suspended_(false), 420 shared_timer_fire_time_was_set_while_suspended_(false),
421 shared_timer_suspended_(0), 421 shared_timer_suspended_(0),
422 fling_curve_configuration_(new FlingCurveConfiguration),
423 current_thread_slot_(&DestroyCurrentThread) {} 422 current_thread_slot_(&DestroyCurrentThread) {}
424 423
425 BlinkPlatformImpl::~BlinkPlatformImpl() { 424 BlinkPlatformImpl::~BlinkPlatformImpl() {
426 } 425 }
427 426
428 WebURLLoader* BlinkPlatformImpl::createURLLoader() { 427 WebURLLoader* BlinkPlatformImpl::createURLLoader() {
429 ChildThread* child_thread = ChildThread::current(); 428 ChildThread* child_thread = ChildThread::current();
430 // There may be no child thread in RenderViewTests. These tests can still use 429 // There may be no child thread in RenderViewTests. These tests can still use
431 // data URLs to bypass the ResourceDispatcher. 430 // data URLs to bypass the ResourceDispatcher.
432 return new WebURLLoaderImpl( 431 return new WebURLLoaderImpl(
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( 983 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve(
985 blink::WebGestureDevice device_source, 984 blink::WebGestureDevice device_source,
986 const blink::WebFloatPoint& velocity, 985 const blink::WebFloatPoint& velocity,
987 const blink::WebSize& cumulative_scroll) { 986 const blink::WebSize& cumulative_scroll) {
988 #if defined(OS_ANDROID) 987 #if defined(OS_ANDROID)
989 return FlingAnimatorImpl::CreateAndroidGestureCurve( 988 return FlingAnimatorImpl::CreateAndroidGestureCurve(
990 velocity, 989 velocity,
991 cumulative_scroll); 990 cumulative_scroll);
992 #endif 991 #endif
993 992
994 if (device_source == blink::WebGestureDeviceTouchscreen) 993 return TouchFlingGestureCurve::Create(velocity, cumulative_scroll);
995 return fling_curve_configuration_->CreateForTouchScreen(velocity,
996 cumulative_scroll);
997
998 return fling_curve_configuration_->CreateForTouchPad(velocity,
999 cumulative_scroll);
1000 } 994 }
1001 995
1002 void BlinkPlatformImpl::didStartWorkerRunLoop( 996 void BlinkPlatformImpl::didStartWorkerRunLoop(
1003 const blink::WebWorkerRunLoop& runLoop) { 997 const blink::WebWorkerRunLoop& runLoop) {
1004 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance(); 998 WorkerTaskRunner* worker_task_runner = WorkerTaskRunner::Instance();
1005 worker_task_runner->OnWorkerRunLoopStarted(runLoop); 999 worker_task_runner->OnWorkerRunLoopStarted(runLoop);
1006 } 1000 }
1007 1001
1008 void BlinkPlatformImpl::didStopWorkerRunLoop( 1002 void BlinkPlatformImpl::didStopWorkerRunLoop(
1009 const blink::WebWorkerRunLoop& runLoop) { 1003 const blink::WebWorkerRunLoop& runLoop) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 // be reserved for direct use by certain hardware. Thus, we set the limit so 1164 // be reserved for direct use by certain hardware. Thus, we set the limit so
1171 // that 1.6GB of reported physical memory on a 2GB device is enough to set the 1165 // that 1.6GB of reported physical memory on a 2GB device is enough to set the
1172 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively 1166 // limit at 16M pixels, which is a desirable value since 4K*4K is a relatively
1173 // common texture size. 1167 // common texture size.
1174 return base::SysInfo::AmountOfPhysicalMemory() / 25; 1168 return base::SysInfo::AmountOfPhysicalMemory() / 25;
1175 #else 1169 #else
1176 return noDecodedImageByteLimit; 1170 return noDecodedImageByteLimit;
1177 #endif 1171 #endif
1178 } 1172 }
1179 1173
1180 void BlinkPlatformImpl::SetFlingCurveParameters(
1181 const std::vector<float>& new_touchpad,
1182 const std::vector<float>& new_touchscreen) {
1183 fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen);
1184 }
1185
1186 void BlinkPlatformImpl::SuspendSharedTimer() { 1174 void BlinkPlatformImpl::SuspendSharedTimer() {
1187 ++shared_timer_suspended_; 1175 ++shared_timer_suspended_;
1188 } 1176 }
1189 1177
1190 void BlinkPlatformImpl::ResumeSharedTimer() { 1178 void BlinkPlatformImpl::ResumeSharedTimer() {
1191 DCHECK_GT(shared_timer_suspended_, 0); 1179 DCHECK_GT(shared_timer_suspended_, 0);
1192 1180
1193 // The shared timer may have fired or been adjusted while we were suspended. 1181 // The shared timer may have fired or been adjusted while we were suspended.
1194 if (--shared_timer_suspended_ == 0 && 1182 if (--shared_timer_suspended_ == 0 &&
1195 (!shared_timer_.IsRunning() || 1183 (!shared_timer_.IsRunning() ||
1196 shared_timer_fire_time_was_set_while_suspended_)) { 1184 shared_timer_fire_time_was_set_while_suspended_)) {
1197 shared_timer_fire_time_was_set_while_suspended_ = false; 1185 shared_timer_fire_time_was_set_while_suspended_ = false;
1198 setSharedTimerFireInterval( 1186 setSharedTimerFireInterval(
1199 shared_timer_fire_time_ - monotonicallyIncreasingTime()); 1187 shared_timer_fire_time_ - monotonicallyIncreasingTime());
1200 } 1188 }
1201 } 1189 }
1202 1190
1203 // static 1191 // static
1204 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1192 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1205 WebThreadImplForMessageLoop* impl = 1193 WebThreadImplForMessageLoop* impl =
1206 static_cast<WebThreadImplForMessageLoop*>(thread); 1194 static_cast<WebThreadImplForMessageLoop*>(thread);
1207 delete impl; 1195 delete impl;
1208 } 1196 }
1209 1197
1210 } // namespace content 1198 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/child/fling_curve_configuration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698