diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-17 04:48:37 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-17 04:48:37 +0000 |
commit | 3f55e8712f88d8477d9e58f68958e83c92664389 (patch) | |
tree | 21f9eeeda041fd570c31d8b0f266f780b767418f /chrome_frame/vtable_patch_manager.h | |
parent | cd1c89e833b7e67b7a7ca8799122e07b65999771 (diff) | |
download | chromium_src-3f55e8712f88d8477d9e58f68958e83c92664389.zip chromium_src-3f55e8712f88d8477d9e58f68958e83c92664389.tar.gz chromium_src-3f55e8712f88d8477d9e58f68958e83c92664389.tar.bz2 |
Add the chromeframe tag to the user agent header at runtime instead of statically in the registry.TEST=Try disabling GCF and see if the chromeframe tag in the user agent is still set. It should not be. Also make sure you don't have an older version installed... the chromeframe tag should not be in the registry - if it is, you've got an older version still registered. This should fix the issue with going to wave.google.com after disabling chrome frame and seeing the white page of death.R=amitBUG=22760
Review URL: http://codereview.chromium.org/259025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/vtable_patch_manager.h')
-rw-r--r-- | chrome_frame/vtable_patch_manager.h | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/chrome_frame/vtable_patch_manager.h b/chrome_frame/vtable_patch_manager.h index 944b9ef..f326def 100644 --- a/chrome_frame/vtable_patch_manager.h +++ b/chrome_frame/vtable_patch_manager.h @@ -2,11 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_FRAME_COMMON_VTABLE_PATCH_MANAGER_H_ -#define CHROME_FRAME_COMMON_VTABLE_PATCH_MANAGER_H_ +#ifndef CHROME_FRAME_VTABLE_PATCH_MANAGER_H_ +#define CHROME_FRAME_VTABLE_PATCH_MANAGER_H_ #include <windows.h> +#include <list> + +#include "base/lock.h" + struct FunctionStub; // This namespace provides methods to patch VTable methods of COM interfaces. namespace vtable_patch { @@ -39,13 +43,46 @@ HRESULT PatchInterfaceMethods(void* unknown, MethodPatchInfo* patches); // The last entry of patches must have index_ set to -1. HRESULT UnpatchInterfaceMethods(MethodPatchInfo* patches); +// Disabled as we're not using it atm. +#if 0 +// Used when dynamically patching zero or more (usually more than 1) +// implementations of a particular interface. +class DynamicPatchManager { + public: + explicit DynamicPatchManager(const MethodPatchInfo* patch_prototype); + ~DynamicPatchManager(); + + // Returns S_OK if the object was successfully patched, S_FALSE if it was + // already patched or an error value if something bad happened. + HRESULT PatchObject(void* unknown); + + bool UnpatchAll(); + + protected: + struct PatchedObject { + void* vtable_; + MethodPatchInfo patch_info_[1]; + + // Used to match PatchedObject instances based on the vtable when + // searching through the patch list. + bool operator==(const PatchedObject& that) const { + return vtable_ == that.vtable_; + } + }; + + typedef std::list<PatchedObject*> PatchList; + const MethodPatchInfo* patch_prototype_; + mutable Lock patch_list_lock_; + PatchList patch_list_; +}; +#endif // disable DynamicPatchManager + } // namespace vtable_patch // Begins the declaration of a VTable patch // @param IFName The name of the interface to patch #define BEGIN_VTABLE_PATCHES(IFName) \ vtable_patch::MethodPatchInfo IFName##_PatchInfo[] = { - // Defines a single method patch in a VTable // @param index The index of the method to patch // @param PatchFunction The patch function @@ -55,10 +92,27 @@ HRESULT UnpatchInterfaceMethods(MethodPatchInfo* patches); NULL, \ }, +#define DCHECK_IS_NOT_PATCHED(IFName) \ + for (vtable_patch::MethodPatchInfo* it = IFName##_PatchInfo; \ + it->index_ != -1; ++it) { \ + DCHECK(it->stub_ == NULL); \ + } + +#define DCHECK_IS_PATCHED(IFName) \ + for (vtable_patch::MethodPatchInfo* it = IFName##_PatchInfo; \ + it->index_ != -1; ++it) { \ + DCHECK(it->stub_ != NULL); \ + } + +// Checks if the interface is patched. Note that only the first method +// is checked and subsequent methods are assumed to have the same state. +#define IS_PATCHED(IFName) \ + (IFName##_PatchInfo[0].stub_ != NULL) + // Ends the declaration of a VTable patch by adding an entry with // index set to -1. #define END_VTABLE_PATCHES() \ -1, NULL, NULL \ }; -#endif // CHROME_FRAME_COMMON_VTABLE_PATCH_MANAGER_H_ +#endif // CHROME_FRAME_VTABLE_PATCH_MANAGER_H_ |