| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 : is_broker_(is_broker), | 111 : is_broker_(is_broker), |
| 112 plugin_globals_(GetIOTaskRunner()), | 112 plugin_globals_(GetIOTaskRunner()), |
| 113 connect_instance_func_(NULL), | 113 connect_instance_func_(NULL), |
| 114 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), | 114 local_pp_module_(base::RandInt(0, std::numeric_limits<PP_Module>::max())), |
| 115 next_plugin_dispatcher_id_(1) { | 115 next_plugin_dispatcher_id_(1) { |
| 116 plugin_globals_.SetPluginProxyDelegate(this); | 116 plugin_globals_.SetPluginProxyDelegate(this); |
| 117 plugin_globals_.set_command_line( | 117 plugin_globals_.set_command_line( |
| 118 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); | 118 command_line.GetSwitchValueASCII(switches::kPpapiFlashArgs)); |
| 119 | 119 |
| 120 blink_platform_impl_.reset(new PpapiBlinkPlatformImpl); | 120 blink_platform_impl_.reset(new PpapiBlinkPlatformImpl); |
| 121 blink::initializeWithoutV8(blink_platform_impl_.get()); | 121 blink::Platform::initialize(blink_platform_impl_.get()); |
| 122 | 122 |
| 123 if (!is_broker_) { | 123 if (!is_broker_) { |
| 124 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( | 124 scoped_refptr<ppapi::proxy::PluginMessageFilter> plugin_filter( |
| 125 new ppapi::proxy::PluginMessageFilter( | 125 new ppapi::proxy::PluginMessageFilter( |
| 126 NULL, plugin_globals_.resource_reply_thread_registrar())); | 126 NULL, plugin_globals_.resource_reply_thread_registrar())); |
| 127 channel()->AddFilter(plugin_filter.get()); | 127 channel()->AddFilter(plugin_filter.get()); |
| 128 plugin_globals_.RegisterResourceMessageFilters(plugin_filter.get()); | 128 plugin_globals_.RegisterResourceMessageFilters(plugin_filter.get()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // In single process, browser main loop set up the discardable memory | 131 // In single process, browser main loop set up the discardable memory |
| 132 // allocator. | 132 // allocator. |
| 133 if (!command_line.HasSwitch(switches::kSingleProcess)) { | 133 if (!command_line.HasSwitch(switches::kSingleProcess)) { |
| 134 base::DiscardableMemoryAllocator::SetInstance( | 134 base::DiscardableMemoryAllocator::SetInstance( |
| 135 ChildThreadImpl::discardable_shared_memory_manager()); | 135 ChildThreadImpl::discardable_shared_memory_manager()); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 PpapiThread::~PpapiThread() { | 139 PpapiThread::~PpapiThread() { |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PpapiThread::Shutdown() { | 142 void PpapiThread::Shutdown() { |
| 143 ChildThreadImpl::Shutdown(); | 143 ChildThreadImpl::Shutdown(); |
| 144 | 144 |
| 145 ppapi::proxy::PluginGlobals::Get()->ResetPluginProxyDelegate(); | 145 ppapi::proxy::PluginGlobals::Get()->ResetPluginProxyDelegate(); |
| 146 if (plugin_entry_points_.shutdown_module) | 146 if (plugin_entry_points_.shutdown_module) |
| 147 plugin_entry_points_.shutdown_module(); | 147 plugin_entry_points_.shutdown_module(); |
| 148 blink_platform_impl_->Shutdown(); | 148 blink_platform_impl_->Shutdown(); |
| 149 blink::shutdownWithoutV8(); | 149 blink::Platform::shutdown(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 bool PpapiThread::Send(IPC::Message* msg) { | 152 bool PpapiThread::Send(IPC::Message* msg) { |
| 153 // Allow access from multiple threads. | 153 // Allow access from multiple threads. |
| 154 if (base::MessageLoop::current() == message_loop()) | 154 if (base::MessageLoop::current() == message_loop()) |
| 155 return ChildThreadImpl::Send(msg); | 155 return ChildThreadImpl::Send(msg); |
| 156 | 156 |
| 157 return sync_message_filter()->Send(msg); | 157 return sync_message_filter()->Send(msg); |
| 158 } | 158 } |
| 159 | 159 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 GetHistogramName(is_broker_, "LoadTime", path), | 603 GetHistogramName(is_broker_, "LoadTime", path), |
| 604 base::TimeDelta::FromMilliseconds(1), | 604 base::TimeDelta::FromMilliseconds(1), |
| 605 base::TimeDelta::FromSeconds(10), | 605 base::TimeDelta::FromSeconds(10), |
| 606 50, | 606 50, |
| 607 base::HistogramBase::kUmaTargetedHistogramFlag); | 607 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 608 | 608 |
| 609 histogram->AddTime(load_time); | 609 histogram->AddTime(load_time); |
| 610 } | 610 } |
| 611 | 611 |
| 612 } // namespace content | 612 } // namespace content |
| OLD | NEW |