[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

darin at apple.com darin at apple.com
Fri Feb 26 22:21:43 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 263805e73841ba47543fa40a221eeb051208c279
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 17 01:23:19 2010 +0000

    2010-02-16  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            Generalize delayed plug-in start for background tabs for use for other media
            https://bugs.webkit.org/show_bug.cgi?id=34981
    
            * WebView.cpp:
            (WebView::setCanStartPlugins): Change to call setCanStartMedia.
            In a later patch we can change the of the public function in the IDL file too,
            but for now this should be enough.
    2010-02-16  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            Generalize delayed plug-in start for background tabs for use for other media
            https://bugs.webkit.org/show_bug.cgi?id=34981
    
            * WebView/WebHTMLView.mm:
            (-[WebHTMLView viewWillMoveToWindow:]): Added comment.
            (-[WebHTMLView viewDidMoveToWindow]): Ditto.
    
            * WebView/WebView.mm:
            (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
            Call setCanStartMedia right away so that if this view is not in a window, it
            will not start any media.
            (-[WebView viewWillMoveToWindow:]): Call setCanStartMedia(false) when moving
            to a window of nil.
            (-[WebView viewDidMoveToWindow]): Call setCanStartMedia(true) when moved to
            a window that is non-nil.
    2010-02-16  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            Generalize delayed plug-in start for background tabs for use for other media
            https://bugs.webkit.org/show_bug.cgi?id=34981
    
            Also did some simple cleanup of HTMLMediaElement to get ready to make it
            a client of the same mechanism.
    
            * WebCore.base.exp: Added Page::setCanStartMedia and resorted.
            * WebCore.xcodeproj/project.pbxproj: Added MediaCanStartListener.h.
    
            * html/HTMLAudioElement.h: Added an implementation of isVideo since that
            is now a pure virtual function in HTMLMediaElement. Also made tagPriority
            private.
    
            * html/HTMLMediaElement.h: Made it clearer that HTMLMediaElement is an
            abstract base class by making its constructor protected and making the
            isVideo function a pure virtual function.
    
            * page/Page.cpp:
            (WebCore::Page::Page): Updated for name change from m_canStartPlugins
            to m_canStartMedia.
            (WebCore::Page::addMediaCanStartListener): Renamed and added an assertion.
            (WebCore::Page::removeUnstartedMedia): Ditto.
            (WebCore::Page::setCanStartMedia): Renamed plugin to media and moved
            the code here from PageWin.cpp. The main change from the one in PageWin.cpp
            is that this function calls mediaCanStart rather than explicitly calling a
            combination of start and dispatchDidFailToStartPlugin on a PluginView.
    
            * page/Page.h: Re-sorted forward class declarations. Renamed the plugin
            starting functions to media starting names and changed types from
            PluginView to MediaCanStartListener.
    
            * page/MediaCanStartListener.h: Added.
    
            * page/win/PageWin.cpp: Moved setCanStartPlugins to the platform-independent
            Page.cpp file so it can be used for more than just Windows plug-ins.
    
            * plugins/PluginView.cpp: Sorted includes.
            (WebCore::PluginView::startOrAddToUnstartedList): Use addMediaCanStartListener.
            (WebCore::PluginView::mediaCanStart): Added. Called when the page decides that
            media can start. Contains the code that used to be in Page::setCanStartPlugins.
            (WebCore::PluginView::removeFromUnstartedListIfNecessary): Use
            removeMediaCanStartListener.
    
            * plugins/PluginView.h: Adopted MediaCanStartListener.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54849 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8f6b450..9940102 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,52 @@
+2010-02-16  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Generalize delayed plug-in start for background tabs for use for other media
+        https://bugs.webkit.org/show_bug.cgi?id=34981
+
+        Also did some simple cleanup of HTMLMediaElement to get ready to make it
+        a client of the same mechanism.
+
+        * WebCore.base.exp: Added Page::setCanStartMedia and resorted.
+        * WebCore.xcodeproj/project.pbxproj: Added MediaCanStartListener.h.
+
+        * html/HTMLAudioElement.h: Added an implementation of isVideo since that
+        is now a pure virtual function in HTMLMediaElement. Also made tagPriority
+        private.
+
+        * html/HTMLMediaElement.h: Made it clearer that HTMLMediaElement is an
+        abstract base class by making its constructor protected and making the
+        isVideo function a pure virtual function.
+
+        * page/Page.cpp:
+        (WebCore::Page::Page): Updated for name change from m_canStartPlugins
+        to m_canStartMedia.
+        (WebCore::Page::addMediaCanStartListener): Renamed and added an assertion.
+        (WebCore::Page::removeUnstartedMedia): Ditto.
+        (WebCore::Page::setCanStartMedia): Renamed plugin to media and moved
+        the code here from PageWin.cpp. The main change from the one in PageWin.cpp
+        is that this function calls mediaCanStart rather than explicitly calling a
+        combination of start and dispatchDidFailToStartPlugin on a PluginView.
+
+        * page/Page.h: Re-sorted forward class declarations. Renamed the plugin
+        starting functions to media starting names and changed types from
+        PluginView to MediaCanStartListener.
+
+        * page/MediaCanStartListener.h: Added.
+
+        * page/win/PageWin.cpp: Moved setCanStartPlugins to the platform-independent
+        Page.cpp file so it can be used for more than just Windows plug-ins.
+
+        * plugins/PluginView.cpp: Sorted includes.
+        (WebCore::PluginView::startOrAddToUnstartedList): Use addMediaCanStartListener.
+        (WebCore::PluginView::mediaCanStart): Added. Called when the page decides that
+        media can start. Contains the code that used to be in Page::setCanStartPlugins.
+        (WebCore::PluginView::removeFromUnstartedListIfNecessary): Use
+        removeMediaCanStartListener.
+
+        * plugins/PluginView.h: Adopted MediaCanStartListener.
+
 2010-02-16  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 59e03f5..df43780 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -494,6 +494,7 @@ __ZN7WebCore4Page14setMediaVolumeEf
 __ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
 __ZN7WebCore4Page15backForwardListEv
 __ZN7WebCore4Page15didMoveOnscreenEv
+__ZN7WebCore4Page16setCanStartMediaEb
 __ZN7WebCore4Page16setDefersLoadingEb
 __ZN7WebCore4Page17willMoveOffscreenEv
 __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
@@ -652,7 +653,6 @@ __ZN7WebCore8Settings23setEditableLinkBehaviorENS_20EditableLinkBehaviorE
 __ZN7WebCore8Settings23setLoadDeferringEnabledEb
 __ZN7WebCore8Settings23setNeedsTigerMailQuirksEb
 __ZN7WebCore8Settings23setPluginAllowedRunTimeEj
-__ZN7WebCore8Settings28setFrameSetFlatteningEnabledEb
 __ZN7WebCore8Settings23setUsesEncodingDetectorEb
 __ZN7WebCore8Settings24setApplicationChromeModeEb
 __ZN7WebCore8Settings24setTextAreasAreResizableEb
@@ -668,6 +668,7 @@ __ZN7WebCore8Settings27setFTPDirectoryTemplatePathERKNS_6StringE
 __ZN7WebCore8Settings27setLoadsImagesAutomaticallyEb
 __ZN7WebCore8Settings27setLocalStorageDatabasePathERKNS_6StringE
 __ZN7WebCore8Settings28setForceFTPDirectoryListingsEb
+__ZN7WebCore8Settings28setFrameSetFlatteningEnabledEb
 __ZN7WebCore8Settings29setAuthorAndUserStylesEnabledEb
 __ZN7WebCore8Settings29setWebArchiveDebugModeEnabledEb
 __ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 9846d1c..27db90c 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2188,6 +2188,7 @@
 		9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 9307F1D60AF2D59000DBA31A /* HitTestResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		930908910AF7EDE40081DF01 /* HitTestRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 930908900AF7EDE40081DF01 /* HitTestRequest.h */; };
 		930FC68A1072B9280045293E /* TextRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 930FC6891072B9280045293E /* TextRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */; };
 		9326DC0C09DAD5D600AFC847 /* CharsetData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AC09D14EE6000E61D7 /* CharsetData.cpp */; };
 		9327A94209968D1A0068A546 /* HTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */; };
 		932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 932871BF0B20DEB70049035A /* PlatformMenuDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4743,7 +4744,7 @@
 		E1C415DE0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C415DD0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp */; };
 		E1C416120F6562FD0092D2FB /* CrossOriginAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C416110F6562FD0092D2FB /* CrossOriginAccessControl.h */; };
 		E1C416170F6563180092D2FB /* CrossOriginAccessControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C416160F6563180092D2FB /* CrossOriginAccessControl.cpp */; };
