| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "core/html/HTMLMediaElement.h" | 27 #include "core/html/HTMLMediaElement.h" |
| 28 #include "modules/mediastream/MediaStream.h" | 28 #include "modules/mediastream/MediaStream.h" |
| 29 #include "platform/weborigin/KURL.h" | 29 #include "platform/weborigin/KURL.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 MediaStreamRegistry& MediaStreamRegistry::registry() | 33 MediaStreamRegistry& MediaStreamRegistry::registry() |
| 34 { | 34 { |
| 35 // Since WebWorkers cannot obtain MediaStream objects, we should be on the m
ain thread. | 35 // Since WebWorkers cannot obtain MediaStream objects, we should be on the m
ain thread. |
| 36 ASSERT(isMainThread()); | 36 DCHECK(isMainThread()); |
| 37 DEFINE_STATIC_LOCAL(MediaStreamRegistry, instance, ()); | 37 DEFINE_STATIC_LOCAL(MediaStreamRegistry, instance, ()); |
| 38 return instance; | 38 return instance; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void MediaStreamRegistry::registerURL(SecurityOrigin*, const KURL& url, URLRegis
trable* stream) | 41 void MediaStreamRegistry::registerURL(SecurityOrigin*, const KURL& url, URLRegis
trable* stream) |
| 42 { | 42 { |
| 43 ASSERT(&stream->registry() == this); | 43 DCHECK(&stream->registry() == this); |
| 44 ASSERT(isMainThread()); | 44 DCHECK(isMainThread()); |
| 45 m_streamDescriptors.set(url.getString(), static_cast<MediaStream*>(stream)->
descriptor()); | 45 m_streamDescriptors.set(url.getString(), static_cast<MediaStream*>(stream)->
descriptor()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void MediaStreamRegistry::unregisterURL(const KURL& url) | 48 void MediaStreamRegistry::unregisterURL(const KURL& url) |
| 49 { | 49 { |
| 50 ASSERT(isMainThread()); | 50 DCHECK(isMainThread()); |
| 51 m_streamDescriptors.remove(url.getString()); | 51 m_streamDescriptors.remove(url.getString()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool MediaStreamRegistry::contains(const String& url) | 54 bool MediaStreamRegistry::contains(const String& url) |
| 55 { | 55 { |
| 56 ASSERT(isMainThread()); | 56 DCHECK(isMainThread()); |
| 57 return m_streamDescriptors.contains(url); | 57 return m_streamDescriptors.contains(url); |
| 58 } | 58 } |
| 59 | 59 |
| 60 MediaStreamDescriptor* MediaStreamRegistry::lookupMediaStreamDescriptor(const St
ring& url) | 60 MediaStreamDescriptor* MediaStreamRegistry::lookupMediaStreamDescriptor(const St
ring& url) |
| 61 { | 61 { |
| 62 ASSERT(isMainThread()); | 62 DCHECK(isMainThread()); |
| 63 return m_streamDescriptors.get(url); | 63 return m_streamDescriptors.get(url); |
| 64 } | 64 } |
| 65 | 65 |
| 66 MediaStreamRegistry::MediaStreamRegistry() | 66 MediaStreamRegistry::MediaStreamRegistry() |
| 67 { | 67 { |
| 68 HTMLMediaElement::setMediaStreamRegistry(this); | 68 HTMLMediaElement::setMediaStreamRegistry(this); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |