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_thread_registry.h" | 57 #include "content/child/worker_thread_registry.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/WebData.h" | 63 #include "third_party/WebKit/public/platform/WebData.h" |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // the histogram because name is dynamic. | 594 // the histogram because name is dynamic. |
597 base::HistogramBase* counter = | 595 base::HistogramBase* counter = |
598 base::LinearHistogram::FactoryGet(name, 1, boundary_value, | 596 base::LinearHistogram::FactoryGet(name, 1, boundary_value, |
599 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); | 597 boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag); |
600 DCHECK_EQ(name, counter->histogram_name()); | 598 DCHECK_EQ(name, counter->histogram_name()); |
601 counter->Add(sample); | 599 counter->Add(sample); |
602 } | 600 } |
603 | 601 |
604 void BlinkPlatformImpl::registerMemoryDumpProvider( | 602 void BlinkPlatformImpl::registerMemoryDumpProvider( |
605 blink::WebMemoryDumpProvider* wmdp, const char* name) { | 603 blink::WebMemoryDumpProvider* wmdp, const char* name) { |
606 WebMemoryDumpProviderAdapter* wmdp_adapter = | 604 blink::Platform::registerMemoryDumpProviderImpl(wmdp, name); |
607 new WebMemoryDumpProviderAdapter(wmdp); | |
608 bool did_insert = | |
609 memory_dump_providers_.add(wmdp, make_scoped_ptr(wmdp_adapter)).second; | |
610 if (!did_insert) | |
611 return; | |
612 wmdp_adapter->set_is_registered(true); | |
613 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | |
614 wmdp_adapter, name, base::ThreadTaskRunnerHandle::Get()); | |
615 } | 605 } |
616 | 606 |
617 void BlinkPlatformImpl::unregisterMemoryDumpProvider( | 607 void BlinkPlatformImpl::unregisterMemoryDumpProvider( |
618 blink::WebMemoryDumpProvider* wmdp) { | 608 blink::WebMemoryDumpProvider* wmdp) { |
619 scoped_ptr<WebMemoryDumpProviderAdapter> wmdp_adapter = | 609 blink::Platform::unregisterMemoryDumpProviderImpl(wmdp); |
620 memory_dump_providers_.take_and_erase(wmdp); | |
621 if (!wmdp_adapter) | |
622 return; | |
623 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | |
624 wmdp_adapter.get()); | |
625 wmdp_adapter->set_is_registered(false); | |
626 } | |
627 | |
628 blink::WebProcessMemoryDump* BlinkPlatformImpl::createProcessMemoryDump() { | |
629 return new WebProcessMemoryDumpImpl(); | |
630 } | 610 } |
631 | 611 |
632 blink::Platform::WebMemoryAllocatorDumpGuid | 612 blink::Platform::WebMemoryAllocatorDumpGuid |
633 BlinkPlatformImpl::createWebMemoryAllocatorDumpGuid( | 613 BlinkPlatformImpl::createWebMemoryAllocatorDumpGuid( |
634 const blink::WebString& guidStr) { | 614 const blink::WebString& guidStr) { |
635 return base::trace_event::MemoryAllocatorDumpGuid(guidStr.utf8()).ToUint64(); | 615 return base::trace_event::MemoryAllocatorDumpGuid(guidStr.utf8()).ToUint64(); |
636 } | 616 } |
637 | 617 |
638 void BlinkPlatformImpl::addTraceLogEnabledStateObserver( | 618 void BlinkPlatformImpl::addTraceLogEnabledStateObserver( |
639 TraceLogEnabledStateObserver* observer) { | 619 TraceLogEnabledStateObserver* observer) { |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1178 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
1199 static_cast<ui::DomKey>(dom_key))); | 1179 static_cast<ui::DomKey>(dom_key))); |
1200 } | 1180 } |
1201 | 1181 |
1202 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1182 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
1203 return static_cast<int>( | 1183 return static_cast<int>( |
1204 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1184 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
1205 } | 1185 } |
1206 | 1186 |
1207 } // namespace content | 1187 } // namespace content |
OLD | NEW |