Changeset 73387 in webkit
- Timestamp:
- Dec 6, 2010 12:34:47 PM (13 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r73383 r73387 1 2010-12-06 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Adam Roben. 4 5 Add a shim for IsWindowActive 6 https://bugs.webkit.org/show_bug.cgi?id=50582 7 8 * PluginProcess/mac/PluginProcessMac.mm: 9 (WebKit::isWindowActive): 10 Get the NetscapePlugin from the WindowRef and check if the plug-in's window is active. 11 12 (WebKit::PluginProcess::initializeShim): 13 * PluginProcess/mac/PluginProcessShim.cpp 14 (WebKit::shimIsWindowActive): 15 Call isWindowActive. If it returns true, return the result value. Otherwise, call the real 16 IsWindowActive function. 17 18 * PluginProcess/mac/PluginProcessShim.h: 19 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 20 (WebKit::NetscapePlugin::NetscapePlugin): 21 Initialize m_isWindowactive. 22 23 * WebProcess/Plugins/Netscape/NetscapePlugin.h: 24 (WebKit::NetscapePlugin::isWindowActive): 25 Return whether the window is active. 26 27 * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: 28 (WebKit::windowMap): 29 (WebKit::NetscapePlugin::platformPostInitialize): 30 (WebKit::NetscapePlugin::platformDestroy): 31 (WebKit::NetscapePlugin::netscapePluginFromWindow): 32 Add a mapping between windows and the corresponding NetscapePlugin objects. 33 34 (WebKit::NetscapePlugin::windowFocusChanged): 35 Update the window focus member variable. 36 1 37 2010-12-06 Anders Carlsson <andersca@apple.com> 2 38 -
trunk/WebKit2/PluginProcess/mac/PluginProcessMac.mm
r72972 r73387 28 28 #include "PluginProcess.h" 29 29 30 #include "NetscapePlugin.h" 30 31 #include "PluginProcessShim.h" 31 32 #include <dlfcn.h> … … 50 51 return isUserbreakSet; 51 52 } 52 53 54 static bool isWindowActive(WindowRef windowRef, bool& result) 55 { 56 #ifndef NP_NO_CARBON 57 if (NetscapePlugin* plugin = NetscapePlugin::netscapePluginFromWindow(windowRef)) { 58 result = plugin->isWindowActive(); 59 return true; 60 } 61 #endif 62 return false; 63 } 64 53 65 void PluginProcess::initializeShim() 54 66 { 55 67 const PluginProcessShimCallbacks callbacks = { 56 68 shouldCallRealDebugger, 69 isWindowActive, 57 70 }; 58 71 -
trunk/WebKit2/PluginProcess/mac/PluginProcessShim.cpp
r72973 r73387 54 54 } 55 55 56 static Boolean shimIsWindowActive(WindowRef window) 57 { 58 bool result; 59 if (pluginProcessShimCallbacks.isWindowActive(window, result)) 60 return result; 61 62 return IsWindowActive(window); 63 } 64 56 65 DYLD_INTERPOSE(shimDebugger, Debugger); 66 DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive); 67 57 68 #endif 58 69 -
trunk/WebKit2/PluginProcess/mac/PluginProcessShim.h
r72972 r73387 27 27 #define PluginProcessShim_h 28 28 29 #include <Carbon/Carbon.h> 30 29 31 namespace WebKit { 30 32 31 33 struct PluginProcessShimCallbacks { 32 34 bool (*shouldCallRealDebugger)(); 35 bool (*isWindowActive)(WindowRef, bool& result); 33 36 }; 34 37 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r73057 r73387 43 43 // The plug-in that we're currently calling NPP_New for. 44 44 static NetscapePlugin* currentNPPNewPlugin; 45 45 46 46 NetscapePlugin::NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule) 47 47 : m_pluginController(0) … … 63 63 , m_nullEventTimer(RunLoop::main(), this, &NetscapePlugin::nullEventTimerFired) 64 64 , m_npCGContext() 65 , m_isWindowActive(false) 65 66 #endif 66 67 #endif -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r73090 r73387 59 59 #ifndef NP_NO_CARBON 60 60 WindowRef windowRef() const; 61 bool isWindowActive() const { return m_isWindowActive; } 62 63 static NetscapePlugin* netscapePluginFromWindow(WindowRef); 61 64 #endif 62 65 #elif PLATFORM(WIN) … … 201 204 RunLoop::Timer<NetscapePlugin> m_nullEventTimer; 202 205 NP_CGContext m_npCGContext; 206 bool m_isWindowActive; 203 207 #endif 204 208 #elif PLATFORM(WIN) -
trunk/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
r73381 r73387 33 33 namespace WebKit { 34 34 35 #ifndef NP_NO_ QUICKDRAW35 #ifndef NP_NO_CARBON 36 36 static const double nullEventIntervalActive = 0.02; 37 37 static const double nullEventIntervalNotActive = 0.25; … … 80 80 return NPERR_NO_ERROR; 81 81 } 82 83 #ifndef NP_NO_CARBON 84 typedef HashMap<WindowRef, NetscapePlugin*> WindowMap; 85 86 static WindowMap& windowMap() 87 { 88 DEFINE_STATIC_LOCAL(WindowMap, windowMap, ()); 89 90 return windowMap; 91 } 92 #endif 82 93 83 94 bool NetscapePlugin::platformPostInitialize() … … 138 149 m_npWindow.window = &m_npCGContext; 139 150 151 ASSERT(!windowMap().contains(windowRef())); 152 windowMap().set(windowRef(), this); 153 140 154 // Start the null event timer. 141 155 // FIXME: Throttle null events when the plug-in isn't visible on screen. … … 155 169 DisposeWindow(static_cast<WindowRef>(m_npCGContext.window)); 156 170 171 ASSERT(windowMap().contains(windowRef())); 172 windowMap().remove(windowRef()); 173 157 174 // Stop the null event timer. 158 175 m_nullEventTimer.stop(); … … 181 198 182 199 #ifndef NP_NO_CARBON 200 NetscapePlugin* NetscapePlugin::netscapePluginFromWindow(WindowRef windowRef) 201 { 202 return windowMap().get(windowRef); 203 } 204 183 205 WindowRef NetscapePlugin::windowRef() const 184 206 { … … 603 625 #ifndef NP_NO_CARBON 604 626 case NPEventModelCarbon: { 627 m_isWindowActive = hasFocus; 628 605 629 HiliteWindow(windowRef(), hasFocus); 606 630 if (hasFocus)
Note: See TracChangeset
for help on using the changeset viewer.