Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: chrome/browser/chromeos/login/base_login_display_host.cc

Issue 6870016: Refcount browser process in BaseLoginDisplayHost so message loop does not exit (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Delete LoginDisplayHost in MessageLoop::Run() context in test framework. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/wizard_in_process_browser_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/base_login_display_host.h" 5 #include "chrome/browser/chromeos/login/base_login_display_host.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // BaseLoginDisplayHost -------------------------------------------------------- 83 // BaseLoginDisplayHost --------------------------------------------------------
84 84
85 BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds) 85 BaseLoginDisplayHost::BaseLoginDisplayHost(const gfx::Rect& background_bounds)
86 : background_bounds_(background_bounds) { 86 : background_bounds_(background_bounds) {
87 registrar_.Add( 87 registrar_.Add(
88 this, 88 this,
89 NotificationType::APP_TERMINATING, 89 NotificationType::APP_TERMINATING,
90 NotificationService::AllSources()); 90 NotificationService::AllSources());
91 DCHECK(default_host_ == NULL); 91 DCHECK(default_host_ == NULL);
92 default_host_ = this; 92 default_host_ = this;
93
94 // Add a reference count so the message loop won't exit when other
95 // message loop clients (e.g. menus) do.
96 g_browser_process->AddRefModule();
93 } 97 }
94 98
95 BaseLoginDisplayHost::~BaseLoginDisplayHost() { 99 BaseLoginDisplayHost::~BaseLoginDisplayHost() {
100 // A browser should already exist when destructor is called since
101 // deletion is scheduled with MessageLoop::DeleteSoon() from
102 // OnSessionStart(), so the browser will already have incremented
103 // the reference count.
104 g_browser_process->ReleaseModule();
105
96 default_host_ = NULL; 106 default_host_ = NULL;
97 } 107 }
98 108
99 // LoginDisplayHost implementation --------------------------------------------- 109 // LoginDisplayHost implementation ---------------------------------------------
100 110
101 void BaseLoginDisplayHost::OnSessionStart() { 111 void BaseLoginDisplayHost::OnSessionStart() {
102 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 112 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
103 } 113 }
104 114
105 void BaseLoginDisplayHost::StartWizard( 115 void BaseLoginDisplayHost::StartWizard(
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // user has changed to during OOBE. 285 // user has changed to during OOBE.
276 if (!timezone_name.empty()) { 286 if (!timezone_name.empty()) {
277 icu::TimeZone* timezone = icu::TimeZone::createTimeZone( 287 icu::TimeZone* timezone = icu::TimeZone::createTimeZone(
278 icu::UnicodeString::fromUTF8(timezone_name)); 288 icu::UnicodeString::fromUTF8(timezone_name));
279 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone); 289 chromeos::CrosLibrary::Get()->GetSystemLibrary()->SetTimezone(timezone);
280 } 290 }
281 } 291 }
282 } 292 }
283 293
284 } // namespace browser 294 } // namespace browser
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/wizard_in_process_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698