Changeset 107082 in webkit


Ignore:
Timestamp:
Feb 8, 2012 6:39:18 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Migrate createObjectURL & revokeObjectURL to static (Class) methods.
https://bugs.webkit.org/show_bug.cgi?id=74386

Patch by Kaustubh Atrawalkar <Kaustubh Atrawalkar> on 2012-02-08
Reviewed by Kentaro Hara.

Source/WebCore:

Move createObjectURL & revokeObjectURL from DOMURL implementation to
static methods as per specs - http://www.w3.org/TR/FileAPI/#creating-revoking

Test: fast/dom/DOMURL/check-instanceof-domurl-functions.html
Already Existing:

fast/files/revoke-blob-url.html
fast/dom/window-domurl-crash.html
fast/files/apply-blob-url-to-img.html
fast/files/create-blob-url-crash.html
fast/files/workers/inline-worker-via-blob-url.html

  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/ScriptExecutionContext.cpp:

(WebCore::ScriptExecutionContext::~ScriptExecutionContext):
(WebCore::ScriptExecutionContext::fileThread):
(WebCore):
(WebCore::ScriptExecutionContext::publicURLManager):

  • dom/ScriptExecutionContext.h:

(WebCore):
(ScriptExecutionContext):

  • html/DOMURL.cpp:

(WebCore):
(WebCore::DOMURL::createObjectURL): Changed to static.
(WebCore::DOMURL::revokeObjectURL): ditto.

  • html/DOMURL.h:

(DOMURL):
(WebCore::DOMURL::create):

  • html/DOMURL.idl:
  • html/PublicURLManager.h: Added.

(WebCore):
(PublicURLManager):
(WebCore::PublicURLManager::create):
(WebCore::PublicURLManager::contextDestroyed):
(WebCore::PublicURLManager::blobURLs):
(WebCore::PublicURLManager::streamURLs):

  • page/DOMWindow.cpp: Removed object initialization for DOMURL.

(WebCore):

  • page/DOMWindow.h: ditto.

(DOMWindow):

  • page/DOMWindow.idl:
  • workers/WorkerContext.cpp:

(WebCore):

  • workers/WorkerContext.h:

(WorkerContext):

  • workers/WorkerContext.idl:

LayoutTests:

Added test to check if createObjectURL & revokeObjectURL are static functions.

  • fast/dom/DOMURL/check-instanceof-domurl-functions-expected.txt: Added.
  • fast/dom/DOMURL/check-instanceof-domurl-functions.html: Added.
  • platform/gtk/fast/dom/prototype-inheritance-2-expected.txt: GTK Rebaseline.
  • platform/gtk/fast/js/global-constructors-expected.txt: ditto.
  • platform/qt/fast/dom/constructed-objects-prototypes-expected.txt: Qt Rebaseline.
  • platform/qt/fast/dom/prototype-inheritance-2-expected.txt: ditto.
  • platform/qt/fast/js/global-constructors-expected.txt: ditto.
