| 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/browser/plugin_loader_posix.h" | 5 #include "content/browser/plugin_loader_posix.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 &canonical_list_, | 103 &canonical_list_, |
| 104 PluginService::GetInstance()->NPAPIPluginsSupported()); | 104 PluginService::GetInstance()->NPAPIPluginsSupported()); |
| 105 | 105 |
| 106 internal_plugins_.clear(); | 106 internal_plugins_.clear(); |
| 107 PluginList::Singleton()->GetInternalPlugins(&internal_plugins_); | 107 PluginList::Singleton()->GetInternalPlugins(&internal_plugins_); |
| 108 | 108 |
| 109 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 109 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 110 base::Bind(&PluginLoaderPosix::LoadPluginsInternal, | 110 base::Bind(&PluginLoaderPosix::LoadPluginsInternal, |
| 111 make_scoped_refptr(this))); | 111 make_scoped_refptr(this))); |
| 112 | 112 |
| 113 HISTOGRAM_TIMES("PluginLoaderPosix.GetPluginList", | 113 LOCAL_HISTOGRAM_TIMES("PluginLoaderPosix.GetPluginList", |
| 114 (base::TimeTicks::Now() - start_time) * | 114 (base::TimeTicks::Now() - start_time) * |
| 115 base::Time::kMicrosecondsPerMillisecond); | 115 base::Time::kMicrosecondsPerMillisecond); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void PluginLoaderPosix::LoadPluginsInternal() { | 118 void PluginLoaderPosix::LoadPluginsInternal() { |
| 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 120 | 120 |
| 121 // Check if the list is empty or all plugins have already been loaded before | 121 // Check if the list is empty or all plugins have already been loaded before |
| 122 // forking. | 122 // forking. |
| 123 if (MaybeRunPendingCallbacks()) | 123 if (MaybeRunPendingCallbacks()) |
| 124 return; | 124 return; |
| 125 | 125 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 PluginList::Singleton()->SetPlugins(loaded_plugins_); | 202 PluginList::Singleton()->SetPlugins(loaded_plugins_); |
| 203 | 203 |
| 204 for (std::vector<PluginService::GetPluginsCallback>::iterator it = | 204 for (std::vector<PluginService::GetPluginsCallback>::iterator it = |
| 205 callbacks_.begin(); | 205 callbacks_.begin(); |
| 206 it != callbacks_.end(); ++it) { | 206 it != callbacks_.end(); ++it) { |
| 207 base::MessageLoop::current()->PostTask(FROM_HERE, | 207 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 208 base::Bind(*it, loaded_plugins_)); | 208 base::Bind(*it, loaded_plugins_)); |
| 209 } | 209 } |
| 210 callbacks_.clear(); | 210 callbacks_.clear(); |
| 211 | 211 |
| 212 HISTOGRAM_TIMES("PluginLoaderPosix.LoadDone", | 212 LOCAL_HISTOGRAM_TIMES("PluginLoaderPosix.LoadDone", |
| 213 (base::TimeTicks::Now() - load_start_time_) | 213 (base::TimeTicks::Now() - load_start_time_) * |
| 214 * base::Time::kMicrosecondsPerMillisecond); | 214 base::Time::kMicrosecondsPerMillisecond); |
| 215 load_start_time_ = base::TimeTicks(); | 215 load_start_time_ = base::TimeTicks(); |
| 216 | 216 |
| 217 return true; | 217 return true; |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace content | 220 } // namespace content |
| OLD | NEW |