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/debug/crash_logging.h" | 10 #include "base/debug/crash_logging.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "content/child/browser_font_resource_trusted.h" |
18 #include "content/child/child_process.h" | 19 #include "content/child/child_process.h" |
19 #include "content/common/child_process_messages.h" | 20 #include "content/common/child_process_messages.h" |
20 #include "content/common/sandbox_util.h" | 21 #include "content/common/sandbox_util.h" |
21 #include "content/ppapi_plugin/broker_process_dispatcher.h" | 22 #include "content/ppapi_plugin/broker_process_dispatcher.h" |
22 #include "content/ppapi_plugin/plugin_process_dispatcher.h" | 23 #include "content/ppapi_plugin/plugin_process_dispatcher.h" |
23 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" | 24 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" |
24 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
25 #include "content/public/common/pepper_plugin_info.h" | 26 #include "content/public/common/pepper_plugin_info.h" |
26 #include "content/public/common/sandbox_init.h" | 27 #include "content/public/common/sandbox_init.h" |
27 #include "content/public/plugin/content_plugin_client.h" | 28 #include "content/public/plugin/content_plugin_client.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
203 Send(new ChildProcessHostMsg_PreCacheFont( | 204 Send(new ChildProcessHostMsg_PreCacheFont( |
204 *static_cast<const LOGFONTW*>(logfontw))); | 205 *static_cast<const LOGFONTW*>(logfontw))); |
205 #endif | 206 #endif |
206 } | 207 } |
207 | 208 |
208 void PpapiThread::SetActiveURL(const std::string& url) { | 209 void PpapiThread::SetActiveURL(const std::string& url) { |
209 GetContentClient()->SetActiveURL(GURL(url)); | 210 GetContentClient()->SetActiveURL(GURL(url)); |
210 } | 211 } |
211 | 212 |
| 213 PP_Resource PpapiThread::CreateBrowserFont( |
| 214 ppapi::proxy::Connection connection, |
| 215 PP_Instance instance, |
| 216 const PP_BrowserFont_Trusted_Description& desc, |
| 217 const ppapi::Preferences& prefs) { |
| 218 if (!BrowserFontResource_Trusted::IsPPFontDescriptionValid(desc)) |
| 219 return 0; |
| 220 return (new BrowserFontResource_Trusted( |
| 221 connection, instance, desc, prefs))->GetReference(); |
| 222 } |
| 223 |
212 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher)
{ | 224 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher)
{ |
213 if (!plugin_dispatcher || | 225 if (!plugin_dispatcher || |
214 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { | 226 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { |
215 return 0; | 227 return 0; |
216 } | 228 } |
217 | 229 |
218 uint32 id = 0; | 230 uint32 id = 0; |
219 do { | 231 do { |
220 // Although it is unlikely, make sure that we won't cause any trouble when | 232 // Although it is unlikely, make sure that we won't cause any trouble when |
221 // the counter overflows. | 233 // the counter overflows. |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 histogram_name.str(), | 507 histogram_name.str(), |
496 1, | 508 1, |
497 LOAD_RESULT_MAX, | 509 LOAD_RESULT_MAX, |
498 LOAD_RESULT_MAX + 1, | 510 LOAD_RESULT_MAX + 1, |
499 base::HistogramBase::kUmaTargetedHistogramFlag); | 511 base::HistogramBase::kUmaTargetedHistogramFlag); |
500 | 512 |
501 histogram->Add(result); | 513 histogram->Add(result); |
502 } | 514 } |
503 | 515 |
504 } // namespace content | 516 } // namespace content |
OLD | NEW |