OLD | NEW |
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/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "content/child/browser_font_resource_trusted.h" | 29 #include "content/child/browser_font_resource_trusted.h" |
30 #include "content/child/child_process.h" | 30 #include "content/child/child_process.h" |
31 #include "content/common/child_process_messages.h" | 31 #include "content/common/child_process_messages.h" |
32 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 32 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
33 #include "content/ppapi_plugin/plugin_process_dispatcher.h" | 33 #include "content/ppapi_plugin/plugin_process_dispatcher.h" |
34 #include "content/ppapi_plugin/ppapi_blink_platform_impl.h" | 34 #include "content/ppapi_plugin/ppapi_blink_platform_impl.h" |
35 #include "content/public/common/content_client.h" | 35 #include "content/public/common/content_client.h" |
36 #include "content/public/common/content_switches.h" | 36 #include "content/public/common/content_switches.h" |
37 #include "content/public/common/pepper_plugin_info.h" | 37 #include "content/public/common/pepper_plugin_info.h" |
38 #include "content/public/common/sandbox_init.h" | 38 #include "content/public/common/sandbox_init.h" |
| 39 #include "content/public/common/service_manager_connection.h" |
39 #include "ipc/ipc_channel_handle.h" | 40 #include "ipc/ipc_channel_handle.h" |
40 #include "ipc/ipc_platform_file.h" | 41 #include "ipc/ipc_platform_file.h" |
41 #include "ipc/ipc_sync_channel.h" | 42 #include "ipc/ipc_sync_channel.h" |
42 #include "ipc/ipc_sync_message_filter.h" | 43 #include "ipc/ipc_sync_message_filter.h" |
43 #include "ppapi/c/dev/ppp_network_state_dev.h" | 44 #include "ppapi/c/dev/ppp_network_state_dev.h" |
44 #include "ppapi/c/pp_errors.h" | 45 #include "ppapi/c/pp_errors.h" |
45 #include "ppapi/c/ppp.h" | 46 #include "ppapi/c/ppp.h" |
46 #include "ppapi/proxy/interface_list.h" | 47 #include "ppapi/proxy/interface_list.h" |
47 #include "ppapi/proxy/plugin_globals.h" | 48 #include "ppapi/proxy/plugin_globals.h" |
48 #include "ppapi/proxy/plugin_message_filter.h" | 49 #include "ppapi/proxy/plugin_message_filter.h" |
49 #include "ppapi/proxy/ppapi_messages.h" | 50 #include "ppapi/proxy/ppapi_messages.h" |
50 #include "ppapi/proxy/resource_reply_thread_registrar.h" | 51 #include "ppapi/proxy/resource_reply_thread_registrar.h" |
| 52 #include "services/service_manager/public/cpp/connector.h" |
51 #include "services/service_manager/public/cpp/interface_provider.h" | 53 #include "services/service_manager/public/cpp/interface_provider.h" |
| 54 #include "services/ui/public/interfaces/constants.mojom.h" |
52 #include "third_party/WebKit/public/web/WebKit.h" | 55 #include "third_party/WebKit/public/web/WebKit.h" |
53 #include "ui/base/ui_base_switches.h" | 56 #include "ui/base/ui_base_switches.h" |
54 | 57 |
55 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
56 #include "base/win/win_util.h" | 59 #include "base/win/win_util.h" |
57 #include "base/win/windows_version.h" | 60 #include "base/win/windows_version.h" |
58 #include "content/child/font_warmup_win.h" | 61 #include "content/child/font_warmup_win.h" |
59 #include "sandbox/win/src/sandbox.h" | 62 #include "sandbox/win/src/sandbox.h" |
60 #elif defined(OS_MACOSX) | 63 #elif defined(OS_MACOSX) |
61 #include "content/common/sandbox_init_mac.h" | 64 #include "content/common/sandbox_init_mac.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 98 |
96 enum_sys_locales_ex(EnumLocalesProcEx, LOCALE_WINDOWS, 0, 0); | 99 enum_sys_locales_ex(EnumLocalesProcEx, LOCALE_WINDOWS, 0, 0); |
97 } else { | 100 } else { |
98 EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED); | 101 EnumSystemLocalesW(EnumLocalesProc, LCID_INSTALLED); |
99 } | 102 } |
100 } | 103 } |
101 } | 104 } |
102 | 105 |
103 #endif | 106 #endif |
104 | 107 |
| 108 static bool IsRunningInMash() { |
| 109 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 110 return cmdline->HasSwitch(switches::kIsRunningInMash); |
| 111 } |
| 112 |
105 namespace content { | 113 namespace content { |
106 | 114 |
107 typedef int32_t (*InitializeBrokerFunc) | 115 typedef int32_t (*InitializeBrokerFunc) |
108 (PP_ConnectInstance_Func* connect_instance_func); | 116 (PP_ConnectInstance_Func* connect_instance_func); |
109 | 117 |
110 PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker) | 118 PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker) |
111 : is_broker_(is_broker), | 119 : is_broker_(is_broker), |
112 plugin_globals_(GetIOTaskRunner()), | 120 plugin_globals_(GetIOTaskRunner()), |
113 connect_instance_func_(NULL), | 121 connect_instance_func_(NULL), |
114 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), | 122 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
(...skipping 11 matching lines...) Expand all Loading... |
126 new ppapi::proxy::PluginMessageFilter( | 134 new ppapi::proxy::PluginMessageFilter( |
127 NULL, plugin_globals_.resource_reply_thread_registrar())); | 135 NULL, plugin_globals_.resource_reply_thread_registrar())); |
128 channel()->AddFilter(plugin_filter.get()); | 136 channel()->AddFilter(plugin_filter.get()); |
129 plugin_globals_.RegisterResourceMessageFilters(plugin_filter.get()); | 137 plugin_globals_.RegisterResourceMessageFilters(plugin_filter.get()); |
130 } | 138 } |
131 | 139 |
132 // In single process, browser main loop set up the discardable memory | 140 // In single process, browser main loop set up the discardable memory |
133 // allocator. | 141 // allocator. |
134 if (!command_line.HasSwitch(switches::kSingleProcess)) { | 142 if (!command_line.HasSwitch(switches::kSingleProcess)) { |
135 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; | 143 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; |
136 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( | 144 if (IsRunningInMash()) { |
137 mojo::GetProxy(&manager_ptr)); | 145 #if defined(USE_AURA) |
| 146 GetServiceManagerConnection()->GetConnector()->ConnectToInterface( |
| 147 ui::mojom::kServiceName, &manager_ptr); |
| 148 #else |
| 149 NOTREACHED(); |
| 150 #endif |
| 151 } else { |
| 152 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( |
| 153 mojo::GetProxy(&manager_ptr)); |
| 154 } |
138 discardable_shared_memory_manager_ = base::MakeUnique< | 155 discardable_shared_memory_manager_ = base::MakeUnique< |
139 discardable_memory::ClientDiscardableSharedMemoryManager>( | 156 discardable_memory::ClientDiscardableSharedMemoryManager>( |
140 std::move(manager_ptr), GetIOTaskRunner()); | 157 std::move(manager_ptr), GetIOTaskRunner()); |
141 base::DiscardableMemoryAllocator::SetInstance( | 158 base::DiscardableMemoryAllocator::SetInstance( |
142 discardable_shared_memory_manager_.get()); | 159 discardable_shared_memory_manager_.get()); |
143 } | 160 } |
144 field_trial_syncer_.InitFieldTrialObserving(command_line, | 161 field_trial_syncer_.InitFieldTrialObserving(command_line, |
145 switches::kSingleProcess); | 162 switches::kSingleProcess); |
146 } | 163 } |
147 | 164 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 GetHistogramName(is_broker_, "LoadTime", path), | 604 GetHistogramName(is_broker_, "LoadTime", path), |
588 base::TimeDelta::FromMilliseconds(1), | 605 base::TimeDelta::FromMilliseconds(1), |
589 base::TimeDelta::FromSeconds(10), | 606 base::TimeDelta::FromSeconds(10), |
590 50, | 607 50, |
591 base::HistogramBase::kUmaTargetedHistogramFlag); | 608 base::HistogramBase::kUmaTargetedHistogramFlag); |
592 | 609 |
593 histogram->AddTime(load_time); | 610 histogram->AddTime(load_time); |
594 } | 611 } |
595 | 612 |
596 } // namespace content | 613 } // namespace content |
OLD | NEW |