Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 20214004: move BrowserFontResource_Trusted to content/child (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chromium-style doesn't run on ppapi? Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/process_util.h" 13 #include "base/process_util.h"
14 #include "base/rand_util.h" 14 #include "base/rand_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "content/child/child_process.h" 19 #include "content/child/child_process.h"
20 #include "content/common/child_process_messages.h" 20 #include "content/common/child_process_messages.h"
21 #include "content/common/sandbox_util.h" 21 #include "content/common/sandbox_util.h"
22 #include "content/ppapi_plugin/broker_process_dispatcher.h" 22 #include "content/ppapi_plugin/broker_process_dispatcher.h"
23 #include "content/ppapi_plugin/browser_font_resource_trusted.h"
23 #include "content/ppapi_plugin/plugin_process_dispatcher.h" 24 #include "content/ppapi_plugin/plugin_process_dispatcher.h"
24 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" 25 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h"
25 #include "content/public/common/content_client.h" 26 #include "content/public/common/content_client.h"
26 #include "content/public/common/pepper_plugin_info.h" 27 #include "content/public/common/pepper_plugin_info.h"
27 #include "content/public/common/sandbox_init.h" 28 #include "content/public/common/sandbox_init.h"
28 #include "content/public/plugin/content_plugin_client.h" 29 #include "content/public/plugin/content_plugin_client.h"
29 #include "ipc/ipc_channel_handle.h" 30 #include "ipc/ipc_channel_handle.h"
30 #include "ipc/ipc_platform_file.h" 31 #include "ipc/ipc_platform_file.h"
31 #include "ipc/ipc_sync_channel.h" 32 #include "ipc/ipc_sync_channel.h"
32 #include "ipc/ipc_sync_message_filter.h" 33 #include "ipc/ipc_sync_message_filter.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 #if defined(OS_WIN) 204 #if defined(OS_WIN)
204 Send(new ChildProcessHostMsg_PreCacheFont( 205 Send(new ChildProcessHostMsg_PreCacheFont(
205 *static_cast<const LOGFONTW*>(logfontw))); 206 *static_cast<const LOGFONTW*>(logfontw)));
206 #endif 207 #endif
207 } 208 }
208 209
209 void PpapiThread::SetActiveURL(const std::string& url) { 210 void PpapiThread::SetActiveURL(const std::string& url) {
210 GetContentClient()->SetActiveURL(GURL(url)); 211 GetContentClient()->SetActiveURL(GURL(url));
211 } 212 }
212 213
214 PP_Resource PpapiThread::CreateBrowserFont(
215 ppapi::proxy::Connection connection,
216 PP_Instance instance,
217 const PP_BrowserFont_Trusted_Description& desc,
218 const ppapi::Preferences& prefs) {
219 if (!BrowserFontResource_Trusted::IsPPFontDescriptionValid(desc))
220 return 0;
221 return (new BrowserFontResource_Trusted(connection, instance, desc, prefs))
222 ->GetReference();
223 }
224
213 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher) { 225 uint32 PpapiThread::Register(ppapi::proxy::PluginDispatcher* plugin_dispatcher) {
214 if (!plugin_dispatcher || 226 if (!plugin_dispatcher ||
215 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) { 227 plugin_dispatchers_.size() >= std::numeric_limits<uint32>::max()) {
216 return 0; 228 return 0;
217 } 229 }
218 230
219 uint32 id = 0; 231 uint32 id = 0;
220 do { 232 do {
221 // Although it is unlikely, make sure that we won't cause any trouble when 233 // Although it is unlikely, make sure that we won't cause any trouble when
222 // the counter overflows. 234 // the counter overflows.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 histogram_name.str(), 508 histogram_name.str(),
497 1, 509 1,
498 LOAD_RESULT_MAX, 510 LOAD_RESULT_MAX,
499 LOAD_RESULT_MAX + 1, 511 LOAD_RESULT_MAX + 1,
500 base::HistogramBase::kUmaTargetedHistogramFlag); 512 base::HistogramBase::kUmaTargetedHistogramFlag);
501 513
502 histogram->Add(result); 514 histogram->Add(result);
503 } 515 }
504 516
505 } // namespace content 517 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698