| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_frame/vtable_patch_manager.h" | 5 #include "chrome_frame/vtable_patch_manager.h" |
| 6 | 6 |
| 7 #include <atlcomcli.h> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <atlcomcli.h> | |
| 9 | 10 |
| 10 #include "base/atomicops.h" | 11 #include "base/atomicops.h" |
| 11 #include "base/lock.h" | 12 #include "base/lock.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 14 | 15 |
| 15 #include "chrome_frame/function_stub.h" | 16 #include "chrome_frame/function_stub.h" |
| 16 | 17 |
| 17 namespace vtable_patch { | 18 namespace vtable_patch { |
| 18 | 19 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 DLOG(WARNING) << "Attempting to patch two different VTables with the " | 84 DLOG(WARNING) << "Attempting to patch two different VTables with the " |
| 84 "same VTable information, or patching the same interface on " | 85 "same VTable information, or patching the same interface on " |
| 85 "multiple threads"; | 86 "multiple threads"; |
| 86 continue; | 87 continue; |
| 87 } | 88 } |
| 88 | 89 |
| 89 PROC original_fn = vtable[it->index_]; | 90 PROC original_fn = vtable[it->index_]; |
| 90 FunctionStub* stub = NULL; | 91 FunctionStub* stub = NULL; |
| 91 | 92 |
| 92 #ifndef NDEBUG | 93 #ifndef NDEBUG |
| 93 FunctionStub::FromCode(original_fn); | 94 stub = FunctionStub::FromCode(original_fn); |
| 94 if (stub != NULL) { | 95 if (stub != NULL) { |
| 95 DLOG(ERROR) << "attempt to patch a function that's already patched"; | 96 DLOG(ERROR) << "attempt to patch a function that's already patched"; |
| 96 DCHECK(stub->destination_function() == | 97 DCHECK(stub->destination_function() == |
| 97 reinterpret_cast<uintptr_t>(it->method_)) << | 98 reinterpret_cast<uintptr_t>(it->method_)) << |
| 98 "patching the same method multiple times with different hooks?"; | 99 "patching the same method multiple times with different hooks?"; |
| 99 continue; | 100 continue; |
| 100 } | 101 } |
| 101 #endif | 102 #endif |
| 102 | 103 |
| 103 stub = FunctionStub::Create(reinterpret_cast<uintptr_t>(original_fn), | 104 stub = FunctionStub::Create(reinterpret_cast<uintptr_t>(original_fn), |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 234 } |
| 234 patch_list_.clear(); | 235 patch_list_.clear(); |
| 235 patch_list_lock_.Release(); | 236 patch_list_lock_.Release(); |
| 236 | 237 |
| 237 return true; | 238 return true; |
| 238 } | 239 } |
| 239 | 240 |
| 240 #endif // disabled DynamicPatchManager | 241 #endif // disabled DynamicPatchManager |
| 241 | 242 |
| 242 } // namespace vtable_patch | 243 } // namespace vtable_patch |
| OLD | NEW |