Changeset 93713 in webkit
- Timestamp:
- Aug 24, 2011 11:07:43 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r93709 r93713 1 2011-08-24 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: add createObjectURL functionality 4 https://bugs.webkit.org/show_bug.cgi?id=65925 5 6 Reviewed by Adam Barth. 7 8 * fast/files/create-blob-url-crash-expected.txt: 9 1 10 2011-08-23 David Levin <levin@chromium.org> 2 11 -
trunk/LayoutTests/fast/files/create-blob-url-crash-expected.txt
r92327 r93713 1 1 Test that createObjectURL with no argument should throw an exception. 2 PASS: Not enough arguments2 PASS: Type error 3 3 DONE 4 4 -
trunk/Source/WebCore/CMakeLists.txt
r93385 r93713 2048 2048 page/MediaStreamController.cpp 2049 2049 page/MediaStreamFrameController.cpp 2050 platform/MediaStreamRegistry.cpp 2050 2051 ) 2051 2052 -
trunk/Source/WebCore/ChangeLog
r93709 r93713 1 2011-08-24 Tommy Widenflycht <tommyw@google.com> 2 3 MediaStream API: add createObjectURL functionality 4 https://bugs.webkit.org/show_bug.cgi?id=65925 5 6 This patch introduces the functionality for generating the url associated with a MediaStream, 7 which can then be assigned to the src attribute of the <video> tag for example. 8 9 Reviewed by Adam Barth. 10 11 * CMakeLists.txt: 12 * GNUmakefile.list.am: 13 * WebCore.gypi: 14 * WebCore.pro: 15 * WebCore.vcproj/WebCore.vcproj: 16 * WebCore.xcodeproj/project.pbxproj: 17 * dom/ScriptExecutionContext.cpp: 18 (WebCore::ScriptExecutionContext::~ScriptExecutionContext): 19 (WebCore::ScriptExecutionContext::createPublicBlobURL): 20 (WebCore::ScriptExecutionContext::revokePublicBlobURL): 21 * dom/ScriptExecutionContext.h: 22 * html/DOMURL.cpp: 23 (WebCore::DOMURL::createObjectURL): 24 * html/DOMURL.h: 25 * html/DOMURL.idl: 26 * platform/MediaStreamRegistry.cpp: Added. 27 (WebCore::MediaStreamRegistry::registry): 28 (WebCore::MediaStreamRegistry::registerMediaStreamURL): 29 (WebCore::MediaStreamRegistry::unregisterMediaStreamURL): 30 (WebCore::MediaStreamRegistry::mediaStream): 31 * platform/MediaStreamRegistry.h: Copied from Source/WebCore/html/DOMURL.h. 32 33 Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code. 34 1 35 2011-08-23 David Levin <levin@chromium.org> 2 36 -
trunk/Source/WebCore/GNUmakefile.list.am
r93492 r93713 2645 2645 Source/WebCore/platform/MIMETypeRegistry.cpp \ 2646 2646 Source/WebCore/platform/MIMETypeRegistry.h \ 2647 Source/WebCore/platform/MediaStreamRegistry.cpp \ 2648 Source/WebCore/platform/MediaStreamRegistry.h \ 2647 2649 Source/WebCore/platform/MemoryPressureHandler.cpp \ 2648 2650 Source/WebCore/platform/MemoryPressureHandler.h \ -
trunk/Source/WebCore/WebCore.gypi
r93705 r93713 3023 3023 'platform/LocalizedStrings.cpp', 3024 3024 'platform/Logging.cpp', 3025 'platform/MediaStreamRegistry.cpp', 3026 'platform/MediaStreamRegistry.h', 3025 3027 'platform/MemoryPressureHandler.cpp', 3026 3028 'platform/MIMETypeRegistry.cpp', -
trunk/Source/WebCore/WebCore.pro
r93385 r93713 3261 3261 page/NavigatorUserMediaError.h \ 3262 3262 page/NavigatorUserMediaErrorCallback.h \ 3263 page/NavigatorUserMediaSuccessCallback.h 3263 page/NavigatorUserMediaSuccessCallback.h \ 3264 platform/MediaStreamRegistry.h 3264 3265 3265 3266 SOURCES += \ … … 3272 3273 p2p/PeerConnection.cpp \ 3273 3274 page/MediaStreamController.cpp \ 3274 page/MediaStreamFrameController.cpp 3275 page/MediaStreamFrameController.cpp \ 3276 platform/MediaStreamRegistry.cpp 3275 3277 3276 3278 v8 { -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r93705 r93713 26863 26863 </File> 26864 26864 <File 26865 RelativePath="..\platform\MediaStreamRegistry.cpp" 26866 > 26867 </File> 26868 <File 26869 RelativePath="..\platform\MediaStreamRegistry.h" 26870 > 26871 </File> 26872 <File 26865 26873 RelativePath="..\platform\MemoryPressureHandler.cpp" 26866 26874 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r93385 r93713 1122 1122 4969B0F213D0B33F00DF3521 /* HitTestingTransformState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4969B0F013D0B33F00DF3521 /* HitTestingTransformState.cpp */; }; 1123 1123 4969B0F313D0B33F00DF3521 /* HitTestingTransformState.h in Headers */ = {isa = PBXBuildFile; fileRef = 4969B0F113D0B33F00DF3521 /* HitTestingTransformState.h */; }; 1124 49785EE013F192F000A795AD /* MediaStreamRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49785EDE13F192F000A795AD /* MediaStreamRegistry.cpp */; }; 1125 49785EE113F192F000A795AD /* MediaStreamRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 49785EDF13F192F000A795AD /* MediaStreamRegistry.h */; }; 1124 1126 4983913F0F1E767500C23782 /* JSWebKitCSSMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4983913D0F1E767500C23782 /* JSWebKitCSSMatrix.cpp */; }; 1125 1127 498391400F1E767500C23782 /* JSWebKitCSSMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 4983913E0F1E767500C23782 /* JSWebKitCSSMatrix.h */; }; … … 7709 7711 4969B0F013D0B33F00DF3521 /* HitTestingTransformState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HitTestingTransformState.cpp; sourceTree = "<group>"; }; 7710 7712 4969B0F113D0B33F00DF3521 /* HitTestingTransformState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HitTestingTransformState.h; sourceTree = "<group>"; }; 7713 49785EDE13F192F000A795AD /* MediaStreamRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaStreamRegistry.cpp; sourceTree = "<group>"; }; 7714 49785EDF13F192F000A795AD /* MediaStreamRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamRegistry.h; sourceTree = "<group>"; }; 7711 7715 4983913D0F1E767500C23782 /* JSWebKitCSSMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrix.cpp; sourceTree = "<group>"; }; 7712 7716 4983913E0F1E767500C23782 /* JSWebKitCSSMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSMatrix.h; sourceTree = "<group>"; }; … … 19109 19113 A8239DFE09B3CF8A00B60641 /* Logging.cpp */, 19110 19114 A8239DFF09B3CF8A00B60641 /* Logging.h */, 19115 49785EDE13F192F000A795AD /* MediaStreamRegistry.cpp */, 19116 49785EDF13F192F000A795AD /* MediaStreamRegistry.h */, 19111 19117 657EDA061385CB97004E0645 /* MemoryPressureHandler.cpp */, 19112 19118 657EDA071385CB97004E0645 /* MemoryPressureHandler.h */, … … 22406 22412 B1E54596134629C10092A545 /* MediaStreamFrameController.h in Headers */, 22407 22413 B14353D6138EA8ED00D53276 /* MediaStreamList.h in Headers */, 22414 49785EE113F192F000A795AD /* MediaStreamRegistry.h in Headers */, 22408 22415 49C9F32613D574F90052600A /* MediaStreamTrack.h in Headers */, 22409 22416 49C9F32313D574F90052600A /* MediaStreamTrackList.h in Headers */, … … 25423 25430 B1E54595134629C10092A545 /* MediaStreamFrameController.cpp in Sources */, 25424 25431 B14353D5138EA8ED00D53276 /* MediaStreamList.cpp in Sources */, 25432 49785EE013F192F000A795AD /* MediaStreamRegistry.cpp in Sources */, 25425 25433 49C9F32713D574F90052600A /* MediaStreamTrack.cpp in Sources */, 25426 25434 49C9F32413D574F90052600A /* MediaStreamTrackList.cpp in Sources */, -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r85094 r93713 40 40 #include "EventTarget.h" 41 41 #include "FileThread.h" 42 #include "MediaStream.h" 43 #include "MediaStreamRegistry.h" 42 44 #include "MessagePort.h" 43 45 #include "ScriptCallStack.h" … … 134 136 (*iter)->contextDestroyed(); 135 137 } 138 #endif 139 140 #if ENABLE(MEDIA_STREAM) 141 HashSet<String>::iterator publicStreamURLsEnd = m_publicStreamURLs.end(); 142 for (HashSet<String>::iterator iter = m_publicStreamURLs.begin(); iter != publicStreamURLsEnd; ++iter) 143 MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter)); 136 144 #endif 137 145 } … … 378 386 379 387 #if ENABLE(BLOB) 388 389 #if ENABLE(MEDIA_STREAM) 390 KURL ScriptExecutionContext::createPublicBlobURL(MediaStream* stream) 391 { 392 if (!stream) 393 return KURL(); 394 395 KURL publicURL = BlobURL::createPublicURL(securityOrigin()); 396 397 // Since WebWorkers cannot obtain Stream objects, we should be on the main thread. 398 ASSERT(isMainThread()); 399 MediaStreamRegistry::registry().registerMediaStreamURL(publicURL, stream); 400 m_publicStreamURLs.add(publicURL.string()); 401 return publicURL; 402 } 403 #endif // ENABLE(MEDIA_STREAM) 404 380 405 KURL ScriptExecutionContext::createPublicBlobURL(Blob* blob) 381 406 { … … 396 421 m_publicBlobURLs.remove(url.string()); 397 422 } 398 } 399 #endif 423 #if ENABLE(MEDIA_STREAM) 424 if (m_publicStreamURLs.contains(url.string())) { 425 // FIXME: make sure of this assertion below. Raise a spec question if required. 426 // Since WebWorkers cannot obtain Stream objects, we should be on the main thread. 427 ASSERT(isMainThread()); 428 MediaStreamRegistry::registry().unregisterMediaStreamURL(url); 429 m_publicStreamURLs.remove(url.string()); 430 } 431 #endif // ENABLE(MEDIA_STREAM) 432 } 433 #endif // ENABLE(BLOB) 400 434 401 435 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r86251 r93713 67 67 #endif 68 68 69 #if ENABLE(MEDIA_STREAM) 70 class MediaStream; 71 #endif 72 69 73 class ScriptExecutionContext { 70 74 public: … … 145 149 146 150 #if ENABLE(BLOB) 151 #if ENABLE(MEDIA_STREAM) 152 KURL createPublicBlobURL(MediaStream*); 153 #endif // ENABLE(MEDIA_STREAM) 147 154 KURL createPublicBlobURL(Blob*); 148 155 void revokePublicBlobURL(const KURL&); 149 #endif 156 #endif // ENABLE(BLOB) 150 157 151 158 #if USE(JSC) … … 191 198 #if ENABLE(BLOB) 192 199 HashSet<String> m_publicBlobURLs; 200 HashSet<String> m_publicStreamURLs; 193 201 HashSet<DOMURL*> m_domUrls; 194 202 #endif -
trunk/Source/WebCore/html/DOMURL.cpp
r77914 r93713 54 54 } 55 55 56 #if ENABLE(MEDIA_STREAM) 57 String DOMURL::createObjectURL(MediaStream* stream) 58 { 59 if (!m_scriptExecutionContext) 60 return String(); 61 return m_scriptExecutionContext->createPublicBlobURL(stream).string(); 62 } 63 #endif 64 56 65 String DOMURL::createObjectURL(Blob* blob) 57 66 { -
trunk/Source/WebCore/html/DOMURL.h
r76652 r93713 36 36 37 37 class Blob; 38 class MediaStream; 38 39 class ScriptExecutionContext; 39 40 … … 43 44 ~DOMURL(); 44 45 46 #if ENABLE(MEDIA_STREAM) 47 String createObjectURL(MediaStream*); 48 #endif 45 49 String createObjectURL(Blob*); 46 50 void revokeObjectURL(const String&); -
trunk/Source/WebCore/html/DOMURL.idl
r92327 r93713 32 32 NoStaticTables 33 33 ] DOMURL { 34 #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM 35 [ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); 36 #endif 34 37 [ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); 35 38 void revokeObjectURL(in DOMString url); -
trunk/Source/WebCore/platform/MediaStreamRegistry.h
r93712 r93713 5 5 * modification, are permitted provided that the following conditions 6 6 * are met: 7 *8 7 * 1. Redistributions of source code must retain the above copyright 9 8 * notice, this list of conditions and the following disclaimer. … … 12 11 * documentation and/or other materials provided with the distribution. 13 12 * 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS"AND ANY13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 15 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 18 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 18 * (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 * ONANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 23 */ 25 24 26 #ifndef DOMURL_h27 #define DOMURL_h25 #ifndef MediaStreamRegistry_h 26 #define MediaStreamRegistry_h 28 27 29 #if ENABLE(BLOB) 30 31 #include "PlatformString.h" 28 #include <wtf/HashMap.h> 32 29 #include <wtf/PassRefPtr.h> 33 #include <wtf/ RefCounted.h>30 #include <wtf/text/StringHash.h> 34 31 35 32 namespace WebCore { 36 33 37 class Blob;38 class ScriptExecutionContext;34 class KURL; 35 class MediaStream; 39 36 40 class DOMURL : public RefCounted<DOMURL>{37 class MediaStreamRegistry { 41 38 public: 42 static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); }43 ~DOMURL();39 // Returns a single instance of MediaStreamRegistry. 40 static MediaStreamRegistry& registry(); 44 41 45 String createObjectURL(Blob*); 46 void revokeObjectURL(const String&); 47 48 void contextDestroyed(); 49 ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext; } 42 // Registers a blob URL referring to the specified stream data. 43 void registerMediaStreamURL(const KURL&, PassRefPtr<MediaStream>); 44 void unregisterMediaStreamURL(const KURL&); 45 MediaStream* mediaStream(const KURL&) const; 50 46 51 47 private: 52 explicit DOMURL(ScriptExecutionContext*); 53 54 ScriptExecutionContext* m_scriptExecutionContext; 48 typedef HashMap<String, RefPtr<MediaStream> > URLStreamMap; 49 URLStreamMap m_streams; 55 50 }; 56 51 57 52 } // namespace WebCore 58 53 59 #endif // ENABLE(BLOB) 60 61 #endif // DOMURL_h 54 #endif // MediaStreamRegistry_h
Note: See TracChangeset
for help on using the changeset viewer.