Changeset 177986 in webkit


Ignore:
Timestamp:
Jan 6, 2015, 12:43:22 PM (11 years ago)
Author:
andersca@apple.com
Message:

Reimplement NPN_PluginThreadAsyncCall without using PluginMainThreadScheduler
https://bugs.webkit.org/show_bug.cgi?id=140140

Reviewed by Andreas Kling.

Just use a dispatch_async call to the main queue. This will let us move PluginMainThreadScheduler
out of WebCore since nobody else is using it.

  • Plugins/WebNetscapePluginView.h:
  • Plugins/WebNetscapePluginView.mm:

(-[WebNetscapePluginView _createPlugin]):
(-[WebNetscapePluginView _destroyPlugin]):

  • Plugins/npapi.mm:

(NPN_PluginThreadAsyncCall):

Location:
trunk/Source/WebKit/mac
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r177985 r177986  
     12015-01-06  Anders Carlsson  <andersca@apple.com>
     2
     3        Reimplement NPN_PluginThreadAsyncCall without using PluginMainThreadScheduler
     4        https://bugs.webkit.org/show_bug.cgi?id=140140
     5
     6        Reviewed by Andreas Kling.
     7
     8        Just use a dispatch_async call to the main queue. This will let us move PluginMainThreadScheduler
     9        out of WebCore since nobody else is using it.
     10
     11        * Plugins/WebNetscapePluginView.h:
     12        * Plugins/WebNetscapePluginView.mm:
     13        (-[WebNetscapePluginView _createPlugin]):
     14        (-[WebNetscapePluginView _destroyPlugin]):
     15        * Plugins/npapi.mm:
     16        (NPN_PluginThreadAsyncCall):
     17
    1182015-01-06  Anders Carlsson  <andersca@apple.com>
    219
  • trunk/Source/WebKit/mac/Plugins/WebNetscapePluginView.h

    r168047 r177986  
    6161@interface WebNetscapePluginView : WebBaseNetscapePluginView<WebPluginManualLoader, WebPluginContainerCheckController>
    6262{
     63@package
    6364    RefPtr<WebNetscapePluginStream> _manualStream;
    6465    RetainPtr<CALayer> _pluginLayer;
  • trunk/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm

    r170774 r177986  
    6666#import <WebCore/HTMLPlugInElement.h>
    6767#import <WebCore/Page.h>
    68 #import <WebCore/PluginMainThreadScheduler.h>
    6968#import <WebCore/ProxyServer.h>
    7069#import <WebCore/ScriptController.h>
     
    23592358    ASSERT(pluginFunctionCallDepth == 0);
    23602359
    2361     PluginMainThreadScheduler::scheduler().registerPlugin(plugin);
    2362 
    23632360    _isFlash = [_pluginPackage.get() bundleIdentifier] == "com.macromedia.Flash Player.plugin";
    23642361    _isSilverlight = [_pluginPackage.get() bundleIdentifier] == "com.microsoft.SilverlightPlugin";
     
    23752372- (void)_destroyPlugin
    23762373{
    2377     PluginMainThreadScheduler::scheduler().unregisterPlugin(plugin);
    2378    
    23792374    if (_isSilverlight)
    23802375        [self _workaroundSilverlightFullscreenBug:NO];
  • trunk/Source/WebKit/mac/Plugins/npapi.mm

    r168047 r177986  
    3232#import "WebNetscapePluginView.h"
    3333#import "WebKitLogging.h"
    34 #import <WebCore/PluginMainThreadScheduler.h>
    3534
    3635using namespace WebCore;
     
    174173void NPN_PluginThreadAsyncCall(NPP instance, void (*func) (void *), void *userData)
    175174{
    176     PluginMainThreadScheduler::scheduler().scheduleCall(instance, func, userData);
     175    WebNetscapePluginView *pluginView = pluginViewForInstance(instance);
     176
     177    dispatch_async(dispatch_get_main_queue(), ^{
     178        if (!pluginView || !pluginView->plugin) {
     179            // The plug-in has already been destroyed.
     180            return;
     181        }
     182
     183        func(userData);
     184    });
    177185}
    178186
Note: See TracChangeset for help on using the changeset viewer.