| 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <atlctl.h> | 7 #include <atlctl.h> |
| 8 #include <initguid.h> | 8 #include <initguid.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 using delegate_execute::DelegateExecuteOperation; | 91 using delegate_execute::DelegateExecuteOperation; |
| 92 using base::win::ScopedHandle; | 92 using base::win::ScopedHandle; |
| 93 | 93 |
| 94 int RelaunchChrome(const DelegateExecuteOperation& operation) { | 94 int RelaunchChrome(const DelegateExecuteOperation& operation) { |
| 95 AtlTrace("Relaunching [%ls] with flags [%ls]\n", | 95 AtlTrace("Relaunching [%ls] with flags [%ls]\n", |
| 96 operation.mutex().c_str(), operation.relaunch_flags().c_str()); | 96 operation.mutex().c_str(), operation.relaunch_flags().c_str()); |
| 97 ScopedHandle mutex(OpenMutexW(SYNCHRONIZE, FALSE, operation.mutex().c_str())); | 97 ScopedHandle mutex(OpenMutexW(SYNCHRONIZE, FALSE, operation.mutex().c_str())); |
| 98 if (mutex.IsValid()) { | 98 if (mutex.IsValid()) { |
| 99 const int kWaitSeconds = 5; | 99 const int kWaitSeconds = 5; |
| 100 DWORD result = ::WaitForSingleObject(mutex, kWaitSeconds * 1000); | 100 DWORD result = ::WaitForSingleObject(mutex.Get(), kWaitSeconds * 1000); |
| 101 if (result == WAIT_ABANDONED) { | 101 if (result == WAIT_ABANDONED) { |
| 102 // This is the normal case. Chrome exits and windows marks the mutex as | 102 // This is the normal case. Chrome exits and windows marks the mutex as |
| 103 // abandoned. | 103 // abandoned. |
| 104 } else if (result == WAIT_OBJECT_0) { | 104 } else if (result == WAIT_OBJECT_0) { |
| 105 // This is unexpected. Check if somebody is not closing the mutex on | 105 // This is unexpected. Check if somebody is not closing the mutex on |
| 106 // RelaunchChromehelper, the mutex should not be closed. | 106 // RelaunchChromehelper, the mutex should not be closed. |
| 107 AtlTrace("Unexpected release of the relaunch mutex!!\n"); | 107 AtlTrace("Unexpected release of the relaunch mutex!!\n"); |
| 108 } else if (result == WAIT_TIMEOUT) { | 108 } else if (result == WAIT_TIMEOUT) { |
| 109 // This could mean that Chrome is hung. Proceed to exterminate. | 109 // This could mean that Chrome is hung. Proceed to exterminate. |
| 110 DWORD pid = operation.GetParentPid(); | 110 DWORD pid = operation.GetParentPid(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 case DelegateExecuteOperation::RELAUNCH_CHROME: | 192 case DelegateExecuteOperation::RELAUNCH_CHROME: |
| 193 ret_code = RelaunchChrome(operation); | 193 ret_code = RelaunchChrome(operation); |
| 194 break; | 194 break; |
| 195 default: | 195 default: |
| 196 NOTREACHED(); | 196 NOTREACHED(); |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 AtlTrace("delegate_execute exit, code = %d\n", ret_code); | 199 AtlTrace("delegate_execute exit, code = %d\n", ret_code); |
| 200 return ret_code; | 200 return ret_code; |
| 201 } | 201 } |
| OLD | NEW |