Commit afd20c02 authored by mattm@chromium.org's avatar mattm@chromium.org

Win: Fix race possible during startup before first Browser is created.

BUG=38572
TEST=uitest, also "chrome/Debug/chrome.exe & chrome/Debug/chrome.exe"

Review URL: http://codereview.chromium.org/2664004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49348 0039d316-1c4b-4281-b951-d872f2087c98
parent 2d79de25
......@@ -86,6 +86,7 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
created_devtools_manager_(false),
created_notification_ui_manager_(false),
module_ref_count_(0),
did_start_(false),
checked_for_new_frames_(false),
using_new_frames_(false),
have_inspector_files_(true) {
......@@ -209,6 +210,7 @@ static void PostQuit(MessageLoop* message_loop) {
unsigned int BrowserProcessImpl::AddRefModule() {
DCHECK(CalledOnValidThread());
did_start_ = true;
module_ref_count_++;
return module_ref_count_;
}
......
......@@ -171,7 +171,7 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
virtual bool IsShuttingDown() {
DCHECK(CalledOnValidThread());
return 0 == module_ref_count_;
return did_start_ && 0 == module_ref_count_;
}
virtual printing::PrintJobManager* print_job_manager();
......@@ -303,6 +303,7 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
scoped_ptr<NotificationService> main_notification_service_;
unsigned int module_ref_count_;
bool did_start_;
// Ensures that all the print jobs are finished before closing the browser.
scoped_ptr<printing::PrintJobManager> print_job_manager_;
......
......@@ -200,9 +200,7 @@ void ProcessSingleton::Cleanup() {
LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) {
// If locked, it means we are not ready to process this message because
// we are probably in a first run critical phase. We must do this before
// doing the IsShuttingDown() check since that returns true during first run
// (since g_browser_process hasn't been AddRefModule()d yet).
// we are probably in a first run critical phase.
if (locked_) {
// Attempt to place ourselves in the foreground / flash the task bar.
if (IsWindow(foreground_window_))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment