Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5268)

Unified Diff: chrome_frame/buggy_bho_handling.h

Issue 6493002: A number of poorly written IE BHO's crash IE if ChromeFrame is the currently ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome_frame/buggy_bho_handling.h
===================================================================
--- chrome_frame/buggy_bho_handling.h (revision 74374)
+++ chrome_frame/buggy_bho_handling.h (working copy)
@@ -11,7 +11,8 @@
#include <vector>
-#include "base/threading/thread_local.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
namespace buggy_bho {
@@ -21,22 +22,28 @@
DISPPARAMS* params, VARIANT* result,
EXCEPINFO* ei, UINT* err);
-// Construct an instance of this class on the stack when firing web browser
-// events that can be sent to buggy BHOs. This class will intercept those
+// Construct an instance of this class before firing web browser events that
+// can be sent to buggy BHOs. This class will intercept those
// BHOs (see list in cc file) and ignore notifications to those components
-// for as long as the BuggyBhoTls instance on the stack lives.
-class BuggyBhoTls {
+// as long as ChromeFrame is the active view.
+class BuggyBhoHandler {
public:
- BuggyBhoTls();
- ~BuggyBhoTls();
+ BuggyBhoHandler();
+ ~BuggyBhoHandler();
- // Call after instantiating an instance of BuggyBhoTls. This method traverses
- // the list of DWebBrowserEvents and DWebBrowserEvents2 subscribers and checks
- // if any of the sinks belong to a list of known-to-be-buggy BHOs.
- // For each of those, a patch will be applied that temporarily ignores certain
- // invokes.
+ // Call after instantiating an instance of BuggyBhoHandler. This method
+ // traverses the list of DWebBrowserEvents and DWebBrowserEvents2 subscribers
+ // and checks if any of the sinks belong to a list of known-to-be-buggy BHOs.
+ // For each of those, a patch will be applied that temporarily ignores
+ // certain invokes.
static HRESULT PatchBuggyBHOs(IWebBrowser2* browser);
+ // Returns a pointer to the global BuggyBhoHandler instance.
+ static BuggyBhoHandler* GetInstance();
+
+ // Removes buggy object information for the thread passed in.
+ static void ClearBuggyObjectsForThread(base::PlatformThreadId thread_id);
+
protected:
// internal implementation:
@@ -48,13 +55,10 @@
// object running on the same thread (e.g. IE6) with one running CF and the
// other MSHTML. We don't want to drop events being fired by MSHTML, only
// events fired by CF since these BHOs should handle MSHTML correctly.
- bool IsBuggyObject(IDispatch* obj) const;
+ bool ShouldSkipInvoke(IDispatch* obj);
// Static, protected member methods
- // Returns the currently registered (TLS) BuggyBhoTls instance or NULL.
- static BuggyBhoTls* FromCurrentThread();
-
// Patches a subscriber if it belongs to a buggy dll.
static bool PatchIfBuggy(CONNECTDATA* cd, const IID& diid);
@@ -69,16 +73,17 @@
VARIANT* result, EXCEPINFO* ei, UINT* err);
protected:
+ struct ObjectInfo {
+ // The object interface pointer.
+ IDispatch* disp_interface;
+ // The thread with which the object interface is associated.
+ base::PlatformThreadId object_thread_id;
+ };
// List of buggy subscribers.
- std::vector<IDispatch*> bad_objects_;
-
- // Pointer to a previous instance of BuggyBhoTls on this thread if any.
- // Under regular circumstances, this will be NULL. However, there's a chance
- // that we could get reentrant calls, hence we maintain a stack.
- BuggyBhoTls* previous_instance_;
-
- // Where we store the current thread's instance.
- static base::ThreadLocalPointer<BuggyBhoTls> s_bad_object_tls_;
+ std::vector<ObjectInfo> bad_objects_;
+ // used to serialize access to the list of buggy bho's as these could be
+ // accessed from multiple IE UI threads.
tommi (sloooow) - chröme 2011/02/11 14:49:02 Would it be better to store this list with the TLS
+ base::Lock lock_;
};
} // end namespace buggy_bho

Powered by Google App Engine
This is Rietveld 408576698