-		E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */; };
+		E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */; };
 		E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */; };
 		E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; };
@@ -7557,6 +7558,7 @@
 		9307F1D60AF2D59000DBA31A /* HitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestResult.h; sourceTree = "<group>"; };
 		930908900AF7EDE40081DF01 /* HitTestRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HitTestRequest.h; sourceTree = "<group>"; };
 		930FC6891072B9280045293E /* TextRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextRenderingMode.h; sourceTree = "<group>"; };
+		931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCanStartListener.h; sourceTree = "<group>"; };
 		9327A94109968D1A0068A546 /* HTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLOptionsCollection.cpp; sourceTree = "<group>"; };
 		932871BF0B20DEB70049035A /* PlatformMenuDescription.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlatformMenuDescription.h; sourceTree = "<group>"; };
 		932E16080AF578340025F408 /* FrameLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameLoader.cpp; sourceTree = "<group>"; };
@@ -11480,6 +11482,7 @@
 				BCE1C41A0D982980003B02F2 /* Location.cpp */,
 				BCE1C4190D982980003B02F2 /* Location.h */,
 				BCE1C4220D9829F2003B02F2 /* Location.idl */,
+				931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */,
 				93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */,
 				935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
 				A9C6E5A30D746458006442E9 /* Navigator.cpp */,
