summaryrefslogtreecommitdiffstats
path: root/chrome_frame/vtable_patch_manager.h
diff options
context:
space:
mode:
authorsiggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 21:09:02 +0000
committersiggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 21:09:02 +0000
commitd999c7c3f4bd9c7c779b4c06ee148d3d0d227e60 (patch)
treed4fca3d3c24d56a325000a4129d11c35b548abfa /chrome_frame/vtable_patch_manager.h
parent722ed48734460567be2c97590a036480c4667815 (diff)
downloadchromium_src-d999c7c3f4bd9c7c779b4c06ee148d3d0d227e60.zip
chromium_src-d999c7c3f4bd9c7c779b4c06ee148d3d0d227e60.tar.gz
chromium_src-d999c7c3f4bd9c7c779b4c06ee148d3d0d227e60.tar.bz2
Reimplementation of FunctionStub to avoid rewriting potentially executing code for a slight improvement in thread safety.
Make VTABLE patching treadsafe to the extent possible. As-is it's now safe against itself running on other threads at lease, as well as against other similar implementations, though the inherent VM operation race is resolved by retrying. BUG=27415 TEST=Included unittests. Review URL: http://codereview.chromium.org/992008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/vtable_patch_manager.h')
-rw-r--r--chrome_frame/vtable_patch_manager.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome_frame/vtable_patch_manager.h b/chrome_frame/vtable_patch_manager.h
index f326def..acf3cdb 100644
--- a/chrome_frame/vtable_patch_manager.h
+++ b/chrome_frame/vtable_patch_manager.h
@@ -12,9 +12,20 @@
#include "base/lock.h"
struct FunctionStub;
+
// This namespace provides methods to patch VTable methods of COM interfaces.
namespace vtable_patch {
+// Internal implementation, exposed only for testing.
+namespace internal {
+
+// Replaces *entry with new_proc iff *entry is curr_proc.
+// Returns true iff *entry was rewritten.
+// Note: does not crash on access violation.
+bool ReplaceFunctionPointer(void** entry, void* new_proc, void* curr_proc);
+
+} // namespace internal
+
// This structure represents information about one VTable method.
// We allocate an array of these structures per VTable that we patch to
// remember the original method. We also use this structure to actually