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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/cpu.h" | 10 #include "base/cpu.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 #else | 94 #else |
95 extern void* g_target_services; | 95 extern void* g_target_services; |
96 #endif | 96 #endif |
97 | 97 |
98 namespace content { | 98 namespace content { |
99 | 99 |
100 typedef int32_t (*InitializeBrokerFunc) | 100 typedef int32_t (*InitializeBrokerFunc) |
101 (PP_ConnectInstance_Func* connect_instance_func); | 101 (PP_ConnectInstance_Func* connect_instance_func); |
102 | 102 |
103 PpapiThread::PpapiThread(const CommandLine& command_line, bool is_broker) | 103 PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker) |
104 : is_broker_(is_broker), | 104 : is_broker_(is_broker), |
105 connect_instance_func_(NULL), | 105 connect_instance_func_(NULL), |
106 local_pp_module_( | 106 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
107 base::RandInt(0, std::numeric_limits<PP_Module>::max())), | |
108 next_plugin_dispatcher_id_(1) { | 107 next_plugin_dispatcher_id_(1) { |
109 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); | 108 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); |
110 globals->SetPluginProxyDelegate(this); | 109 globals->SetPluginProxyDelegate(this); |
111 globals->set_command_line( | 110 globals->set_command_line( |
112 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); | 111 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); |
113 | 112 |
114 blink_platform_impl_.reset(new PpapiBlinkPlatformImpl); | 113 blink_platform_impl_.reset(new PpapiBlinkPlatformImpl); |
115 blink::initialize(blink_platform_impl_.get()); | 114 blink::initialize(blink_platform_impl_.get()); |
116 | 115 |
117 if (!is_broker_) { | 116 if (!is_broker_) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 191 |
193 std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() { | 192 std::set<PP_Instance>* PpapiThread::GetGloballySeenInstanceIDSet() { |
194 return &globally_seen_instance_ids_; | 193 return &globally_seen_instance_ids_; |
195 } | 194 } |
196 | 195 |
197 IPC::Sender* PpapiThread::GetBrowserSender() { | 196 IPC::Sender* PpapiThread::GetBrowserSender() { |
198 return this; | 197 return this; |
199 } | 198 } |
200 | 199 |
201 std::string PpapiThread::GetUILanguage() { | 200 std::string PpapiThread::GetUILanguage() { |
202 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 201 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
203 return command_line->GetSwitchValueASCII(switches::kLang); | 202 return command_line->GetSwitchValueASCII(switches::kLang); |
204 } | 203 } |
205 | 204 |
206 void PpapiThread::PreCacheFont(const void* logfontw) { | 205 void PpapiThread::PreCacheFont(const void* logfontw) { |
207 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
208 Send(new ChildProcessHostMsg_PreCacheFont( | 207 Send(new ChildProcessHostMsg_PreCacheFont( |
209 *static_cast<const LOGFONTW*>(logfontw))); | 208 *static_cast<const LOGFONTW*>(logfontw))); |
210 #endif | 209 #endif |
211 } | 210 } |
212 | 211 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") + | 542 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") + |
544 "LoadErrorCode_" + path.BaseName().MaybeAsASCII(); | 543 "LoadErrorCode_" + path.BaseName().MaybeAsASCII(); |
545 | 544 |
546 // For sparse histograms, we can use the macro, as it does not incorporate a | 545 // For sparse histograms, we can use the macro, as it does not incorporate a |
547 // static. | 546 // static. |
548 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code); | 547 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code); |
549 #endif | 548 #endif |
550 } | 549 } |
551 | 550 |
552 } // namespace content | 551 } // namespace content |
OLD | NEW |