blob: e17e46a8d6baf7db6ca45df7825b01785b2b6d4f [file] [log] [blame]
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +00001/*
2 * Copyright (C) 2012 Motorola Mobility Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef PublicURLManager_h
27#define PublicURLManager_h
28
29#if ENABLE(BLOB)
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000030#include "ScriptExecutionContext.h"
31#include "ThreadableBlobRegistry.h"
32#include <wtf/HashSet.h>
weinig@apple.com3f5ab022012-09-06 17:36:48 +000033#include <wtf/text/WTFString.h>
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000034
35#if ENABLE(MEDIA_STREAM)
36#include "MediaStream.h"
37#include "MediaStreamRegistry.h"
38#endif
39
annacc@chromium.orge024c4e2012-08-08 00:46:26 +000040#if ENABLE(MEDIA_SOURCE)
41#include "MediaSource.h"
42#include "MediaSourceRegistry.h"
43#endif
44
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000045namespace WebCore {
46
47class ScriptExecutionContext;
48
49class PublicURLManager {
zoltan@webkit.org2eb7bec2012-09-14 09:12:48 +000050 WTF_MAKE_FAST_ALLOCATED;
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000051public:
52 static PassOwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); }
53 void contextDestroyed()
54 {
55 HashSet<String>::iterator blobURLsEnd = m_blobURLs.end();
56 for (HashSet<String>::iterator iter = m_blobURLs.begin(); iter != blobURLsEnd; ++iter)
57 ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter));
58
59#if ENABLE(MEDIA_STREAM)
60 HashSet<String>::iterator streamURLsEnd = m_streamURLs.end();
61 for (HashSet<String>::iterator iter = m_streamURLs.begin(); iter != streamURLsEnd; ++iter)
62 MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter));
63#endif
annacc@chromium.orge024c4e2012-08-08 00:46:26 +000064#if ENABLE(MEDIA_SOURCE)
65 HashSet<String>::iterator sourceURLsEnd = m_sourceURLs.end();
66 for (HashSet<String>::iterator iter = m_sourceURLs.begin(); iter != sourceURLsEnd; ++iter)
67 MediaSourceRegistry::registry().unregisterMediaSourceURL(KURL(ParsedURLString, *iter));
68#endif
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000069 }
70
71 HashSet<String>& blobURLs() { return m_blobURLs; }
72#if ENABLE(MEDIA_STREAM)
73 HashSet<String>& streamURLs() { return m_streamURLs; }
74#endif
annacc@chromium.orge024c4e2012-08-08 00:46:26 +000075#if ENABLE(MEDIA_SOURCE)
76 HashSet<String>& sourceURLs() { return m_sourceURLs; }
77#endif
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000078
79private:
80 HashSet<String> m_blobURLs;
81#if ENABLE(MEDIA_STREAM)
82 HashSet<String> m_streamURLs;
83#endif
annacc@chromium.orge024c4e2012-08-08 00:46:26 +000084#if ENABLE(MEDIA_SOURCE)
85 HashSet<String> m_sourceURLs;
86#endif
commit-queue@webkit.org8cd68272012-02-08 14:39:18 +000087};
88
89} // namespace WebCore
90
91#endif // BLOB
92#endif // PUBLICURLMANAGER_h