summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 00:09:09 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 00:09:09 +0000
commitcb0e4f1f02ae2cf57771849448459a284ecfc193 (patch)
treeca21406ac3f540c38deb7787db13a4803c4cd1d6 /chrome
parent964a1cec1ccccea7c31e467f0fff63fc9d7edb31 (diff)
downloadchromium_src-cb0e4f1f02ae2cf57771849448459a284ecfc193.zip
chromium_src-cb0e4f1f02ae2cf57771849448459a284ecfc193.tar.gz
chromium_src-cb0e4f1f02ae2cf57771849448459a284ecfc193.tar.bz2
Fix leaking ExtensionMessageService in ProfileManagerTest.
BUG=28824 TEST=tools/valgrind/chrome_tests.sh -t unit --gtest_filter=ProfileManagerTest.CreateProfile Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=33611 Review URL: http://codereview.chromium.org/455031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_message_service.cc8
-rw-r--r--chrome/browser/extensions/extension_message_service.h3
-rw-r--r--chrome/browser/profile_manager_unittest.cc5
3 files changed, 6 insertions, 10 deletions
diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc
index ae43bd6..5aaeb73 100644
--- a/chrome/browser/extensions/extension_message_service.cc
+++ b/chrome/browser/extensions/extension_message_service.cc
@@ -115,11 +115,6 @@ ExtensionMessageService::ExtensionMessageService(Profile* profile)
: profile_(profile),
extension_devtools_manager_(NULL),
next_port_id_(0) {
- if (!ChromeThread::GetCurrentThreadIdentifier(&thread_id_)) {
- // If we get created in unit test, GetCurrentThreadIdentifier fails.
- // Assign thread_id_ to an ID not used.
- thread_id_ = ChromeThread::ID_COUNT;
- }
registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
@@ -138,8 +133,7 @@ ExtensionMessageService::~ExtensionMessageService() {
void ExtensionMessageService::ProfileDestroyed() {
profile_ = NULL;
if (!registrar_.IsEmpty()) {
- if (thread_id_ != ChromeThread::ID_COUNT)
- CHECK(ChromeThread::CurrentlyOn(thread_id_));
+ CHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
registrar_.RemoveAll();
}
}
diff --git a/chrome/browser/extensions/extension_message_service.h b/chrome/browser/extensions/extension_message_service.h
index a4c6037..b04780c 100644
--- a/chrome/browser/extensions/extension_message_service.h
+++ b/chrome/browser/extensions/extension_message_service.h
@@ -198,9 +198,6 @@ class ExtensionMessageService
// used on the IO thread or the UI thread.
Lock next_port_id_lock_;
- // The thread creating this object. Should be UI thread.
- ChromeThread::ID thread_id_;
-
DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService);
};
diff --git a/chrome/browser/profile_manager_unittest.cc b/chrome/browser/profile_manager_unittest.cc
index e38e68f..02813a6 100644
--- a/chrome/browser/profile_manager_unittest.cc
+++ b/chrome/browser/profile_manager_unittest.cc
@@ -5,6 +5,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/common/chrome_paths.h"
@@ -14,6 +15,9 @@
class ProfileManagerTest : public testing::Test {
protected:
+ ProfileManagerTest() : ui_thread_(ChromeThread::UI, &message_loop_) {
+ }
+
virtual void SetUp() {
// Name a subdirectory of the temp directory.
ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &test_dir_));
@@ -30,6 +34,7 @@ class ProfileManagerTest : public testing::Test {
}
MessageLoopForUI message_loop_;
+ ChromeThread ui_thread_;
// the path to temporary directory used to contain the test operations
FilePath test_dir_;