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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 #endif | 95 #endif |
96 | 96 |
97 namespace content { | 97 namespace content { |
98 | 98 |
99 typedef int32_t (*InitializeBrokerFunc) | 99 typedef int32_t (*InitializeBrokerFunc) |
100 (PP_ConnectInstance_Func* connect_instance_func); | 100 (PP_ConnectInstance_Func* connect_instance_func); |
101 | 101 |
102 PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker) | 102 PpapiThread::PpapiThread(const base::CommandLine& command_line, bool is_broker) |
103 : is_broker_(is_broker), | 103 : is_broker_(is_broker), |
| 104 plugin_globals_(GetIOTaskRunner()), |
104 connect_instance_func_(NULL), | 105 connect_instance_func_(NULL), |
105 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), | 106 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
106 next_plugin_dispatcher_id_(1) { | 107 next_plugin_dispatcher_id_(1) { |
107 ppapi::proxy::PluginGlobals* globals = ppapi::proxy::PluginGlobals::Get(); | 108 plugin_globals_.SetPluginProxyDelegate(this); |
108 globals->SetPluginProxyDelegate(this); | 109 plugin_globals_.set_command_line( |
109 globals->set_command_line( | |
110 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); | 110 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); |
111 | 111 |
112 blink_platform_impl_.reset(new PpapiBlinkPlatformImpl); | 112 blink_platform_impl_.reset(new PpapiBlinkPlatformImpl); |
113 blink::initialize(blink_platform_impl_.get()); | 113 blink::initialize(blink_platform_impl_.get()); |
114 | 114 |
115 if (!is_broker_) { | 115 if (!is_broker_) { |
116 channel()->AddFilter( | 116 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( |
117 new ppapi::proxy::PluginMessageFilter( | 117 new ppapi::proxy::PluginMessageFilter( |
118 NULL, globals->resource_reply_thread_registrar())); | 118 NULL, plugin_globals_.resource_reply_thread_registrar())); |
| 119 channel()->AddFilter(plugin_filter.get()); |
| 120 plugin_globals_.RegisterResourceMessageFilters(plugin_filter.get()); |
119 } | 121 } |
120 } | 122 } |
121 | 123 |
122 PpapiThread::~PpapiThread() { | 124 PpapiThread::~PpapiThread() { |
123 } | 125 } |
124 | 126 |
125 void PpapiThread::Shutdown() { | 127 void PpapiThread::Shutdown() { |
126 ChildThreadImpl::Shutdown(); | 128 ChildThreadImpl::Shutdown(); |
127 | 129 |
128 ppapi::proxy::PluginGlobals::Get()->ResetPluginProxyDelegate(); | 130 ppapi::proxy::PluginGlobals::Get()->ResetPluginProxyDelegate(); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") + | 548 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") + |
547 "LoadErrorCode_" + path.BaseName().MaybeAsASCII(); | 549 "LoadErrorCode_" + path.BaseName().MaybeAsASCII(); |
548 | 550 |
549 // For sparse histograms, we can use the macro, as it does not incorporate a | 551 // For sparse histograms, we can use the macro, as it does not incorporate a |
550 // static. | 552 // static. |
551 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code); | 553 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code); |
552 #endif | 554 #endif |
553 } | 555 } |
554 | 556 |
555 } // namespace content | 557 } // namespace content |
OLD | NEW |