OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "modules/mediastream/MediaStreamTrackSourcesRequestImpl.h" | 27 #include "modules/mediastream/MediaStreamTrackSourcesRequestImpl.h" |
28 | 28 |
29 #include "core/dom/CrossThreadTask.h" | 29 #include "core/dom/CrossThreadTask.h" |
30 #include "core/dom/ExecutionContext.h" | 30 #include "core/dom/ExecutionContext.h" |
31 #include "modules/mediastream/MediaStreamTrackSourcesCallback.h" | 31 #include "modules/mediastream/MediaStreamTrackSourcesCallback.h" |
32 #include "platform/weborigin/SecurityOrigin.h" | 32 #include "platform/weborigin/SecurityOrigin.h" |
33 #include "public/platform/WebSourceInfo.h" | 33 #include "public/platform/WebSourceInfo.h" |
34 #include "public/platform/WebTraceLocation.h" | |
35 #include "wtf/Functional.h" | 34 #include "wtf/Functional.h" |
36 #include "wtf/PassOwnPtr.h" | 35 #include "wtf/PassOwnPtr.h" |
37 | 36 |
38 namespace blink { | 37 namespace blink { |
39 | 38 |
40 MediaStreamTrackSourcesRequestImpl* MediaStreamTrackSourcesRequestImpl::create(E
xecutionContext& context, MediaStreamTrackSourcesCallback* callback) | 39 MediaStreamTrackSourcesRequestImpl* MediaStreamTrackSourcesRequestImpl::create(E
xecutionContext& context, MediaStreamTrackSourcesCallback* callback) |
41 { | 40 { |
42 return new MediaStreamTrackSourcesRequestImpl(context, callback); | 41 return new MediaStreamTrackSourcesRequestImpl(context, callback); |
43 } | 42 } |
44 | 43 |
(...skipping 11 matching lines...) Expand all Loading... |
56 { | 55 { |
57 return m_executionContext->securityOrigin()->toString(); | 56 return m_executionContext->securityOrigin()->toString(); |
58 } | 57 } |
59 | 58 |
60 void MediaStreamTrackSourcesRequestImpl::requestSucceeded(const WebVector<WebSou
rceInfo>& webSourceInfos) | 59 void MediaStreamTrackSourcesRequestImpl::requestSucceeded(const WebVector<WebSou
rceInfo>& webSourceInfos) |
61 { | 60 { |
62 ASSERT(m_callback); | 61 ASSERT(m_callback); |
63 | 62 |
64 for (size_t i = 0; i < webSourceInfos.size(); ++i) | 63 for (size_t i = 0; i < webSourceInfos.size(); ++i) |
65 m_sourceInfos.append(SourceInfo::create(webSourceInfos[i])); | 64 m_sourceInfos.append(SourceInfo::create(webSourceInfos[i])); |
66 m_executionContext->postTask(FROM_HERE, createCrossThreadTask(&MediaStreamTr
ackSourcesRequestImpl::performCallback, this)); | 65 m_executionContext->postTask(createCrossThreadTask(&MediaStreamTrackSourcesR
equestImpl::performCallback, this)); |
67 } | 66 } |
68 | 67 |
69 void MediaStreamTrackSourcesRequestImpl::performCallback() | 68 void MediaStreamTrackSourcesRequestImpl::performCallback() |
70 { | 69 { |
71 m_callback->handleEvent(m_sourceInfos); | 70 m_callback->handleEvent(m_sourceInfos); |
72 m_callback.clear(); | 71 m_callback.clear(); |
73 } | 72 } |
74 | 73 |
75 DEFINE_TRACE(MediaStreamTrackSourcesRequestImpl) | 74 DEFINE_TRACE(MediaStreamTrackSourcesRequestImpl) |
76 { | 75 { |
77 visitor->trace(m_callback); | 76 visitor->trace(m_callback); |
78 visitor->trace(m_executionContext); | 77 visitor->trace(m_executionContext); |
79 visitor->trace(m_sourceInfos); | 78 visitor->trace(m_sourceInfos); |
80 MediaStreamTrackSourcesRequest::trace(visitor); | 79 MediaStreamTrackSourcesRequest::trace(visitor); |
81 } | 80 } |
82 | 81 |
83 } // namespace blink | 82 } // namespace blink |
OLD | NEW |