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