Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2227)

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 164305: Ensure we don't load plugins on the IO thread (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/plugin_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
===================================================================
--- chrome/browser/metrics/metrics_service.cc (revision 23449)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -181,7 +181,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/load_notification_details.h"
#include "chrome/browser/memory_details.h"
-#include "chrome/browser/plugin_service.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/search_engines/template_url.h"
@@ -197,6 +196,7 @@
#include "chrome/common/render_messages.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
+#include "webkit/glue/plugins/plugin_list.h"
#if defined(OS_POSIX)
// TODO(port): Move these headers above as they are ported.
@@ -288,9 +288,15 @@
};
class MetricsService::GetPluginListTaskComplete : public Task {
+ public:
+ explicit GetPluginListTaskComplete(
+ const std::vector<WebPluginInfo>& plugins) : plugins_(plugins) { }
virtual void Run() {
- g_browser_process->metrics_service()->OnGetPluginListTaskComplete();
+ g_browser_process->metrics_service()->OnGetPluginListTaskComplete(plugins_);
}
+
+ private:
+ std::vector<WebPluginInfo> plugins_;
};
class MetricsService::GetPluginListTask : public Task {
@@ -300,9 +306,10 @@
virtual void Run() {
std::vector<WebPluginInfo> plugins;
- PluginService::GetInstance()->GetPlugins(false, &plugins);
+ NPAPI::PluginList::Singleton()->GetPlugins(false, &plugins);
- callback_loop_->PostTask(FROM_HERE, new GetPluginListTaskComplete());
+ callback_loop_->PostTask(
+ FROM_HERE, new GetPluginListTaskComplete(plugins));
}
private:
@@ -751,8 +758,10 @@
ScheduleNextStateSave();
}
-void MetricsService::OnGetPluginListTaskComplete() {
+void MetricsService::OnGetPluginListTaskComplete(
+ const std::vector<WebPluginInfo>& plugins) {
DCHECK(state_ == PLUGIN_LIST_REQUESTED);
+ plugins_ = plugins;
if (state_ == PLUGIN_LIST_REQUESTED)
state_ = PLUGIN_LIST_ARRIVED;
}
@@ -1122,11 +1131,9 @@
void MetricsService::PrepareInitialLog() {
DCHECK(state_ == PLUGIN_LIST_ARRIVED);
- std::vector<WebPluginInfo> plugins;
- PluginService::GetInstance()->GetPlugins(false, &plugins);
MetricsLog* log = new MetricsLog(client_id_, session_id_);
- log->RecordEnvironment(plugins, profile_dictionary_.get());
+ log->RecordEnvironment(plugins_, profile_dictionary_.get());
// Histograms only get written to current_log_, so setup for the write.
MetricsLog* save_log = current_log_;
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/plugin_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698