Location:
trunk
Files:
2 added
23 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107081 r107082  
     12012-02-08  Kaustubh Atrawalkar  <kaustubh@motorola.com>
     2
     3        Migrate createObjectURL & revokeObjectURL to static (Class) methods.
     4        https://bugs.webkit.org/show_bug.cgi?id=74386
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Added test to check if createObjectURL & revokeObjectURL are static functions.
     9
     10        * fast/dom/DOMURL/check-instanceof-domurl-functions-expected.txt: Added.
     11        * fast/dom/DOMURL/check-instanceof-domurl-functions.html: Added.
     12        * platform/gtk/fast/dom/prototype-inheritance-2-expected.txt: GTK Rebaseline.
     13        * platform/gtk/fast/js/global-constructors-expected.txt: ditto.
     14        * platform/qt/fast/dom/constructed-objects-prototypes-expected.txt: Qt Rebaseline.
     15        * platform/qt/fast/dom/prototype-inheritance-2-expected.txt: ditto.
     16        * platform/qt/fast/js/global-constructors-expected.txt: ditto.
     17
    1182012-02-08  Pavel Podivilov  <podivilov@chromium.org>
    219
  • trunk/LayoutTests/platform/gtk/fast/dom/prototype-inheritance-2-expected.txt

    r106922 r107082  
    241241Never found DOMSettableTokenList
    242242Never found DOMStringList
     243Never found DOMURL
    243244Never found Document
    244245Never found DocumentFragment
  • trunk/LayoutTests/platform/gtk/fast/js/global-constructors-expected.txt

    r106922 r107082  
    334334PASS XSLTProcessor.toString() is '[object XSLTProcessorConstructor]'
    335335FAIL webkitPeerConnection.toString() should be [object webkitPeerConnectionConstructor]. Was [object PeerConnectionConstructor].
     336FAIL webkitURL.toString() should be [object webkitURLConstructor]. Was [object DOMURLConstructor].
    336337PASS successfullyParsed is true
    337338
  • trunk/LayoutTests/platform/qt/fast/dom/constructed-objects-prototypes-expected.txt

    r106922 r107082  
    6262PASS (new inner.XSLTProcessor()).isInner is true
    6363PASS (new inner.XSLTProcessor()).constructor.isInner is true
     64PASS (new inner.webkitURL()).isInner is true
     65PASS (new inner.webkitURL()).constructor.isInner is true
    6466PASS successfullyParsed is true
    6567
  • trunk/LayoutTests/platform/qt/fast/dom/prototype-inheritance-2-expected.txt

    r106922 r107082  
    241241Never found DOMSettableTokenList
    242242Never found DOMStringList
     243Never found DOMURL
    243244Never found Document
    244245Never found DocumentFragment
  • trunk/LayoutTests/platform/qt/fast/js/global-constructors-expected.txt

    r106922 r107082  
    316316PASS XPathResult.toString() is '[object XPathResultConstructor]'
    317317PASS XSLTProcessor.toString() is '[object XSLTProcessorConstructor]'
     318FAIL webkitURL.toString() should be [object webkitURLConstructor]. Was [object DOMURLConstructor].
    318319PASS successfullyParsed is true
    319320
  • trunk/Source/WebCore/ChangeLog

    r107079 r107082  
     12012-02-08  Kaustubh Atrawalkar  <kaustubh@motorola.com>
     2
     3        Migrate createObjectURL & revokeObjectURL to static (Class) methods.
     4        https://bugs.webkit.org/show_bug.cgi?id=74386
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Move createObjectURL & revokeObjectURL from DOMURL implementation to
     9        static methods as per specs - http://www.w3.org/TR/FileAPI/#creating-revoking
     10
     11        Test: fast/dom/DOMURL/check-instanceof-domurl-functions.html
     12        Already Existing:
     13            fast/files/revoke-blob-url.html
     14            fast/dom/window-domurl-crash.html
     15            fast/files/apply-blob-url-to-img.html
     16            fast/files/create-blob-url-crash.html
     17            fast/files/workers/inline-worker-via-blob-url.html
     18
     19        * GNUmakefile.list.am:
     20        * Target.pri:
     21        * WebCore.gypi:
     22        * WebCore.vcproj/WebCore.vcproj:
     23        * WebCore.xcodeproj/project.pbxproj:
     24        * dom/ScriptExecutionContext.cpp:
     25        (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
     26        (WebCore::ScriptExecutionContext::fileThread):
     27        (WebCore):
     28        (WebCore::ScriptExecutionContext::publicURLManager):
     29        * dom/ScriptExecutionContext.h:
     30        (WebCore):
     31        (ScriptExecutionContext):
     32        * html/DOMURL.cpp:
     33        (WebCore):
     34        (WebCore::DOMURL::createObjectURL): Changed to static.
     35        (WebCore::DOMURL::revokeObjectURL): ditto.
     36        * html/DOMURL.h:
     37        (DOMURL):
     38        (WebCore::DOMURL::create):
     39        * html/DOMURL.idl:
     40        * html/PublicURLManager.h: Added.
     41        (WebCore):
     42        (PublicURLManager):
     43        (WebCore::PublicURLManager::create):
     44        (WebCore::PublicURLManager::contextDestroyed):
     45        (WebCore::PublicURLManager::blobURLs):
     46        (WebCore::PublicURLManager::streamURLs):
     47        * page/DOMWindow.cpp: Removed object initialization for DOMURL.
     48        (WebCore):
     49        * page/DOMWindow.h: ditto.
     50        (DOMWindow):
     51        * page/DOMWindow.idl:
     52        * workers/WorkerContext.cpp:
     53        (WebCore):
     54        * workers/WorkerContext.h:
     55        (WorkerContext):
     56        * workers/WorkerContext.idl:
     57
    1582012-02-01  Brian Grinstead  <briangrinstead@gmail.com>
    259
  • trunk/Source/WebCore/GNUmakefile.list.am

    r106953 r107082  
    22572257        Source/WebCore/html/PluginDocument.cpp \
    22582258        Source/WebCore/html/PluginDocument.h \
     2259        Source/WebCore/html/PublicURLManager.h \
    22592260        Source/WebCore/html/RadioInputType.cpp \
    22602261        Source/WebCore/html/RadioInputType.h \
  • trunk/Source/WebCore/Target.pri

    r107035 r107082  
    18811881    html/MicroDataItemValue.h \
    18821882    html/PluginDocument.h \
     1883    html/PublicURLManager.h \
    18831884    html/StepRange.h \
    18841885    html/TextDocument.h \
  • trunk/Source/WebCore/WebCore.gypi

    r107036 r107082  
    53765376            'html/PluginDocument.cpp',
    53775377            'html/PluginDocument.h',
     5378            'html/PublicURLManager.h',
    53785379            'html/RadioInputType.cpp',
    53795380            'html/RadioInputType.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r106953 r107082  
    6049560495                        </File>
    6049660496                        <File
     60497                                RelativePath="..\html\PublicURLManager.h"
     60498                                >
     60499                        </File>
     60500            <File
    6049760501                                RelativePath="..\html\RadioInputType.cpp"
    6049860502                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r107026 r107082  
    280280                0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; };
    281281                0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; };
     282                10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; };
    282283                1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; };
    283284                1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    69816982                0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; };
    69826983                0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; };
     6984                10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; };
    69836985                1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
    69846986                1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
     
    1694216944                                97205AB91239292700B17380 /* PluginDocument.cpp */,
    1694316945                                97205ABA1239292700B17380 /* PluginDocument.h */,
     16946                                10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */,
    1694416947                                F55B3D971251F12D003EF269 /* RadioInputType.cpp */,
    1694516948                                F55B3D981251F12D003EF269 /* RadioInputType.h */,
     
    2415824161                                1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */,
    2415924162                                1AAADDE914DC8DF800AF64B3 /* ScrollingTreeNodeMac.h in Headers */,
     24163                                10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */,
    2416024164                                7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */,
    2416124165                        );
  • trunk/Source/WebCore/dom/ScriptExecutionContext.cpp

    r106914 r107082  
    3939#include "FileThread.h"
    4040#include "MessagePort.h"
     41#include "PublicURLManager.h"
    4142#include "ScriptCallStack.h"
    4243#include "SecurityOrigin.h"
     
    126127        m_fileThread = 0;
    127128    }
     129#endif
     130#if ENABLE(BLOB)
     131    if (m_publicURLManager)
     132        m_publicURLManager->contextDestroyed();
    128133#endif
    129134}
     
    386391#endif
    387392
     393#if ENABLE(BLOB)
     394PublicURLManager& ScriptExecutionContext::publicURLManager()
     395{
     396    if (!m_publicURLManager)
     397        m_publicURLManager = PublicURLManager::create();
     398    return *m_publicURLManager;
     399}
     400#endif
     401
    388402void ScriptExecutionContext::adjustMinimumTimerInterval(double oldMinimumTimerInterval)
    389403{
  • trunk/Source/WebCore/dom/ScriptExecutionContext.h

    r106914 r107082  
    5454class MessagePort;
    5555
     56#if ENABLE(BLOB)
     57class PublicURLManager;
     58#endif
    5659#if ENABLE(SQL_DATABASE)
    5760class Database;
     
    104107    virtual void stopActiveDOMObjects();
    105108
     109#if ENABLE(BLOB)
     110    PublicURLManager& publicURLManager();
     111#endif
    106112    void didCreateActiveDOMObject(ActiveDOMObject*, void* upcastPointer);
    107113    void willDestroyActiveDOMObject(ActiveDOMObject*);
     
    206212    class PendingException;
    207213    OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions;
     214#if ENABLE(BLOB)
     215    OwnPtr<PublicURLManager> m_publicURLManager;
     216#endif
    208217
    209218#if ENABLE(SQL_DATABASE)
  • trunk/Source/WebCore/html/DOMURL.cpp

    r106914 r107082  
    11/*
    22 * Copyright (C) 2011 Google Inc. All rights reserved.
     3 * Copyright (C) 2012 Motorola Mobility Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3031#include "DOMURL.h"
    3132
     33#include "ActiveDOMObject.h"
    3234#include "Blob.h"
    3335#include "BlobURL.h"
    3436#include "KURL.h"
     37#include "PublicURLManager.h"
    3538#include "ScriptExecutionContext.h"
     39#include "SecurityOrigin.h"
    3640#include "ThreadableBlobRegistry.h"
     41#include <wtf/PassOwnPtr.h>
    3742#include <wtf/MainThread.h>
    3843
     
    4449namespace WebCore {
    4550
    46 DOMURL::DOMURL(ScriptExecutionContext* scriptExecutionContext)
    47     : ContextDestructionObserver(scriptExecutionContext)
     51#if ENABLE(MEDIA_STREAM)
     52String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaStream* stream)
    4853{
    49 }
    50 
    51 DOMURL::~DOMURL()
    52 {
    53 }
    54 
    55 void DOMURL::contextDestroyed()
    56 {
    57     ContextDestructionObserver::contextDestroyed();
    58 
    59     HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end();
    60     for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter)
    61         ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter));
    62 
    63 #if ENABLE(MEDIA_STREAM)
    64     HashSet<String>::iterator publicStreamURLsEnd = m_publicStreamURLs.end();
    65     for (HashSet<String>::iterator iter = m_publicStreamURLs.begin(); iter != publicStreamURLsEnd; ++iter)
    66         MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter));
    67 #endif
    68 }
    69 
    70 #if ENABLE(MEDIA_STREAM)
    71 String DOMURL::createObjectURL(MediaStream* stream)
    72 {
    73     if (!m_scriptExecutionContext || !stream)
     54    if (!scriptExecutionContext || !stream)
    7455        return String();
    7556
    76     KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin());
     57    KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin());
    7758    if (publicURL.isEmpty())
    7859        return String();
     
    8263
    8364    MediaStreamRegistry::registry().registerMediaStreamURL(publicURL, stream);
    84     m_publicStreamURLs.add(publicURL.string());
     65    scriptExecutionContext->publicURLManager().streamURLs().add(publicURL.string());
    8566
    8667    return publicURL.string();
     
    8869#endif
    8970
    90 String DOMURL::createObjectURL(Blob* blob)
     71String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
    9172{
    92     if (!m_scriptExecutionContext || !blob)
     73    if (!scriptExecutionContext || !blob)
    9374        return String();
    9475
    95     KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin());
     76    KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin());
    9677    if (publicURL.isEmpty())
    9778        return String();
    9879
    9980    ThreadableBlobRegistry::registerBlobURL(publicURL, blob->url());
    100     m_publicBlobURLs.add(publicURL.string());
     81    scriptExecutionContext->publicURLManager().blobURLs().add(publicURL.string());
    10182
    10283    return publicURL.string();
    10384}
    10485
    105 void DOMURL::revokeObjectURL(const String& urlString)
     86void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, const String& urlString)
    10687{
    107     if (!m_scriptExecutionContext)
     88    if (!scriptExecutionContext)
    10889        return;
    10990
    11091    KURL url(KURL(), urlString);
    11192
    112     if (m_publicBlobURLs.contains(url.string())) {
     93    HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobURLs();
     94    if (blobURLs.contains(url.string())) {
    11395        ThreadableBlobRegistry::unregisterBlobURL(url);
    114         m_publicBlobURLs.remove(url.string());
     96        blobURLs.remove(url.string());
    11597    }
    11698
    11799#if ENABLE(MEDIA_STREAM)
    118     if (m_publicStreamURLs.contains(url.string())) {
     100    HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().streamURLs();
     101    if (streamURLs.contains(url.string())) {
    119102        // FIXME: make sure of this assertion below. Raise a spec question if required.
    120103        // Since WebWorkers cannot obtain Stream objects, we should be on the main thread.
    121104        ASSERT(isMainThread());
    122105        MediaStreamRegistry::registry().unregisterMediaStreamURL(url);
    123         m_publicStreamURLs.remove(url.string());
     106        streamURLs.remove(url.string());
    124107    }
    125108#endif
  • trunk/Source/WebCore/html/DOMURL.h

    r106914 r107082  
    11/*
    22 * Copyright (C) 2011 Google Inc. All rights reserved.
     3 * Copyright (C) 2012 Motorola Mobility Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2728#define DOMURL_h
    2829
    29 #if ENABLE(BLOB)
    30 
    31 #include "ActiveDOMObject.h"
     30#include "KURL.h"
    3231#include "PlatformString.h"
    3332#include <wtf/HashSet.h>
     
    4140class ScriptExecutionContext;
    4241
    43 class DOMURL : public RefCounted<DOMURL>, public ContextDestructionObserver {
     42class DOMURL : public RefCounted<DOMURL> {
     43
    4444public:
    45     static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); }
    46     ~DOMURL();
     45    static PassRefPtr<DOMURL> create() { return adoptRef(new DOMURL); }
    4746
     47#if ENABLE(BLOB)
     48    static void contextDestroyed(ScriptExecutionContext*);
     49
     50    static String createObjectURL(ScriptExecutionContext*, Blob*);
     51    static void revokeObjectURL(ScriptExecutionContext*, const String&);
    4852#if ENABLE(MEDIA_STREAM)
    49     String createObjectURL(MediaStream*);
     53    static String createObjectURL(ScriptExecutionContext*, MediaStream*);
    5054#endif
    51     String createObjectURL(Blob*);
    52     void revokeObjectURL(const String&);
    53 
    54 private:
    55     explicit DOMURL(ScriptExecutionContext*);
    56 
    57     virtual void contextDestroyed();
    58 
    59     HashSet<String> m_publicBlobURLs;
    60 #if ENABLE(MEDIA_STREAM)
    61     HashSet<String> m_publicStreamURLs;
    6255#endif
    6356};
     
    6558} // namespace WebCore
    6659
    67 #endif // ENABLE(BLOB)
    68 
    6960#endif // DOMURL_h
  • trunk/Source/WebCore/html/DOMURL.idl

    r107041 r107082  
    11/*
    22 * Copyright (C) 2011 Google Inc. All rights reserved.
     3 * Copyright (C) 2012 Motorola Mobility Inc.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2728    interface [
    2829        Conditional=BLOB,
    29         OmitConstructor,
     30        Constructor,
    3031        JSGenerateToNativeObject,
    3132        JSGenerateToJS,
     
    3334    ] DOMURL {
    3435#if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM
    35         [ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream);
     36        static [CallWith=ScriptExecutionContext,ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream);
    3637#endif
    37         [ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob);
    38         void revokeObjectURL(in DOMString url);
     38        static [CallWith=ScriptExecutionContext,ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob);
     39        static [CallWith=ScriptExecutionContext] void revokeObjectURL(in DOMString url);
    3940    };
    4041}
  • trunk/Source/WebCore/html/PublicURLManager.h

    r107081 r107082  
    11/*
    2  * Copyright (C) 2011 Google Inc. All rights reserved.
     2 * Copyright (C) 2012 Motorola Mobility Inc.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef DOMURL_h
    27 #define DOMURL_h
     26#ifndef PublicURLManager_h
     27#define PublicURLManager_h
    2828
    2929#if ENABLE(BLOB)
     30#include "PlatformString.h"
     31#include "ScriptExecutionContext.h"
     32#include "ThreadableBlobRegistry.h"
     33#include <wtf/HashSet.h>
    3034
    31 #include "ActiveDOMObject.h"
    32 #include "PlatformString.h"
    33 #include <wtf/HashSet.h>
    34 #include <wtf/PassRefPtr.h>
    35 #include <wtf/RefCounted.h>
     35#if ENABLE(MEDIA_STREAM)
     36#include "MediaStream.h"
     37#include "MediaStreamRegistry.h"
     38#endif
    3639
    3740namespace WebCore {
    3841
    39 class Blob;
    40 class MediaStream;
    4142class ScriptExecutionContext;
    4243
    43 class DOMURL : public RefCounted<DOMURL>, public ContextDestructionObserver {
     44class PublicURLManager {
     45
    4446public:
    45     static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); }
    46     ~DOMURL();
     47    static PassOwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); }
     48    void contextDestroyed()
     49    {
     50        HashSet<String>::iterator blobURLsEnd = m_blobURLs.end();
     51        for (HashSet<String>::iterator iter = m_blobURLs.begin(); iter != blobURLsEnd; ++iter)
     52            ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter));
    4753
    4854#if ENABLE(MEDIA_STREAM)
    49     String createObjectURL(MediaStream*);
     55        HashSet<String>::iterator streamURLsEnd = m_streamURLs.end();
     56        for (HashSet<String>::iterator iter = m_streamURLs.begin(); iter != streamURLsEnd; ++iter)
     57            MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter));
    5058#endif
    51     String createObjectURL(Blob*);
    52     void revokeObjectURL(const String&);
     59    }
     60
     61    HashSet<String>& blobURLs() { return m_blobURLs; }
     62#if ENABLE(MEDIA_STREAM)
     63    HashSet<String>& streamURLs() { return m_streamURLs; }
     64#endif
    5365
    5466private:
    55     explicit DOMURL(ScriptExecutionContext*);
    56 
    57     virtual void contextDestroyed();
    58 
    59     HashSet<String> m_publicBlobURLs;
     67    HashSet<String> m_blobURLs;
    6068#if ENABLE(MEDIA_STREAM)
    61     HashSet<String> m_publicStreamURLs;
     69    HashSet<String> m_streamURLs;
    6270#endif
    6371};
     
    6573} // namespace WebCore
    6674
    67 #endif // ENABLE(BLOB)
    68 
    69 #endif // DOMURL_h
     75#endif // BLOB
     76#endif // PUBLICURLMANAGER_h
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r106914 r107082  
    18981898}
    18991899
    1900 #if ENABLE(BLOB)
    1901 DOMURL* DOMWindow::webkitURL() const
    1902 {
    1903     if (!m_domURL && isCurrentlyDisplayedInFrame())
    1904         m_domURL = DOMURL::create(this->scriptExecutionContext());
    1905     return m_domURL.get();
    1906 }
    1907 #endif
    1908 
    19091900#if ENABLE(QUOTA)
    19101901StorageInfo* DOMWindow::webkitStorageInfo() const
  • trunk/Source/WebCore/page/DOMWindow.h

    r106914 r107082  
    352352        using RefCounted<DOMWindow>::deref;
    353353
    354 #if ENABLE(BLOB)
    355         DOMURL* webkitURL() const;
    356 #endif
    357 
    358354#if ENABLE(DEVICE_ORIENTATION)
    359355        DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion);
  • trunk/Source/WebCore/page/DOMWindow.idl

    r107046 r107082  
    783783        attribute [Conditional=BLOB] WebKitBlobBuilderConstructor WebKitBlobBuilder;
    784784
    785         readonly attribute [Conditional=BLOB] DOMURL webkitURL;
     785        attribute [Conditional=BLOB] DOMURLConstructor webkitURL;
    786786
    787787#if defined(ENABLE_QUOTA) && ENABLE_QUOTA
  • trunk/Source/WebCore/workers/WorkerContext.cpp

    r106914 r107082  
    378378}
    379379
    380 #if ENABLE(BLOB)
    381 DOMURL* WorkerContext::webkitURL() const
    382 {
    383     if (!m_domURL)
    384         m_domURL = DOMURL::create(this->scriptExecutionContext());
    385     return m_domURL.get();
    386 }
    387 #endif
    388 
    389380#if ENABLE(FILE_SYSTEM)
    390381void WorkerContext::webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
  • trunk/Source/WebCore/workers/WorkerContext.h

    r106914 r107082  
    132132        virtual bool isJSExecutionForbidden() const;
    133133
    134 #if ENABLE(BLOB)
    135         DOMURL* webkitURL() const;
    136 #endif
    137 
    138134#if ENABLE(FILE_SYSTEM)
    139135        enum FileSystemType {
  • trunk/Source/WebCore/workers/WorkerContext.idl

    r107041 r107082  
    102102#endif
    103103
    104         readonly attribute [Conditional=BLOB] DOMURL webkitURL;
     104        attribute [Conditional=BLOB] DOMURLConstructor webkitURL;
    105105
    106106#if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM
Note: See TracChangeset for help on using the changeset viewer.