Index: chrome/browser/browser_process_impl.cc |
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc |
index 6417c8e046d6eb0001975f42885efefe22181433..d819c0eb0e9cfbfdc0343d5a56c74898ae7a61ef 100644 |
--- a/chrome/browser/browser_process_impl.cc |
+++ b/chrome/browser/browser_process_impl.cc |
@@ -190,8 +190,7 @@ BrowserProcessImpl::BrowserProcessImpl( |
created_icon_manager_(false), |
created_notification_ui_manager_(false), |
created_safe_browsing_service_(false), |
- module_ref_count_(0), |
- did_start_(false), |
+ shutting_down_(false), |
tearing_down_(false), |
download_status_updater_(new DownloadStatusUpdater), |
local_state_task_runner_(local_state_task_runner), |
@@ -362,7 +361,7 @@ void BrowserProcessImpl::PostDestroyThreads() { |
} |
#endif // !defined(OS_ANDROID) |
-unsigned int BrowserProcessImpl::AddRefModule() { |
+void BrowserProcessImpl::Pin() { |
DCHECK(CalledOnValidThread()); |
// CHECK(!IsShuttingDown()); |
@@ -373,44 +372,35 @@ unsigned int BrowserProcessImpl::AddRefModule() { |
base::debug::Alias(&callstack); |
CHECK(false); |
} |
- |
- did_start_ = true; |
- module_ref_count_++; |
- return module_ref_count_; |
} |
-unsigned int BrowserProcessImpl::ReleaseModule() { |
+void BrowserProcessImpl::Unpin() { |
DCHECK(CalledOnValidThread()); |
- DCHECK_NE(0u, module_ref_count_); |
- module_ref_count_--; |
- if (0 == module_ref_count_) { |
- release_last_reference_callstack_ = base::debug::StackTrace(); |
+ release_last_reference_callstack_ = base::debug::StackTrace(); |
+ shutting_down_ = true; |
#if defined(ENABLE_PRINTING) |
- // Wait for the pending print jobs to finish. Don't do this later, since |
- // this might cause a nested message loop to run, and we don't want pending |
- // tasks to run once teardown has started. |
- print_job_manager_->Shutdown(); |
+ // Wait for the pending print jobs to finish. Don't do this later, since |
+ // this might cause a nested message loop to run, and we don't want pending |
+ // tasks to run once teardown has started. |
+ print_job_manager_->Shutdown(); |
#endif |
#if defined(LEAK_SANITIZER) |
- // Check for memory leaks now, before we start shutting down threads. Doing |
- // this early means we won't report any shutdown-only leaks (as they have |
- // not yet happened at this point). |
- // If leaks are found, this will make the process exit immediately. |
- __lsan_do_leak_check(); |
+ // Check for memory leaks now, before we start shutting down threads. Doing |
+ // this early means we won't report any shutdown-only leaks (as they have |
+ // not yet happened at this point). |
+ // If leaks are found, this will make the process exit immediately. |
+ __lsan_do_leak_check(); |
#endif |
- CHECK(base::MessageLoop::current()->is_running()); |
+ CHECK(base::MessageLoop::current()->is_running()); |
#if defined(OS_MACOSX) |
- base::MessageLoop::current()->PostTask( |
- FROM_HERE, |
- base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); |
+ base::MessageLoop::current()->PostTask( |
+ FROM_HERE, base::Bind(ChromeBrowserMainPartsMac::DidEndMainMessageLoop)); |
#endif |
- base::MessageLoop::current()->QuitWhenIdle(); |
- } |
- return module_ref_count_; |
+ base::MessageLoop::current()->QuitWhenIdle(); |
} |
namespace { |
@@ -689,7 +679,7 @@ bool BrowserProcessImpl::IsShuttingDown() { |
DCHECK(CalledOnValidThread()); |
// TODO(crbug.com/560486): Fix the tests that make the check of |
// |tearing_down_| necessary here. |
- return (did_start_ && 0 == module_ref_count_) || tearing_down_; |
+ return shutting_down_ || tearing_down_; |
} |
printing::PrintJobManager* BrowserProcessImpl::print_job_manager() { |