| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Motorola Mobility Inc. | 3 * Copyright (C) 2012 Motorola Mobility Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 | 28 |
| 29 #if ENABLE(BLOB) | 29 #if ENABLE(BLOB) |
| 30 | 30 |
| 31 #include "DOMURL.h" | 31 #include "DOMURL.h" |
| 32 | 32 |
| 33 #include "ActiveDOMObject.h" | 33 #include "ActiveDOMObject.h" |
| 34 #include "Blob.h" | 34 #include "Blob.h" |
| 35 #include "BlobURL.h" | 35 #include "BlobURL.h" |
| 36 #include "KURL.h" | 36 #include "KURL.h" |
| 37 #include "MediaSource.h" |
| 38 #include "MediaSourceRegistry.h" |
| 37 #include "MemoryCache.h" | 39 #include "MemoryCache.h" |
| 38 #include "PublicURLManager.h" | 40 #include "PublicURLManager.h" |
| 39 #include "ResourceRequest.h" | 41 #include "ResourceRequest.h" |
| 40 #include "ScriptExecutionContext.h" | 42 #include "ScriptExecutionContext.h" |
| 41 #include "SecurityOrigin.h" | 43 #include "SecurityOrigin.h" |
| 42 #include "ThreadableBlobRegistry.h" | 44 #include "ThreadableBlobRegistry.h" |
| 43 #include <wtf/PassOwnPtr.h> | 45 #include <wtf/PassOwnPtr.h> |
| 44 #include <wtf/MainThread.h> | 46 #include <wtf/MainThread.h> |
| 45 | 47 |
| 46 #if ENABLE(MEDIA_SOURCE) | |
| 47 #include "MediaSource.h" | |
| 48 #include "MediaSourceRegistry.h" | |
| 49 #endif | |
| 50 | |
| 51 #if ENABLE(MEDIA_STREAM) | 48 #if ENABLE(MEDIA_STREAM) |
| 52 #include "MediaStream.h" | 49 #include "MediaStream.h" |
| 53 #include "MediaStreamRegistry.h" | 50 #include "MediaStreamRegistry.h" |
| 54 #endif | 51 #endif |
| 55 | 52 |
| 56 namespace WebCore { | 53 namespace WebCore { |
| 57 | 54 |
| 58 #if ENABLE(MEDIA_SOURCE) | |
| 59 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaSource* source) | 55 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaSource* source) |
| 60 { | 56 { |
| 61 // Since WebWorkers cannot obtain MediaSource objects, we should be on the m
ain thread. | 57 // Since WebWorkers cannot obtain MediaSource objects, we should be on the m
ain thread. |
| 62 ASSERT(isMainThread()); | 58 ASSERT(isMainThread()); |
| 63 | 59 |
| 64 if (!scriptExecutionContext || !source) | 60 if (!scriptExecutionContext || !source) |
| 65 return String(); | 61 return String(); |
| 66 | 62 |
| 67 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); | 63 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); |
| 68 if (publicURL.isEmpty()) | 64 if (publicURL.isEmpty()) |
| 69 return String(); | 65 return String(); |
| 70 | 66 |
| 71 MediaSourceRegistry::registry().registerMediaSourceURL(publicURL, source); | 67 MediaSourceRegistry::registry().registerMediaSourceURL(publicURL, source); |
| 72 scriptExecutionContext->publicURLManager().sourceURLs().add(publicURL.string
()); | 68 scriptExecutionContext->publicURLManager().sourceURLs().add(publicURL.string
()); |
| 73 | 69 |
| 74 return publicURL.string(); | 70 return publicURL.string(); |
| 75 } | 71 } |
| 76 #endif | |
| 77 | 72 |
| 78 #if ENABLE(MEDIA_STREAM) | 73 #if ENABLE(MEDIA_STREAM) |
| 79 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaStream* stream) | 74 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaStream* stream) |
| 80 { | 75 { |
| 81 if (!scriptExecutionContext || !stream) | 76 if (!scriptExecutionContext || !stream) |
| 82 return String(); | 77 return String(); |
| 83 | 78 |
| 84 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); | 79 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); |
| 85 if (publicURL.isEmpty()) | 80 if (publicURL.isEmpty()) |
| 86 return String(); | 81 return String(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 request.setCachePartition(scriptExecutionContext->topOrigin()->cachePartitio
n()); | 116 request.setCachePartition(scriptExecutionContext->topOrigin()->cachePartitio
n()); |
| 122 #endif | 117 #endif |
| 123 MemoryCache::removeRequestFromCache(scriptExecutionContext, request); | 118 MemoryCache::removeRequestFromCache(scriptExecutionContext, request); |
| 124 | 119 |
| 125 HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobU
RLs(); | 120 HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobU
RLs(); |
| 126 if (blobURLs.contains(url.string())) { | 121 if (blobURLs.contains(url.string())) { |
| 127 ThreadableBlobRegistry::unregisterBlobURL(url); | 122 ThreadableBlobRegistry::unregisterBlobURL(url); |
| 128 blobURLs.remove(url.string()); | 123 blobURLs.remove(url.string()); |
| 129 } | 124 } |
| 130 | 125 |
| 131 #if ENABLE(MEDIA_SOURCE) | |
| 132 HashSet<String>& sourceURLs = scriptExecutionContext->publicURLManager().sou
rceURLs(); | 126 HashSet<String>& sourceURLs = scriptExecutionContext->publicURLManager().sou
rceURLs(); |
| 133 if (sourceURLs.contains(url.string())) { | 127 if (sourceURLs.contains(url.string())) { |
| 134 MediaSourceRegistry::registry().unregisterMediaSourceURL(url); | 128 MediaSourceRegistry::registry().unregisterMediaSourceURL(url); |
| 135 sourceURLs.remove(url.string()); | 129 sourceURLs.remove(url.string()); |
| 136 } | 130 } |
| 137 #endif | |
| 138 #if ENABLE(MEDIA_STREAM) | 131 #if ENABLE(MEDIA_STREAM) |
| 139 HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().str
eamURLs(); | 132 HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().str
eamURLs(); |
| 140 if (streamURLs.contains(url.string())) { | 133 if (streamURLs.contains(url.string())) { |
| 141 // FIXME: make sure of this assertion below. Raise a spec question if re
quired. | 134 // FIXME: make sure of this assertion below. Raise a spec question if re
quired. |
| 142 // Since WebWorkers cannot obtain Stream objects, we should be on the ma
in thread. | 135 // Since WebWorkers cannot obtain Stream objects, we should be on the ma
in thread. |
| 143 ASSERT(isMainThread()); | 136 ASSERT(isMainThread()); |
| 144 MediaStreamRegistry::registry().unregisterMediaStreamURL(url); | 137 MediaStreamRegistry::registry().unregisterMediaStreamURL(url); |
| 145 streamURLs.remove(url.string()); | 138 streamURLs.remove(url.string()); |
| 146 } | 139 } |
| 147 #endif | 140 #endif |
| 148 } | 141 } |
| 149 | 142 |
| 150 } // namespace WebCore | 143 } // namespace WebCore |
| 151 | 144 |
| 152 #endif // ENABLE(BLOB) | 145 #endif // ENABLE(BLOB) |
| OLD | NEW |