summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-28 19:00:51 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-28 19:00:51 +0000
commitb2cc9fb19dc373296efe4db346d8ec9b58af5111 (patch)
tree29b609a7c152716fe9cff905fb23b2c6bf8c9d96 /chrome/plugin
parentdcf29616d0390738f5c36ad344f7d28f37a916f6 (diff)
downloadchromium_src-b2cc9fb19dc373296efe4db346d8ec9b58af5111.zip
chromium_src-b2cc9fb19dc373296efe4db346d8ec9b58af5111.tar.gz
chromium_src-b2cc9fb19dc373296efe4db346d8ec9b58af5111.tar.bz2
Use an opaque handle type to pass WebPluginDelegateImpl across dylib boundaries
This works around a wicked new clang linker optimization, but also feels cleaner in general. BUG=http://llvm.org/bugs/show_bug.cgi?id=8478 TEST=clang/mac builder stays green with newer clang version Review URL: http://codereview.chromium.org/4191003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64289 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/plugin_interpose_util_mac.h12
-rw-r--r--chrome/plugin/plugin_interpose_util_mac.mm18
2 files changed, 16 insertions, 14 deletions
diff --git a/chrome/plugin/plugin_interpose_util_mac.h b/chrome/plugin/plugin_interpose_util_mac.h
index 00119a7..879fc65 100644
--- a/chrome/plugin/plugin_interpose_util_mac.h
+++ b/chrome/plugin/plugin_interpose_util_mac.h
@@ -10,7 +10,9 @@
#import "base/basictypes.h"
-class WebPluginDelegateImpl;
+// This is really a WebPluginDelegateImpl, but that class is private to the
+// framework, and these functions are called from a dylib.
+typedef void* OpaquePluginRef;
namespace mac_plugin_interposing {
@@ -22,7 +24,7 @@ void SetUpCocoaInterposing();
void SwitchToPluginProcess();
// Returns the delegate currently processing events.
-WebPluginDelegateImpl* GetActiveDelegate();
+OpaquePluginRef GetActiveDelegate();
// Sends a message to the browser process to inform it that the given window
// has been brought forward.
@@ -40,15 +42,15 @@ void NotifyBrowserOfPluginShowWindow(uint32 window_id, CGRect bounds,
void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds);
// Sends a message to the plugin that a theme cursor was set.
-void NotifyPluginOfSetThemeCursor(WebPluginDelegateImpl* delegate,
+void NotifyPluginOfSetThemeCursor(OpaquePluginRef delegate,
ThemeCursor cursor);
// Sends a message to the plugin that a cursor was set.
-void NotifyPluginOfSetCursor(WebPluginDelegateImpl* delegate,
+void NotifyPluginOfSetCursor(OpaquePluginRef delegate,
const Cursor* cursor);
// Returns true if the window containing the given plugin delegate is focused.
-bool GetPluginWindowHasFocus(const WebPluginDelegateImpl* delegate);
+bool GetPluginWindowHasFocus(const OpaquePluginRef delegate);
} // namespace MacPluginInterpose
diff --git a/chrome/plugin/plugin_interpose_util_mac.mm b/chrome/plugin/plugin_interpose_util_mac.mm
index 10f1639..45df449 100644
--- a/chrome/plugin/plugin_interpose_util_mac.mm
+++ b/chrome/plugin/plugin_interpose_util_mac.mm
@@ -31,7 +31,7 @@ void SwitchToPluginProcess() {
}
__attribute__((visibility("default")))
-WebPluginDelegateImpl* GetActiveDelegate() {
+OpaquePluginRef GetActiveDelegate() {
return WebPluginDelegateImpl::GetActiveDelegate();
}
@@ -70,15 +70,15 @@ void NotifyBrowserOfPluginHideWindow(uint32 window_id, CGRect bounds) {
}
__attribute__((visibility("default")))
-void NotifyPluginOfSetThemeCursor(WebPluginDelegateImpl* delegate,
+void NotifyPluginOfSetThemeCursor(OpaquePluginRef delegate,
ThemeCursor cursor) {
- delegate->SetThemeCursor(cursor);
+ static_cast<WebPluginDelegateImpl*>(delegate)->SetThemeCursor(cursor);
}
__attribute__((visibility("default")))
-void NotifyPluginOfSetCursor(WebPluginDelegateImpl* delegate,
+void NotifyPluginOfSetCursor(OpaquePluginRef delegate,
const Cursor* cursor) {
- delegate->SetCursor(cursor);
+ static_cast<WebPluginDelegateImpl*>(delegate)->SetCursor(cursor);
}
void NotifyPluginOfSetCursorVisibility(bool visibility) {
@@ -90,8 +90,8 @@ void NotifyPluginOfSetCursorVisibility(bool visibility) {
}
__attribute__((visibility("default")))
-bool GetPluginWindowHasFocus(const WebPluginDelegateImpl* delegate) {
- return delegate->GetWindowHasFocus();
+bool GetPluginWindowHasFocus(const OpaquePluginRef delegate) {
+ return static_cast<WebPluginDelegateImpl*>(delegate)->GetWindowHasFocus();
}
} // namespace mac_plugin_interposing
@@ -235,9 +235,9 @@ static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) {
@implementation NSCursor (ChromePluginInterposing)
- (void)chromePlugin_set {
- WebPluginDelegateImpl* delegate = mac_plugin_interposing::GetActiveDelegate();
+ OpaquePluginRef delegate = mac_plugin_interposing::GetActiveDelegate();
if (delegate) {
- delegate->SetNSCursor(self);
+ static_cast<WebPluginDelegateImpl*>(delegate)->SetNSCursor(self);
return;
}
[self chromePlugin_set];