| 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 24 matching lines...) Expand all Loading... |
| 35 #include "BlobURL.h" | 35 #include "BlobURL.h" |
| 36 #include "KURL.h" | 36 #include "KURL.h" |
| 37 #include "MemoryCache.h" | 37 #include "MemoryCache.h" |
| 38 #include "PublicURLManager.h" | 38 #include "PublicURLManager.h" |
| 39 #include "ScriptExecutionContext.h" | 39 #include "ScriptExecutionContext.h" |
| 40 #include "SecurityOrigin.h" | 40 #include "SecurityOrigin.h" |
| 41 #include "ThreadableBlobRegistry.h" | 41 #include "ThreadableBlobRegistry.h" |
| 42 #include <wtf/PassOwnPtr.h> | 42 #include <wtf/PassOwnPtr.h> |
| 43 #include <wtf/MainThread.h> | 43 #include <wtf/MainThread.h> |
| 44 | 44 |
| 45 #if ENABLE(MEDIA_SOURCE) | |
| 46 #include "MediaSource.h" | |
| 47 #include "MediaSourceRegistry.h" | |
| 48 #endif | |
| 49 | |
| 50 #if ENABLE(MEDIA_STREAM) | 45 #if ENABLE(MEDIA_STREAM) |
| 51 #include "MediaStream.h" | 46 #include "MediaStream.h" |
| 52 #include "MediaStreamRegistry.h" | 47 #include "MediaStreamRegistry.h" |
| 53 #endif | 48 #endif |
| 54 | 49 |
| 55 namespace WebCore { | 50 namespace WebCore { |
| 56 | 51 |
| 57 #if ENABLE(MEDIA_SOURCE) | |
| 58 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaSource* source) | |
| 59 { | |
| 60 // Since WebWorkers cannot obtain MediaSource objects, we should be on the m
ain thread. | |
| 61 ASSERT(isMainThread()); | |
| 62 | |
| 63 if (!scriptExecutionContext || !source) | |
| 64 return String(); | |
| 65 | |
| 66 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); | |
| 67 if (publicURL.isEmpty()) | |
| 68 return String(); | |
| 69 | |
| 70 MediaSourceRegistry::registry().registerMediaSourceURL(publicURL, source); | |
| 71 scriptExecutionContext->publicURLManager().streamURLs().add(publicURL.string
()); | |
| 72 | |
| 73 return publicURL.string(); | |
| 74 } | |
| 75 #endif | |
| 76 | |
| 77 #if ENABLE(MEDIA_STREAM) | 52 #if ENABLE(MEDIA_STREAM) |
| 78 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaStream* stream) | 53 String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, M
ediaStream* stream) |
| 79 { | 54 { |
| 80 if (!scriptExecutionContext || !stream) | 55 if (!scriptExecutionContext || !stream) |
| 81 return String(); | 56 return String(); |
| 82 | 57 |
| 83 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); | 58 KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOr
igin()); |
| 84 if (publicURL.isEmpty()) | 59 if (publicURL.isEmpty()) |
| 85 return String(); | 60 return String(); |
| 86 | 61 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ASSERT(isMainThread()); | 106 ASSERT(isMainThread()); |
| 132 MediaStreamRegistry::registry().unregisterMediaStreamURL(url); | 107 MediaStreamRegistry::registry().unregisterMediaStreamURL(url); |
| 133 streamURLs.remove(url.string()); | 108 streamURLs.remove(url.string()); |
| 134 } | 109 } |
| 135 #endif | 110 #endif |
| 136 } | 111 } |
| 137 | 112 |
| 138 } // namespace WebCore | 113 } // namespace WebCore |
| 139 | 114 |
| 140 #endif // ENABLE(BLOB) | 115 #endif // ENABLE(BLOB) |
| OLD | NEW |