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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "content/child/geofencing/web_geofencing_provider_impl.h" | 44 #include "content/child/geofencing/web_geofencing_provider_impl.h" |
45 #include "content/child/navigator_connect/service_port_provider.h" | 45 #include "content/child/navigator_connect/service_port_provider.h" |
46 #include "content/child/notifications/notification_dispatcher.h" | 46 #include "content/child/notifications/notification_dispatcher.h" |
47 #include "content/child/notifications/notification_manager.h" | 47 #include "content/child/notifications/notification_manager.h" |
48 #include "content/child/permissions/permission_dispatcher.h" | 48 #include "content/child/permissions/permission_dispatcher.h" |
49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" | 49 #include "content/child/permissions/permission_dispatcher_thread_proxy.h" |
50 #include "content/child/push_messaging/push_dispatcher.h" | 50 #include "content/child/push_messaging/push_dispatcher.h" |
51 #include "content/child/push_messaging/push_provider.h" | 51 #include "content/child/push_messaging/push_provider.h" |
52 #include "content/child/thread_safe_sender.h" | 52 #include "content/child/thread_safe_sender.h" |
53 #include "content/child/web_discardable_memory_impl.h" | 53 #include "content/child/web_discardable_memory_impl.h" |
54 #include "content/child/web_memory_dump_provider_adapter.h" | |
55 #include "content/child/web_process_memory_dump_impl.h" | |
56 #include "content/child/web_url_loader_impl.h" | 54 #include "content/child/web_url_loader_impl.h" |
57 #include "content/child/web_url_request_util.h" | 55 #include "content/child/web_url_request_util.h" |
58 #include "content/child/websocket_bridge.h" | 56 #include "content/child/websocket_bridge.h" |
59 #include "content/child/worker_task_runner.h" | 57 #include "content/child/worker_task_runner.h" |
60 #include "content/public/common/content_client.h" | 58 #include "content/public/common/content_client.h" |
61 #include "net/base/data_url.h" | 59 #include "net/base/data_url.h" |
62 #include "net/base/ip_address_number.h" | 60 #include "net/base/ip_address_number.h" |
63 #include "net/base/net_errors.h" | 61 #include "net/base/net_errors.h" |
64 #include "net/base/port_util.h" | 62 #include "net/base/port_util.h" |
65 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" | 63 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" |
66 #include "third_party/WebKit/public/platform/WebData.h" | 64 #include "third_party/WebKit/public/platform/WebData.h" |
67 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 65 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
68 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" | |
69 #include "third_party/WebKit/public/platform/WebString.h" | 66 #include "third_party/WebKit/public/platform/WebString.h" |
70 #include "third_party/WebKit/public/platform/WebURL.h" | 67 #include "third_party/WebKit/public/platform/WebURL.h" |
71 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 68 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
72 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 69 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
73 #include "ui/base/layout.h" | 70 #include "ui/base/layout.h" |
74 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 71 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
75 #include "ui/events/keycodes/dom/keycode_converter.h" | 72 #include "ui/events/keycodes/dom/keycode_converter.h" |
76 | 73 |
77 using blink::WebData; | 74 using blink::WebData; |
78 using blink::WebFallbackThemeEngine; | 75 using blink::WebFallbackThemeEngine; |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 void BlinkPlatformImpl::updateTraceEventDuration( | 693 void BlinkPlatformImpl::updateTraceEventDuration( |
697 const unsigned char* category_group_enabled, | 694 const unsigned char* category_group_enabled, |
698 const char* name, | 695 const char* name, |
699 TraceEventHandle handle) { | 696 TraceEventHandle handle) { |
700 base::trace_event::TraceEventHandle traceEventHandle; | 697 base::trace_event::TraceEventHandle traceEventHandle; |
701 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 698 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
702 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 699 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
703 category_group_enabled, name, traceEventHandle); | 700 category_group_enabled, name, traceEventHandle); |
704 } | 701 } |
705 | 702 |
706 void BlinkPlatformImpl::registerMemoryDumpProvider( | |
707 blink::WebMemoryDumpProvider* wmdp) { | |
708 WebMemoryDumpProviderAdapter* wmdp_adapter = | |
709 new WebMemoryDumpProviderAdapter(wmdp); | |
710 bool did_insert = | |
711 memory_dump_providers_.add(wmdp, make_scoped_ptr(wmdp_adapter)).second; | |
712 if (!did_insert) | |
713 return; | |
714 wmdp_adapter->set_is_registered(true); | |
715 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | |
716 wmdp_adapter, base::ThreadTaskRunnerHandle::Get()); | |
717 } | |
718 | |
719 void BlinkPlatformImpl::unregisterMemoryDumpProvider( | |
720 blink::WebMemoryDumpProvider* wmdp) { | |
721 scoped_ptr<WebMemoryDumpProviderAdapter> wmdp_adapter = | |
722 memory_dump_providers_.take_and_erase(wmdp); | |
723 if (!wmdp_adapter) | |
724 return; | |
725 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | |
726 wmdp_adapter.get()); | |
727 wmdp_adapter->set_is_registered(false); | |
728 } | |
729 | |
730 blink::WebProcessMemoryDump* BlinkPlatformImpl::createProcessMemoryDump() { | |
731 return new WebProcessMemoryDumpImpl(); | |
732 } | |
733 | |
734 blink::Platform::WebMemoryAllocatorDumpGuid | |
735 BlinkPlatformImpl::createWebMemoryAllocatorDumpGuid( | |
736 const blink::WebString& guidStr) { | |
737 return base::trace_event::MemoryAllocatorDumpGuid(guidStr.utf8()).ToUint64(); | |
738 } | |
739 | |
740 namespace { | 703 namespace { |
741 | 704 |
742 WebData loadAudioSpatializationResource(const char* name) { | 705 WebData loadAudioSpatializationResource(const char* name) { |
743 #ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE | 706 #ifdef IDR_AUDIO_SPATIALIZATION_COMPOSITE |
744 if (!strcmp(name, "Composite")) { | 707 if (!strcmp(name, "Composite")) { |
745 base::StringPiece resource = GetContentClient()->GetDataResource( | 708 base::StringPiece resource = GetContentClient()->GetDataResource( |
746 IDR_AUDIO_SPATIALIZATION_COMPOSITE, ui::SCALE_FACTOR_NONE); | 709 IDR_AUDIO_SPATIALIZATION_COMPOSITE, ui::SCALE_FACTOR_NONE); |
747 return WebData(resource.data(), resource.size()); | 710 return WebData(resource.data(), resource.size()); |
748 } | 711 } |
749 #endif | 712 #endif |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1355 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
1393 static_cast<ui::DomKey>(dom_key))); | 1356 static_cast<ui::DomKey>(dom_key))); |
1394 } | 1357 } |
1395 | 1358 |
1396 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1359 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
1397 return static_cast<int>( | 1360 return static_cast<int>( |
1398 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data())); | 1361 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8().data())); |
1399 } | 1362 } |
1400 | 1363 |
1401 } // namespace content | 1364 } // namespace content |
OLD | NEW |