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 "build/intsafe_workaround.h" | 5 #include "build/intsafe_workaround.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <atlctl.h> | 9 #include <atlctl.h> |
10 #include <initguid.h> | 10 #include <initguid.h> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 base::win::ScopedComPtr<IUnknown> instance_; | 86 base::win::ScopedComPtr<IUnknown> instance_; |
87 DWORD registration_token_; | 87 DWORD registration_token_; |
88 }; | 88 }; |
89 | 89 |
90 DelegateExecuteModule _AtlModule; | 90 DelegateExecuteModule _AtlModule; |
91 | 91 |
92 using delegate_execute::DelegateExecuteOperation; | 92 using delegate_execute::DelegateExecuteOperation; |
93 using base::win::ScopedHandle; | 93 using base::win::ScopedHandle; |
94 | 94 |
95 int RelaunchChrome(const DelegateExecuteOperation& operation) { | 95 int RelaunchChrome(const DelegateExecuteOperation& operation) { |
96 AtlTrace("Relaunching [%ls] with flags [%s]\n", | 96 AtlTrace("Relaunching [%ls] with flags [%ls]\n", |
97 operation.mutex().c_str(), operation.relaunch_flags()); | 97 operation.mutex().c_str(), operation.relaunch_flags().c_str()); |
98 ScopedHandle mutex(OpenMutexW(SYNCHRONIZE, FALSE, operation.mutex().c_str())); | 98 ScopedHandle mutex(OpenMutexW(SYNCHRONIZE, FALSE, operation.mutex().c_str())); |
99 if (mutex.IsValid()) { | 99 if (mutex.IsValid()) { |
100 const int kWaitSeconds = 5; | 100 const int kWaitSeconds = 5; |
101 DWORD result = ::WaitForSingleObject(mutex, kWaitSeconds * 1000); | 101 DWORD result = ::WaitForSingleObject(mutex, kWaitSeconds * 1000); |
102 if (result == WAIT_ABANDONED) { | 102 if (result == WAIT_ABANDONED) { |
103 // This is the normal case. Chrome exits and windows marks the mutex as | 103 // This is the normal case. Chrome exits and windows marks the mutex as |
104 // abandoned. | 104 // abandoned. |
105 } else if (result == WAIT_OBJECT_0) { | 105 } else if (result == WAIT_OBJECT_0) { |
106 // This is unexpected. Check if somebody is not closing the mutex on | 106 // This is unexpected. Check if somebody is not closing the mutex on |
107 // RelaunchChromehelper, the mutex should not be closed. | 107 // RelaunchChromehelper, the mutex should not be closed. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 case DelegateExecuteOperation::RELAUNCH_CHROME: | 156 case DelegateExecuteOperation::RELAUNCH_CHROME: |
157 ret_code = RelaunchChrome(operation); | 157 ret_code = RelaunchChrome(operation); |
158 break; | 158 break; |
159 default: | 159 default: |
160 NOTREACHED(); | 160 NOTREACHED(); |
161 } | 161 } |
162 } | 162 } |
163 AtlTrace("delegate_execute exit, code = %d\n", ret_code); | 163 AtlTrace("delegate_execute exit, code = %d\n", ret_code); |
164 return ret_code; | 164 return ret_code; |
165 } | 165 } |
OLD | NEW |