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) 30#include "ScriptExecutionContext.h" 31#include "ThreadableBlobRegistry.h" 32#include <wtf/HashSet.h> 33#include <wtf/text/WTFString.h> 34 35#if ENABLE(MEDIA_STREAM) 36#include "MediaStream.h" 37#include "MediaStreamRegistry.h" 38#endif 39 40#if ENABLE(MEDIA_SOURCE) 41#include "MediaSource.h" 42#include "MediaSourceRegistry.h" 43#endif 44 45namespace WebCore { 46 47class ScriptExecutionContext; 48 49class PublicURLManager { 50 WTF_MAKE_FAST_ALLOCATED; 51public: 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 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 69 } 70 71 HashSet<String>& blobURLs() { return m_blobURLs; } 72#if ENABLE(MEDIA_STREAM) 73 HashSet<String>& streamURLs() { return m_streamURLs; } 74#endif 75#if ENABLE(MEDIA_SOURCE) 76 HashSet<String>& sourceURLs() { return m_sourceURLs; } 77#endif 78 79private: 80 HashSet<String> m_blobURLs; 81#if ENABLE(MEDIA_STREAM) 82 HashSet<String> m_streamURLs; 83#endif 84#if ENABLE(MEDIA_SOURCE) 85 HashSet<String> m_sourceURLs; 86#endif 87}; 88 89} // namespace WebCore 90 91#endif // BLOB 92#endif // PUBLICURLMANAGER_h 93