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

Unified Diff: chrome/browser/process_singleton_win.cc

Issue 10557040: Merge 142682 - Move the window destruction and registration out of cleanup and into BrowserProcessI… (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1132/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_win.cc
===================================================================
--- chrome/browser/process_singleton_win.cc (revision 142750)
+++ chrome/browser/process_singleton_win.cc (working copy)
@@ -199,7 +199,14 @@
}
ProcessSingleton::~ProcessSingleton() {
- Cleanup();
+ // We need to unregister the window as late as possible so that we can detect
+ // another instance of chrome running. Otherwise we may end up writing out
+ // data while a new chrome is starting up.
+ if (window_) {
+ ::DestroyWindow(window_);
+ ::UnregisterClass(chrome::kMessageWindowClass,
+ base::GetModuleFromAddress(&ThunkWndProc));
+ }
}
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
@@ -304,18 +311,6 @@
}
void ProcessSingleton::Cleanup() {
- // Window classes registered by DLLs are not cleaned up automatically on
- // process exit, so we must unregister at the earliest chance possible.
- // During the fast shutdown sequence, ProcessSingleton::Cleanup() is
- // called if our process was the first to start. Therefore we try cleaning
- // up here, and again in the destructor if needed to catch as many cases
- // as possible.
- if (window_) {
- ::DestroyWindow(window_);
- ::UnregisterClass(chrome::kMessageWindowClass,
- base::GetModuleFromAddress(&ThunkWndProc));
- window_ = NULL;
- }
}
LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698