summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/threading/thread.cc1
-rw-r--r--base/threading/thread.h1
-rw-r--r--base/threading/thread_unittest.cc14
-rw-r--r--chrome/browser/browser_process_sub_thread.cc2
-rw-r--r--chrome/browser/browser_process_sub_thread.h2
-rw-r--r--chrome/browser/io_thread.cc14
-rw-r--r--chrome/browser/io_thread.h3
7 files changed, 10 insertions, 27 deletions
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index c0fb537..7a100ca 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -173,7 +173,6 @@ void Thread::ThreadMain() {
message_loop_ = NULL;
message_loop_proxy_ = NULL;
}
- CleanUpAfterMessageLoopDestruction();
thread_id_ = kInvalidThreadId;
}
diff --git a/base/threading/thread.h b/base/threading/thread.h
index 811dd80..379615d 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -25,7 +25,6 @@ namespace base {
// (1) Thread::CleanUp()
// (2) MessageLoop::~MessageLoop
// (3.b) MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop
-// (4) Thread::CleanUpAfterMessageLoopDestruction()
class Thread : PlatformThread::Delegate {
public:
struct Options {
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc
index 3748fc3..c7cb76a 100644
--- a/base/threading/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -57,7 +57,7 @@ class SleepInsideInitThread : public Thread {
enum ThreadEvent {
// Thread::Init() was called.
- THREAD_EVENT_INIT,
+ THREAD_EVENT_INIT = 0,
// The MessageLoop for the thread was deleted.
THREAD_EVENT_MESSAGE_LOOP_DESTROYED,
@@ -65,8 +65,8 @@ enum ThreadEvent {
// Thread::CleanUp() was called.
THREAD_EVENT_CLEANUP,
- // Thread::CleanUpAfterMessageLoopDestruction() was called.
- THREAD_EVENT_CLEANUP_AFTER_LOOP,
+ // Keep at end of list.
+ THREAD_NUM_EVENTS
};
typedef std::vector<ThreadEvent> EventList;
@@ -93,10 +93,6 @@ class CaptureToEventList : public Thread {
event_list_->push_back(THREAD_EVENT_CLEANUP);
}
- virtual void CleanUpAfterMessageLoopDestruction() {
- event_list_->push_back(THREAD_EVENT_CLEANUP_AFTER_LOOP);
- }
-
private:
EventList* event_list_;
};
@@ -230,7 +226,6 @@ TEST_F(ThreadTest, SleepInsideInit) {
// (1) Thread::CleanUp()
// (2) MessageLoop::~MessageLoop()
// MessageLoop::DestructionObservers called.
-// (3) Thread::CleanUpAfterMessageLoopDestruction
TEST_F(ThreadTest, CleanUp) {
EventList captured_events;
CapturingDestructionObserver loop_destruction_observer(&captured_events);
@@ -252,9 +247,8 @@ TEST_F(ThreadTest, CleanUp) {
}
// Check the order of events during shutdown.
- ASSERT_EQ(4u, captured_events.size());
+ ASSERT_EQ(static_cast<size_t>(THREAD_NUM_EVENTS), captured_events.size());
EXPECT_EQ(THREAD_EVENT_INIT, captured_events[0]);
EXPECT_EQ(THREAD_EVENT_CLEANUP, captured_events[1]);
EXPECT_EQ(THREAD_EVENT_MESSAGE_LOOP_DESTROYED, captured_events[2]);
- EXPECT_EQ(THREAD_EVENT_CLEANUP_AFTER_LOOP, captured_events[3]);
}
diff --git a/chrome/browser/browser_process_sub_thread.cc b/chrome/browser/browser_process_sub_thread.cc
index 0ddbf3b..39729d0 100644
--- a/chrome/browser/browser_process_sub_thread.cc
+++ b/chrome/browser/browser_process_sub_thread.cc
@@ -28,7 +28,7 @@ void BrowserProcessSubThread::Init() {
notification_service_ = new NotificationService;
}
-void BrowserProcessSubThread::CleanUpAfterMessageLoopDestruction() {
+void BrowserProcessSubThread::CleanUp() {
delete notification_service_;
notification_service_ = NULL;
diff --git a/chrome/browser/browser_process_sub_thread.h b/chrome/browser/browser_process_sub_thread.h
index e46325b..1f79a5d 100644
--- a/chrome/browser/browser_process_sub_thread.h
+++ b/chrome/browser/browser_process_sub_thread.h
@@ -27,7 +27,7 @@ class BrowserProcessSubThread : public BrowserThread {
protected:
virtual void Init();
- virtual void CleanUpAfterMessageLoopDestruction();
+ virtual void CleanUp();
private:
// Each specialized thread has its own notification service.
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 34c18ff..1c66a84 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -430,20 +430,12 @@ void IOThread::CleanUp() {
delete globals_;
globals_ = NULL;
- BrowserProcessSubThread::CleanUp();
-}
+ // net::URLRequest instances must NOT outlive the IO thread.
+ base::debug::LeakTracker<net::URLRequest>::CheckForLeaks();
-void IOThread::CleanUpAfterMessageLoopDestruction() {
// This will delete the |notification_service_|. Make sure it's done after
// anything else can reference it.
- BrowserProcessSubThread::CleanUpAfterMessageLoopDestruction();
-
- // net::URLRequest instances must NOT outlive the IO thread.
- //
- // To allow for URLRequests to be deleted from
- // MessageLoop::DestructionObserver this check has to happen after CleanUp
- // (which runs before DestructionObservers).
- base::debug::LeakTracker<net::URLRequest>::CheckForLeaks();
+ BrowserProcessSubThread::CleanUp();
}
// static
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 2352225..d5ee15b 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -112,7 +112,6 @@ class IOThread : public BrowserProcessSubThread {
protected:
virtual void Init();
virtual void CleanUp();
- virtual void CleanUpAfterMessageLoopDestruction();
private:
static void RegisterPrefs(PrefService* local_state);
@@ -176,7 +175,7 @@ class IOThread : public BrowserProcessSubThread {
// Keeps track of all live ChromeURLRequestContextGetters, so the
// ChromeURLRequestContexts can be released during
- // IOThread::CleanUpAfterMessageLoopDestruction().
+ // IOThread::CleanUp().
std::list<ChromeURLRequestContextGetter*> url_request_context_getters_;
DISALLOW_COPY_AND_ASSIGN(IOThread);