commit-queue@webkit.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 1 | /* |
| 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.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 30 | #include "ScriptExecutionContext.h" |
| 31 | #include "ThreadableBlobRegistry.h" |
| 32 | #include <wtf/HashSet.h> |
weinig@apple.com | 3f5ab02 | 2012-09-06 17:36:48 +0000 | [diff] [blame] | 33 | #include <wtf/text/WTFString.h> |
commit-queue@webkit.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 34 | |
| 35 | #if ENABLE(MEDIA_STREAM) |
| 36 | #include "MediaStream.h" |
| 37 | #include "MediaStreamRegistry.h" |
| 38 | #endif |
| 39 | |
annacc@chromium.org | e024c4e | 2012-08-08 00:46:26 +0000 | [diff] [blame] | 40 | #if ENABLE(MEDIA_SOURCE) |
| 41 | #include "MediaSource.h" |
| 42 | #include "MediaSourceRegistry.h" |
| 43 | #endif |
| 44 | |
commit-queue@webkit.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 45 | namespace WebCore { |
| 46 | |
| 47 | class ScriptExecutionContext; |
| 48 | |
| 49 | class PublicURLManager { |
zoltan@webkit.org | 2eb7bec | 2012-09-14 09:12:48 +0000 | [diff] [blame] | 50 | WTF_MAKE_FAST_ALLOCATED; |
commit-queue@webkit.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 51 | public: |
| 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.org | e024c4e | 2012-08-08 00:46:26 +0000 | [diff] [blame] | 64 | #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.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | HashSet<String>& blobURLs() { return m_blobURLs; } |
| 72 | #if ENABLE(MEDIA_STREAM) |
| 73 | HashSet<String>& streamURLs() { return m_streamURLs; } |
| 74 | #endif |
annacc@chromium.org | e024c4e | 2012-08-08 00:46:26 +0000 | [diff] [blame] | 75 | #if ENABLE(MEDIA_SOURCE) |
| 76 | HashSet<String>& sourceURLs() { return m_sourceURLs; } |
| 77 | #endif |
commit-queue@webkit.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 78 | |
| 79 | private: |
| 80 | HashSet<String> m_blobURLs; |
| 81 | #if ENABLE(MEDIA_STREAM) |
| 82 | HashSet<String> m_streamURLs; |
| 83 | #endif |
annacc@chromium.org | e024c4e | 2012-08-08 00:46:26 +0000 | [diff] [blame] | 84 | #if ENABLE(MEDIA_SOURCE) |
| 85 | HashSet<String> m_sourceURLs; |
| 86 | #endif |
commit-queue@webkit.org | 8cd6827 | 2012-02-08 14:39:18 +0000 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | } // namespace WebCore |
| 90 | |
| 91 | #endif // BLOB |
| 92 | #endif // PUBLICURLMANAGER_h |