@@ -18524,6 +18527,7 @@
 				BCE789161120D6080060ECE5 /* InlineIterator.h in Headers */,
 				BCE789861120E7A60060ECE5 /* BidiRun.h in Headers */,
 				9F6FC1971122E82A00E80196 /* ScriptDebugServer.h in Headers */,
+				931BCC611124DFCB00BE70DD /* MediaCanStartListener.h in Headers */,
 				9F2A322C1125A0A2003C3056 /* JavaScriptProfile.h in Headers */,
 				9F2A322E1125A0A2003C3056 /* JavaScriptProfileNode.h in Headers */,
 			);
diff --git a/WebCore/html/HTMLAudioElement.h b/WebCore/html/HTMLAudioElement.h
index 1dbe44f..0c9777d 100644
--- a/WebCore/html/HTMLAudioElement.h
+++ b/WebCore/html/HTMLAudioElement.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -35,7 +35,9 @@ namespace WebCore {
 class HTMLAudioElement : public HTMLMediaElement {
 public:
     HTMLAudioElement(const QualifiedName&, Document*);
-    
+
+private:
+    virtual bool isVideo() const { return false; }
     virtual int tagPriority() const { return 5; }
 };
 
diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h
index 8aa82be..07801da 100644
--- a/WebCore/html/HTMLMediaElement.h
+++ b/WebCore/html/HTMLMediaElement.h
@@ -46,7 +46,6 @@ class TimeRanges;
 
 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient {
 public:
-    HTMLMediaElement(const QualifiedName&, Document*);
     virtual ~HTMLMediaElement();
 
     bool checkDTD(const Node* newChild);
@@ -63,7 +62,7 @@ public:
     
     MediaPlayer* player() const { return m_player.get(); }
     
-    virtual bool isVideo() const { return false; }
+    virtual bool isVideo() const = 0;
     virtual bool hasVideo() const { return false; }
     virtual bool hasAudio() const;
 
@@ -177,6 +176,8 @@ public:
     bool processingUserGesture() const;
 
 protected:
+    HTMLMediaElement(const QualifiedName&, Document*);
+
     float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const;
     void setTimeOffsetAttribute(const QualifiedName&, float value);
     
diff --git a/WebCore/page/MediaCanStartListener.h b/WebCore/page/MediaCanStartListener.h
new file mode 100644
index 0000000..005124b
--- /dev/null
+++ b/WebCore/page/MediaCanStartListener.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef MediaCanStartListener_h
+#define MediaCanStartListener_h
+
+namespace WebCore {
+
+class MediaCanStartListener {
+public:
+    virtual void mediaCanStart() = 0;
+protected:
+    virtual ~MediaCanStartListener() { }
+};
+
+}
+
+#endif
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index cf1b1a8..3ecbb5d 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  *
  * This library is free software; you can redistribute it and/or
@@ -46,6 +46,7 @@
 #include "InspectorController.h"
 #include "InspectorTimelineAgent.h"
 #include "Logging.h"
+#include "MediaCanStartListener.h"
 #include "Navigator.h"
 #include "NetworkStateNotifier.h"
 #include "PageGroup.h"
@@ -144,7 +145,7 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi
     , m_debugger(0)
     , m_customHTMLTokenizerTimeDelay(-1)
     , m_customHTMLTokenizerChunkSize(-1)
-    , m_canStartPlugins(true)
+    , m_canStartMedia(true)
 {
 #if !ENABLE(CONTEXT_MENUS)
     UNUSED_PARAM(contextMenuClient);
@@ -395,17 +396,37 @@ PluginData* Page::pluginData() const
     return m_pluginData.get();
 }
 
-void Page::addUnstartedPlugin(PluginView* view)
+void Page::addMediaCanStartListener(MediaCanStartListener* listener)
 {
-    ASSERT(!m_canStartPlugins);
-    m_unstartedPlugins.add(view);
+    ASSERT(!m_canStartMedia);
+    ASSERT(!m_mediaCanStartListeners.contains(listener));
+    m_mediaCanStartListeners.add(listener);
 }
 
-void Page::removeUnstartedPlugin(PluginView* view)
+void Page::removeMediaCanStartListener(MediaCanStartListener* listener)
 {
-    ASSERT(!m_canStartPlugins);
-    ASSERT(m_unstartedPlugins.contains(view));
-    m_unstartedPlugins.remove(view);
+    ASSERT(!m_canStartMedia);
+    ASSERT(m_mediaCanStartListeners.contains(listener));
+    m_mediaCanStartListeners.remove(listener);
+}
+
+void Page::setCanStartMedia(bool canStartMedia)
+{
+    if (m_canStartMedia == canStartMedia)
+        return;
+
+    m_canStartMedia = canStartMedia;
+
+    if (!m_canStartMedia || m_mediaCanStartListeners.isEmpty())
+        return;
+
+    Vector<MediaCanStartListener*> listeners;
+    copyToVector(m_mediaCanStartListeners, listeners);
+    m_mediaCanStartListeners.clear();
+
+    size_t size = listeners.size();
+    for (size_t i = 0; i < size; ++i)
+        listeners[i]->mediaCanStart();
 }
 
 static Frame* incrementFrame(Frame* curr, bool forward, bool wrapFlag)
diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h
index 1417c87..04a545c 100644
--- a/WebCore/page/Page.h
+++ b/WebCore/page/Page.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  *
  * This library is free software; you can redistribute it and/or
@@ -59,26 +59,27 @@ namespace WebCore {
     class InspectorClient;
     class InspectorController;
     class InspectorTimelineAgent;
+    class MediaCanStartListener;
     class Node;
     class PageGroup;
     class PluginData;
     class PluginHalter;
     class PluginHalterClient;
-    class PluginView;
     class ProgressTracker;
     class RenderTheme;
     class VisibleSelection;
     class SelectionController;
     class Settings;
+
 #if ENABLE(DOM_STORAGE)
     class StorageNamespace;
 #endif
-#if ENABLE(WML)
-    class WMLPageState;
-#endif
 #if ENABLE(NOTIFICATIONS)
     class NotificationPresenter;
 #endif
+#if ENABLE(WML)
+    class WMLPageState;
+#endif
 
     typedef uint64_t LinkHash;
 
@@ -96,10 +97,10 @@ namespace WebCore {
         static void refreshPlugins(bool reload);
         PluginData* pluginData() const;
 
-        void setCanStartPlugins(bool);
-        bool canStartPlugins() const { return m_canStartPlugins; }
-        void addUnstartedPlugin(PluginView*);
-        void removeUnstartedPlugin(PluginView*);
+        void setCanStartMedia(bool);
+        bool canStartMedia() const { return m_canStartMedia; }
+        void addMediaCanStartListener(MediaCanStartListener*);
+        void removeMediaCanStartListener(MediaCanStartListener*);
 
         EditorClient* editorClient() const { return m_editorClient; }
 
@@ -310,8 +311,8 @@ namespace WebCore {
         double m_customHTMLTokenizerTimeDelay;
         int m_customHTMLTokenizerChunkSize;
 
-        bool m_canStartPlugins;
-        HashSet<PluginView*> m_unstartedPlugins;
+        bool m_canStartMedia;
+        HashSet<MediaCanStartListener*> m_mediaCanStartListeners;
 
         OwnPtr<PluginHalter> m_pluginHalter;
 
diff --git a/WebCore/page/win/PageWin.cpp b/WebCore/page/win/PageWin.cpp
index 5d7450c..3ef7728 100644
--- a/WebCore/page/win/PageWin.cpp
+++ b/WebCore/page/win/PageWin.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,37 +26,8 @@
 #include "config.h"
 #include "Page.h"
 
-#include "Frame.h"
-#include "FrameLoaderClient.h"
-#include "FrameView.h"
-#include "FloatRect.h"
-#include "PluginView.h"
-#include <windows.h>
-
 namespace WebCore {
 
 HINSTANCE Page::s_instanceHandle = 0;
 
-void Page::setCanStartPlugins(bool canStartPlugins)
-{
-    if (m_canStartPlugins == canStartPlugins)
-        return;
-
-    m_canStartPlugins = canStartPlugins;
-
-    if (!m_canStartPlugins || m_unstartedPlugins.isEmpty())
-        return;
-
-    Vector<PluginView*> unstartedPlugins;
-    copyToVector(m_unstartedPlugins, unstartedPlugins);
-    m_unstartedPlugins.clear();
-
-    for (size_t i = 0; i < unstartedPlugins.size(); ++i) {
-        if (unstartedPlugins[i]->start())
-            continue;
-        unstartedPlugins[i]->parentFrame()->loader()->client()->dispatchDidFailToStartPlugin(unstartedPlugins[i]);
-    }
-}
-
 } // namespace WebCore
-
diff --git a/WebCore/plugins/PluginView.cpp b/WebCore/plugins/PluginView.cpp
index 2640df0..860b488 100644
--- a/WebCore/plugins/PluginView.cpp
+++ b/WebCore/plugins/PluginView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Collabora Ltd. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -32,44 +32,45 @@
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Element.h"
+#include "FocusController.h"
+#include "Frame.h"
 #include "FrameLoader.h"
+#include "FrameLoaderClient.h"
 #include "FrameTree.h"
-#include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
-#include "Image.h"
 #include "HTMLNames.h"
 #include "HTMLPlugInElement.h"
+#include "Image.h"
+#include "JSDOMBinding.h"
 #include "JSDOMWindow.h"
 #include "KeyboardEvent.h"
 #include "MIMETypeRegistry.h"
 #include "MouseEvent.h"
 #include "NotImplemented.h"
 #include "Page.h"
-#include "FocusController.h"
 #include "PlatformMouseEvent.h"
-#if OS(WINDOWS) && ENABLE(NETSCAPE_PLUGIN_API)
-#include "PluginMessageThrottlerWin.h"
-#endif
-#include "PluginPackage.h"
-#include "JSDOMBinding.h"
-#include "ScriptController.h"
-#include "ScriptValue.h"
-#include "SecurityOrigin.h"
 #include "PluginDatabase.h"
 #include "PluginDebug.h"
 #include "PluginMainThreadScheduler.h"
 #include "PluginPackage.h"
 #include "RenderBox.h"
 #include "RenderObject.h"
+#include "ScriptController.h"
+#include "ScriptValue.h"
+#include "SecurityOrigin.h"
+#include "Settings.h"
 #include "c_instance.h"
 #include "npruntime_impl.h"
 #include "runtime_root.h"
-#include "Settings.h"
 #include <runtime/JSLock.h>
 #include <runtime/JSValue.h>
 #include <wtf/ASCIICType.h>
 
+#if OS(WINDOWS) && ENABLE(NETSCAPE_PLUGIN_API)
+#include "PluginMessageThrottlerWin.h"
+#endif
+
 using JSC::ExecState;
 using JSC::JSLock;
 using JSC::JSObject;
@@ -204,8 +205,8 @@ bool PluginView::startOrAddToUnstartedList()
     // We only delay starting the plug-in if we're going to kick off the load
     // ourselves. Otherwise, the loader will try to deliver data before we've
     // started the plug-in.
-    if (!m_loadManually && !m_parentFrame->page()->canStartPlugins()) {
-        m_parentFrame->page()->addUnstartedPlugin(this);
+    if (!m_loadManually && !m_parentFrame->page()->canStartMedia()) {
+        m_parentFrame->page()->addMediaCanStartListener(this);
         m_isWaitingToStart = true;
         return true;
     }
@@ -265,6 +266,13 @@ bool PluginView::start()
     return true;
 }
 
+void PluginView::mediaCanStart()
+{
+    ASSERT(!m_isStarted);
+    if (!start())
+        parentFrame()->loader()->client()->dispatchDidFailToStartPlugin(this);
+}
+
 PluginView::~PluginView()
 {
     LOG(Plugins, "PluginView::~PluginView()");
@@ -298,7 +306,7 @@ void PluginView::removeFromUnstartedListIfNecessary()
     if (!m_parentFrame->page())
         return;
 
-    m_parentFrame->page()->removeUnstartedPlugin(this);
+    m_parentFrame->page()->removeMediaCanStartListener(this);
 }
 
 void PluginView::stop()
diff --git a/WebCore/plugins/PluginView.h b/WebCore/plugins/PluginView.h
index bb06f14..4900101 100644
--- a/WebCore/plugins/PluginView.h
+++ b/WebCore/plugins/PluginView.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Collabora Ltd. All rights reserved.
  * Copyright (C) 2009 Girish Ramakrishnan <girish at forwardbias.in>
  *
@@ -25,15 +25,14 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef PluginView_H
-#define PluginView_H
+#ifndef PluginView_h
+#define PluginView_h
 
 #include "CString.h"
 #include "FrameLoadRequest.h"
 #include "HaltablePlugin.h"
 #include "IntRect.h"
-#include "KURL.h"
-#include "PlatformString.h"
+#include "MediaCanStartListener.h"
 #include "PluginStream.h"
 #include "ResourceRequest.h"
 #include "Timer.h"
@@ -112,7 +111,7 @@ namespace WebCore {
         virtual void didFail(const ResourceError&) = 0;
     };
 
-    class PluginView : public Widget, private PluginStreamClient, public PluginManualLoader, private HaltablePlugin {
+    class PluginView : public Widget, private PluginStreamClient, public PluginManualLoader, private HaltablePlugin, private MediaCanStartListener {
     public:
         static PassRefPtr<PluginView> create(Frame* parentFrame, const IntSize&, Element*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually);
         virtual ~PluginView();
@@ -235,6 +234,8 @@ namespace WebCore {
 
         void invalidateWindowlessPluginRect(const IntRect&);
 
+        virtual void mediaCanStart();
+
 #if OS(WINDOWS) && ENABLE(NETSCAPE_PLUGIN_API)
         void paintWindowedPluginIntoContext(GraphicsContext*, const IntRect&);
         static HDC WINAPI hookedBeginPaint(HWND, PAINTSTRUCT*);
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 3a87d7a..990b801 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,23 @@
+2010-02-16  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Generalize delayed plug-in start for background tabs for use for other media
+        https://bugs.webkit.org/show_bug.cgi?id=34981
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView viewWillMoveToWindow:]): Added comment.
+        (-[WebHTMLView viewDidMoveToWindow]): Ditto.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+        Call setCanStartMedia right away so that if this view is not in a window, it
+        will not start any media.
+        (-[WebView viewWillMoveToWindow:]): Call setCanStartMedia(false) when moving
+        to a window of nil.
+        (-[WebView viewDidMoveToWindow]): Call setCanStartMedia(true) when moved to
+        a window that is non-nil.
+
 2010-02-16  Eric Carlson  <eric.carlson at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index f42c4ce..aa65920 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -2915,7 +2915,9 @@ WEBCORE_COMMAND(yankAndSelect)
     [self _removeWindowObservers];
     [self _removeSuperviewObservers];
     [self _cancelUpdateMouseoverTimer];
-    
+
+    // FIXME: This accomplishes the same thing as the call to setCanStartMedia(false) in
+    // WebView. It would be nice to have a single mechanism instead of two.
     [[self _pluginController] stopAllPlugins];
 }
 
@@ -2935,6 +2937,8 @@ WEBCORE_COMMAND(yankAndSelect)
         [self addSuperviewObservers];
         [self addMouseMovedObserver];
 
+        // FIXME: This accomplishes the same thing as the call to setCanStartMedia(true) in
+        // WebView. It would be nice to have a single mechanism instead of two.
         [[self _pluginController] startAllPlugins];
 
         _private->lastScrollPosition = NSZeroPoint;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 4b449de..de852d6 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  * Copyright (C) 2006 David Smith (catfish.man at gmail.com)
  *
  * Redistribution and use in source and binary forms, with or without
@@ -630,6 +630,7 @@ static bool shouldEnableLoadDeferring()
 #endif
     _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), geolocationControllerClient);
 
+    _private->page->setCanStartMedia([self window]);
     _private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
 
     [WebFrame _createMainFrameWithPage:_private->page frameName:frameName frameView:frameView];
@@ -2824,8 +2825,10 @@ static bool needsWebViewInitThreadWorkaround()
         // and over, so do them when we move into a window.
         [window setAcceptsMouseMovedEvents:YES];
         WKSetNSWindowShouldPostEventNotifications(window, YES);
-    } else
+    } else {
+        _private->page->setCanStartMedia(false);
         _private->page->willMoveOffscreen();
+    }
         
     if (window != [self window]) {
         [self removeWindowObservers];
@@ -2842,8 +2845,10 @@ static bool needsWebViewInitThreadWorkaround()
     if (!_private || _private->closed)
         return;
 
-    if ([self window])
+    if ([self window]) {
+        _private->page->setCanStartMedia(true);
         _private->page->didMoveOnscreen();
+    }
     
     [self _updateActiveState];
 }
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 1a6b3ec..e9ea924 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-16  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Generalize delayed plug-in start for background tabs for use for other media
+        https://bugs.webkit.org/show_bug.cgi?id=34981
+
+        * WebView.cpp:
+        (WebView::setCanStartPlugins): Change to call setCanStartMedia.
+        In a later patch we can change the of the public function in the IDL file too,
+        but for now this should be enough.
+
 2010-02-15  Adam Roben  <aroben at apple.com>
 
         Add IWebFramePrivate::visibleContentRect
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index db7e235..e278e3b 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008 Apple, Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,7 +24,6 @@
  */
 
 #include "config.h"
-
 #include "WebView.h"
 
 #include "CFDictionaryPropertyBag.h"
@@ -5766,7 +5765,7 @@ HRESULT WebView::setJavaScriptURLsAreAllowed(BOOL areAllowed)
 
 HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins)
 {
-    m_page->setCanStartPlugins(canStartPlugins);
+    m_page->setCanStartMedia(canStartPlugins);
     return S_OK;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list