OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 void PluginLoaderPosix::GetPluginsToLoad() { | 61 void PluginLoaderPosix::GetPluginsToLoad() { |
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
63 | 63 |
64 base::TimeTicks start_time(base::TimeTicks::Now()); | 64 base::TimeTicks start_time(base::TimeTicks::Now()); |
65 | 65 |
66 loaded_plugins_.clear(); | 66 loaded_plugins_.clear(); |
67 next_load_index_ = 0; | 67 next_load_index_ = 0; |
68 | 68 |
69 canonical_list_.clear(); | 69 canonical_list_.clear(); |
70 PluginService::GetInstance()->plugin_list()->GetPluginPathsToLoad( | 70 PluginService::GetInstance()->GetPluginList()->GetPluginPathsToLoad( |
71 &canonical_list_); | 71 &canonical_list_); |
72 | 72 |
73 internal_plugins_.clear(); | 73 internal_plugins_.clear(); |
74 PluginService::GetInstance()->plugin_list()->GetInternalPlugins( | 74 PluginService::GetInstance()->GetPluginList()->GetInternalPlugins( |
75 &internal_plugins_); | 75 &internal_plugins_); |
76 | 76 |
77 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 77 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
78 base::Bind(&PluginLoaderPosix::LoadPluginsInternal, | 78 base::Bind(&PluginLoaderPosix::LoadPluginsInternal, |
79 make_scoped_refptr(this))); | 79 make_scoped_refptr(this))); |
80 | 80 |
81 HISTOGRAM_TIMES("PluginLoaderPosix.GetPluginList", | 81 HISTOGRAM_TIMES("PluginLoaderPosix.GetPluginList", |
82 (base::TimeTicks::Now() - start_time) * | 82 (base::TimeTicks::Now() - start_time) * |
83 base::Time::kMicrosecondsPerMillisecond); | 83 base::Time::kMicrosecondsPerMillisecond); |
84 } | 84 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return true; | 144 return true; |
145 } | 145 } |
146 } | 146 } |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
150 bool PluginLoaderPosix::MaybeRunPendingCallbacks() { | 150 bool PluginLoaderPosix::MaybeRunPendingCallbacks() { |
151 if (next_load_index_ < canonical_list_.size()) | 151 if (next_load_index_ < canonical_list_.size()) |
152 return false; | 152 return false; |
153 | 153 |
154 PluginService::GetInstance()->plugin_list()->SetPlugins(loaded_plugins_); | 154 PluginService::GetInstance()->GetPluginList()->SetPlugins(loaded_plugins_); |
155 for (std::vector<PendingCallback>::iterator it = callbacks_.begin(); | 155 for (std::vector<PendingCallback>::iterator it = callbacks_.begin(); |
156 it != callbacks_.end(); | 156 it != callbacks_.end(); |
157 ++it) { | 157 ++it) { |
158 it->target_loop->PostTask(FROM_HERE, | 158 it->target_loop->PostTask(FROM_HERE, |
159 base::Bind(it->callback, loaded_plugins_)); | 159 base::Bind(it->callback, loaded_plugins_)); |
160 } | 160 } |
161 callbacks_.clear(); | 161 callbacks_.clear(); |
162 | 162 |
163 HISTOGRAM_TIMES("PluginLoaderPosix.LoadDone", | 163 HISTOGRAM_TIMES("PluginLoaderPosix.LoadDone", |
164 (base::TimeTicks::Now() - load_start_time_) | 164 (base::TimeTicks::Now() - load_start_time_) |
165 * base::Time::kMicrosecondsPerMillisecond); | 165 * base::Time::kMicrosecondsPerMillisecond); |
166 load_start_time_ = base::TimeTicks(); | 166 load_start_time_ = base::TimeTicks(); |
167 | 167 |
168 return true; | 168 return true; |
169 } | 169 } |
170 | 170 |
171 PluginLoaderPosix::PendingCallback::PendingCallback( | 171 PluginLoaderPosix::PendingCallback::PendingCallback( |
172 scoped_refptr<base::MessageLoopProxy> loop, | 172 scoped_refptr<base::MessageLoopProxy> loop, |
173 const PluginService::GetPluginsCallback& cb) | 173 const PluginService::GetPluginsCallback& cb) |
174 : target_loop(loop), | 174 : target_loop(loop), |
175 callback(cb) { | 175 callback(cb) { |
176 } | 176 } |
177 | 177 |
178 PluginLoaderPosix::PendingCallback::~PendingCallback() { | 178 PluginLoaderPosix::PendingCallback::~PendingCallback() { |
179 } | 179 } |
OLD | NEW |