summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 05:24:21 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 05:24:21 +0000
commitc2c901bf406a50085002f8f1d6d63288d6e28c05 (patch)
tree7eb876216d6c541404fb73c3eaa32f387c8b9e6b /chrome/browser/metrics
parent684970b638fbfe1a2137fd162f630c86d2859828 (diff)
downloadchromium_src-c2c901bf406a50085002f8f1d6d63288d6e28c05.zip
chromium_src-c2c901bf406a50085002f8f1d6d63288d6e28c05.tar.gz
chromium_src-c2c901bf406a50085002f8f1d6d63288d6e28c05.tar.bz2
Ensure we don't load plugins on the IO thread.
I had to move the locks from PluginService to PluginList, so that a lock (which can block other threads) isn't held while loading the plugins. BUG=17938 TEST=added asserts which crash if plugins loaded on IO thread, current UI tests exercise them Review URL: http://codereview.chromium.org/164305 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_service.cc23
-rw-r--r--chrome/browser/metrics/metrics_service.h7
2 files changed, 20 insertions, 10 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index ae4330d..71b162c 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -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 MetricsMemoryDetails : public MemoryDetails {
};
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 @@ class MetricsService::GetPluginListTask : public Task {
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 @@ void MetricsService::InitializeMetricsState() {
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 @@ bool MetricsService::TransmissionPermitted() const {
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_;
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index e173915..76fc303 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -21,7 +21,7 @@
#include "chrome/browser/metrics/metrics_log.h"
#include "chrome/browser/net/url_fetcher.h"
#include "chrome/common/notification_registrar.h"
-#include "webkit/glue/webplugin.h"
+#include "webkit/glue/webplugininfo.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
class BookmarkModel;
@@ -99,7 +99,7 @@ class MetricsService : public NotificationObserver,
void RecordBreakpadHasDebugger(bool has_debugger);
// Callback to let us knew that the plugin list is warmed up.
- void OnGetPluginListTaskComplete();
+ void OnGetPluginListTaskComplete(const std::vector<WebPluginInfo>& plugins);
// Save any unsent logs into a persistent store in a pref. We always do this
// at shutdown, but we can do it as we reduce the list as well.
@@ -402,6 +402,9 @@ class MetricsService : public NotificationObserver,
// state.
State state_;
+ // The list of plugins which was retrieved on the file thread.
+ std::vector<WebPluginInfo> plugins_;
+
// A log that we are currently transmiting, or about to try to transmit.
MetricsLog* pending_log_;