| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 DCHECK(!remote_window_); | 295 DCHECK(!remote_window_); |
| 296 DCHECK(notification_callback_.is_null()); | 296 DCHECK(notification_callback_.is_null()); |
| 297 | 297 |
| 298 if (window_ != NULL) | 298 if (window_ != NULL) |
| 299 notification_callback_ = notification_callback; | 299 notification_callback_ = notification_callback; |
| 300 | 300 |
| 301 return window_ != NULL; | 301 return window_ != NULL; |
| 302 } | 302 } |
| 303 | 303 |
| 304 void ProcessSingleton::Cleanup() { | 304 void ProcessSingleton::Cleanup() { |
| 305 } |
| 306 |
| 307 void ProcessSingleton::UnregisterWindowClass() { |
| 305 // Window classes registered by DLLs are not cleaned up automatically on | 308 // Window classes registered by DLLs are not cleaned up automatically on |
| 306 // process exit, so we must unregister at the earliest chance possible. | 309 // process exit, so we must unregister at the earliest chance possible. |
| 307 // During the fast shutdown sequence, ProcessSingleton::Cleanup() is | |
| 308 // called if our process was the first to start. Therefore we try cleaning | |
| 309 // up here, and again in the destructor if needed to catch as many cases | |
| 310 // as possible. | |
| 311 if (window_) { | 310 if (window_) { |
| 312 ::DestroyWindow(window_); | 311 ::DestroyWindow(window_); |
| 313 ::UnregisterClass(chrome::kMessageWindowClass, | 312 ::UnregisterClass(chrome::kMessageWindowClass, |
| 314 base::GetModuleFromAddress(&ThunkWndProc)); | 313 base::GetModuleFromAddress(&ThunkWndProc)); |
| 315 window_ = NULL; | 314 window_ = NULL; |
| 316 } | 315 } |
| 317 } | 316 } |
| 318 | 317 |
| 319 LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { | 318 LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { |
| 320 // If locked, it means we are not ready to process this message because | 319 // If locked, it means we are not ready to process this message because |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 switch (message) { | 351 switch (message) { |
| 353 case WM_COPYDATA: | 352 case WM_COPYDATA: |
| 354 return OnCopyData(reinterpret_cast<HWND>(wparam), | 353 return OnCopyData(reinterpret_cast<HWND>(wparam), |
| 355 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 354 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
| 356 default: | 355 default: |
| 357 break; | 356 break; |
| 358 } | 357 } |
| 359 | 358 |
| 360 return ::DefWindowProc(hwnd, message, wparam, lparam); | 359 return ::DefWindowProc(hwnd, message, wparam, lparam); |
| 361 } | 360 } |
| OLD | NEW |