| OLD | NEW |
| 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 |
| 11 #include "base/allocator/allocator_extension.h" | 11 #include "base/allocator/allocator_extension.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/metrics/sparse_histogram.h" | 18 #include "base/metrics/sparse_histogram.h" |
| 19 #include "base/process/process_metrics.h" | 19 #include "base/process/process_metrics.h" |
| 20 #include "base/rand_util.h" | |
| 21 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 22 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/synchronization/lock.h" | 24 #include "base/synchronization/lock.h" |
| 26 #include "base/synchronization/waitable_event.h" | 25 #include "base/synchronization/waitable_event.h" |
| 27 #include "base/sys_info.h" | 26 #include "base/sys_info.h" |
| 28 #include "base/thread_task_runner_handle.h" | 27 #include "base/thread_task_runner_handle.h" |
| 29 #include "base/threading/platform_thread.h" | 28 #include "base/threading/platform_thread.h" |
| 30 #include "base/time/time.h" | 29 #include "base/time/time.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 #include "content/child/push_messaging/push_provider.h" | 50 #include "content/child/push_messaging/push_provider.h" |
| 52 #include "content/child/thread_safe_sender.h" | 51 #include "content/child/thread_safe_sender.h" |
| 53 #include "content/child/web_discardable_memory_impl.h" | 52 #include "content/child/web_discardable_memory_impl.h" |
| 54 #include "content/child/web_memory_dump_provider_adapter.h" | 53 #include "content/child/web_memory_dump_provider_adapter.h" |
| 55 #include "content/child/web_process_memory_dump_impl.h" | 54 #include "content/child/web_process_memory_dump_impl.h" |
| 56 #include "content/child/web_url_loader_impl.h" | 55 #include "content/child/web_url_loader_impl.h" |
| 57 #include "content/child/web_url_request_util.h" | 56 #include "content/child/web_url_request_util.h" |
| 58 #include "content/child/websocket_bridge.h" | 57 #include "content/child/websocket_bridge.h" |
| 59 #include "content/child/worker_task_runner.h" | 58 #include "content/child/worker_task_runner.h" |
| 60 #include "content/public/common/content_client.h" | 59 #include "content/public/common/content_client.h" |
| 60 #include "crypto/random.h" |
| 61 #include "net/base/data_url.h" | 61 #include "net/base/data_url.h" |
| 62 #include "net/base/ip_address_number.h" | 62 #include "net/base/ip_address_number.h" |
| 63 #include "net/base/net_errors.h" | 63 #include "net/base/net_errors.h" |
| 64 #include "net/base/port_util.h" | 64 #include "net/base/port_util.h" |
| 65 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" | 65 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" |
| 66 #include "third_party/WebKit/public/platform/WebData.h" | 66 #include "third_party/WebKit/public/platform/WebData.h" |
| 67 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 67 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 68 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" | 68 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" |
| 69 #include "third_party/WebKit/public/platform/WebString.h" | 69 #include "third_party/WebKit/public/platform/WebString.h" |
| 70 #include "third_party/WebKit/public/platform/WebURL.h" | 70 #include "third_party/WebKit/public/platform/WebURL.h" |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 return base::TimeTicks::Now().ToInternalValue() / | 1082 return base::TimeTicks::Now().ToInternalValue() / |
| 1083 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 1083 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 double BlinkPlatformImpl::systemTraceTime() { | 1086 double BlinkPlatformImpl::systemTraceTime() { |
| 1087 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF(); | 1087 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF(); |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 void BlinkPlatformImpl::cryptographicallyRandomValues( | 1090 void BlinkPlatformImpl::cryptographicallyRandomValues( |
| 1091 unsigned char* buffer, size_t length) { | 1091 unsigned char* buffer, size_t length) { |
| 1092 base::RandBytes(buffer, length); | 1092 crypto::RandBytes(buffer, length); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( | 1095 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( |
| 1096 blink::WebGestureDevice device_source, | 1096 blink::WebGestureDevice device_source, |
| 1097 const blink::WebFloatPoint& velocity, | 1097 const blink::WebFloatPoint& velocity, |
| 1098 const blink::WebSize& cumulative_scroll) { | 1098 const blink::WebSize& cumulative_scroll) { |
| 1099 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( | 1099 return ui::WebGestureCurveImpl::CreateFromDefaultPlatformCurve( |
| 1100 gfx::Vector2dF(velocity.x, velocity.y), | 1100 gfx::Vector2dF(velocity.x, velocity.y), |
| 1101 gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height), | 1101 gfx::Vector2dF(cumulative_scroll.width, cumulative_scroll.height), |
| 1102 IsMainThread()).release(); | 1102 IsMainThread()).release(); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1325 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1326 static_cast<ui::DomKey>(dom_key))); | 1326 static_cast<ui::DomKey>(dom_key))); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1329 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1330 return static_cast<int>( | 1330 return static_cast<int>( |
| 1331 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1331 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 } // namespace content | 1334 } // namespace content |
| OLD | NEW |