diff options
Diffstat (limited to 'Source/WebCore/html/DOMURL.cpp')
-rw-r--r-- | Source/WebCore/html/DOMURL.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/WebCore/html/DOMURL.cpp b/Source/WebCore/html/DOMURL.cpp index 4f9780dcd..f6586264f 100644 --- a/Source/WebCore/html/DOMURL.cpp +++ b/Source/WebCore/html/DOMURL.cpp @@ -42,6 +42,11 @@ #include <wtf/PassOwnPtr.h> #include <wtf/MainThread.h> +#if ENABLE(MEDIA_SOURCE) +#include "MediaSource.h" +#include "MediaSourceRegistry.h" +#endif + #if ENABLE(MEDIA_STREAM) #include "MediaStream.h" #include "MediaStreamRegistry.h" @@ -49,6 +54,26 @@ namespace WebCore { +#if ENABLE(MEDIA_SOURCE) +String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaSource* source) +{ + // Since WebWorkers cannot obtain MediaSource objects, we should be on the main thread. + ASSERT(isMainThread()); + + if (!scriptExecutionContext || !source) + return String(); + + KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin()); + if (publicURL.isEmpty()) + return String(); + + MediaSourceRegistry::registry().registerMediaSourceURL(publicURL, source); + scriptExecutionContext->publicURLManager().sourceURLs().add(publicURL.string()); + + return publicURL.string(); +} +#endif + #if ENABLE(MEDIA_STREAM) String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaStream* stream) { @@ -98,6 +123,13 @@ void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, con blobURLs.remove(url.string()); } +#if ENABLE(MEDIA_SOURCE) + HashSet<String>& sourceURLs = scriptExecutionContext->publicURLManager().sourceURLs(); + if (sourceURLs.contains(url.string())) { + MediaSourceRegistry::registry().unregisterMediaSourceURL(url); + sourceURLs.remove(url.string()); + } +#endif #if ENABLE(MEDIA_STREAM) HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().streamURLs(); if (streamURLs.contains(url.string())) { |