summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 22:57:02 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-02 22:57:02 +0000
commit54260fc80a2150e95646b15d12b2a415037dd028 (patch)
tree1a183d0d0de309f29264d49368d820ba91ff0f0e
parentbcd0234ff7b8c0e8628663b45ca98f8be306e756 (diff)
downloadchromium_src-54260fc80a2150e95646b15d12b2a415037dd028.zip
chromium_src-54260fc80a2150e95646b15d12b2a415037dd028.tar.gz
chromium_src-54260fc80a2150e95646b15d12b2a415037dd028.tar.bz2
Fix leaking ExtensionMessageService in ProfileManagerTest.
BUG=28824 TEST=tools/valgrind/chrome_tests.sh -t unit --gtest_filter=ProfileManagerTest.CreateProfile Review URL: http://codereview.chromium.org/455031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33611 0039d316-1c4b-4281-b951-d872f2087c98
-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.cc4
-rw-r--r--tools/valgrind/memcheck/suppressions.txt8
4 files changed, 5 insertions, 18 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..bd9e4d2 100644
--- a/chrome/browser/profile_manager_unittest.cc
+++ b/chrome/browser/profile_manager_unittest.cc
@@ -14,6 +14,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 +33,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_;
diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt
index 621176a..e0d9e32 100644
--- a/tools/valgrind/memcheck/suppressions.txt
+++ b/tools/valgrind/memcheck/suppressions.txt
@@ -1824,14 +1824,6 @@
fun:__cxa_atexit
}
{
- bug_28824
- Memcheck:Leak
- fun:_Znw*
- ...
- fun:_ZN7Profile13CreateProfileERK8FilePath
- fun:_ZN14ProfileManager13CreateProfileERK8FilePath
-}
-{
bug_29069
Memcheck:Leak
fun:_Znw*