Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 | 32 |
| 33 #include "core/platform/mediastream/chromium/MediaStreamCenterChromium.h" | 33 #include "core/platform/mediastream/chromium/MediaStreamCenterChromium.h" |
| 34 | 34 |
| 35 #include "core/platform/mediastream/MediaStreamDescriptor.h" | 35 #include "core/platform/mediastream/MediaStreamDescriptor.h" |
| 36 #include "core/platform/mediastream/MediaStreamSourcesQueryClient.h" | 36 #include "core/platform/mediastream/MediaStreamSourcesQueryClient.h" |
| 37 #include "wtf/MainThread.h" | |
| 38 #include "wtf/PassOwnPtr.h" | |
| 37 #include <public/Platform.h> | 39 #include <public/Platform.h> |
| 38 #include <public/WebMediaStream.h> | 40 #include <public/WebMediaStream.h> |
| 39 #include <public/WebMediaStreamCenter.h> | 41 #include <public/WebMediaStreamCenter.h> |
| 40 #include <public/WebMediaStreamSourcesRequest.h> | 42 #include <public/WebMediaStreamSourcesRequest.h> |
| 41 #include <public/WebMediaStreamTrack.h> | 43 #include <public/WebMediaStreamTrack.h> |
| 42 #include <wtf/MainThread.h> | |
| 43 #include <wtf/PassOwnPtr.h> | |
| 44 | 44 |
| 45 namespace WebCore { | 45 namespace WebCore { |
| 46 | 46 |
| 47 MediaStreamCenter& MediaStreamCenter::instance() | 47 MediaStreamCenter& MediaStreamCenter::instance() |
| 48 { | 48 { |
| 49 ASSERT(isMainThread()); | 49 ASSERT(isMainThread()); |
| 50 DEFINE_STATIC_LOCAL(MediaStreamCenterChromium, center, ()); | 50 DEFINE_STATIC_LOCAL(MediaStreamCenterChromium, center, ()); |
| 51 return center; | 51 return center; |
| 52 } | 52 } |
| 53 | 53 |
| 54 MediaStreamCenterChromium::MediaStreamCenterChromium() | 54 MediaStreamCenterChromium::MediaStreamCenterChromium() |
| 55 : m_private(adoptPtr(WebKit::Platform::current()->createMediaStreamCenter(th is))) | 55 : m_private(adoptPtr(WebKit::Platform::current()->createMediaStreamCenter(th is))) |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 MediaStreamCenterChromium::~MediaStreamCenterChromium() | 59 MediaStreamCenterChromium::~MediaStreamCenterChromium() |
| 60 { | 60 { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void MediaStreamCenterChromium::queryMediaStreamSources(PassRefPtr<MediaStreamSo urcesQueryClient> client) | 63 void MediaStreamCenterChromium::queryMediaStreamSources(PassRefPtr<MediaStreamSo urcesQueryClient> client) |
| 64 { | 64 { |
| 65 if (m_private) | 65 if (m_private) |
| 66 m_private->queryMediaStreamSources(client); | 66 m_private->queryMediaStreamSources(client); |
| 67 else { | 67 else { |
| 68 MediaStreamSourceVector audioSources, videoSources; | 68 MediaStreamSourceVector audioSources, videoSources; |
| 69 client->didCompleteQuery(audioSources, videoSources); | 69 client->didCompleteQuery(audioSources, videoSources); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool MediaStreamCenterChromium::getSourceInfos(const String& url, WebKit::WebVec tor<WebKit::WebSourceInfo>& sourceInfos) | |
| 74 { | |
| 75 return m_private ? m_private->getSourceInfos(url, sourceInfos) : false; | |
|
abarth-chromium
2013/05/31 17:30:08
A slightly more idiomatic way of doing this is:
r
Tommy Widenflycht
2013/06/05 11:51:38
Done.
| |
| 76 } | |
| 77 | |
| 73 void MediaStreamCenterChromium::didSetMediaStreamTrackEnabled(MediaStreamDescrip tor* stream, MediaStreamComponent* component) | 78 void MediaStreamCenterChromium::didSetMediaStreamTrackEnabled(MediaStreamDescrip tor* stream, MediaStreamComponent* component) |
| 74 { | 79 { |
| 75 if (m_private) { | 80 if (m_private) { |
| 76 if (component->enabled()) | 81 if (component->enabled()) |
| 77 m_private->didEnableMediaStreamTrack(stream, component); | 82 m_private->didEnableMediaStreamTrack(stream, component); |
| 78 else | 83 else |
| 79 m_private->didDisableMediaStreamTrack(stream, component); | 84 m_private->didDisableMediaStreamTrack(stream, component); |
| 80 } | 85 } |
| 81 } | 86 } |
| 82 | 87 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 108 m_private->didCreateMediaStream(webStream); | 113 m_private->didCreateMediaStream(webStream); |
| 109 } | 114 } |
| 110 } | 115 } |
| 111 | 116 |
| 112 void MediaStreamCenterChromium::stopLocalMediaStream(const WebKit::WebMediaStrea m& stream) | 117 void MediaStreamCenterChromium::stopLocalMediaStream(const WebKit::WebMediaStrea m& stream) |
| 113 { | 118 { |
| 114 endLocalMediaStream(stream); | 119 endLocalMediaStream(stream); |
| 115 } | 120 } |
| 116 | 121 |
| 117 } // namespace WebCore | 122 } // namespace WebCore |
| OLD | NEW |