| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app/close_handle_hook_win.h" | 5 #include "chrome/app/close_handle_hook_win.h" |
| 6 | 6 |
| 7 #include <Windows.h> | 7 #include <Windows.h> |
| 8 #include <psapi.h> | 8 #include <psapi.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 it != hooks_.end(); ++it) { | 177 it != hooks_.end(); ++it) { |
| 178 (*it)->Unpatch(); | 178 (*it)->Unpatch(); |
| 179 delete *it; | 179 delete *it; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 bool UseHooks() { | 183 bool UseHooks() { |
| 184 #if defined(ARCH_CPU_X86_64) | 184 #if defined(ARCH_CPU_X86_64) |
| 185 return false; | 185 return false; |
| 186 #elif defined(NDEBUG) | 186 #elif defined(NDEBUG) |
| 187 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 187 version_info::Channel channel = chrome::VersionInfo::GetChannel(); |
| 188 if (channel == chrome::VersionInfo::CHANNEL_CANARY || | 188 if (channel == version_info::Channel::CANARY || |
| 189 channel == chrome::VersionInfo::CHANNEL_DEV || | 189 channel == version_info::Channel::DEV || |
| 190 channel == chrome::VersionInfo::CHANNEL_UNKNOWN) { | 190 channel == version_info::Channel::UNKNOWN) { |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 return false; | 194 return false; |
| 195 #else // NDEBUG | 195 #else // NDEBUG |
| 196 return true; | 196 return true; |
| 197 #endif | 197 #endif |
| 198 } | 198 } |
| 199 | 199 |
| 200 void PatchLoadedModules(CloseHandleHooks* hooks) { | 200 void PatchLoadedModules(CloseHandleHooks* hooks) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 223 // threads attempting to call CloseHandle. | 223 // threads attempting to call CloseHandle. |
| 224 hooks->AddEATPatch(); | 224 hooks->AddEATPatch(); |
| 225 PatchLoadedModules(hooks); | 225 PatchLoadedModules(hooks); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 void RemoveCloseHandleHooks() { | 229 void RemoveCloseHandleHooks() { |
| 230 // We are partching all loaded modules without forcing them to stay in memory, | 230 // We are partching all loaded modules without forcing them to stay in memory, |
| 231 // removing patches is not safe. | 231 // removing patches is not safe. |
| 232 } | 232 } |
| OLD | NEW |