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 | 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 14 matching lines...) Expand all Loading... |
25 #include "modules/mediastream/RTCStatsRequestImpl.h" | 25 #include "modules/mediastream/RTCStatsRequestImpl.h" |
26 | 26 |
27 #include "modules/mediastream/MediaStreamTrack.h" | 27 #include "modules/mediastream/MediaStreamTrack.h" |
28 #include "modules/mediastream/RTCPeerConnection.h" | 28 #include "modules/mediastream/RTCPeerConnection.h" |
29 #include "modules/mediastream/RTCStatsCallback.h" | 29 #include "modules/mediastream/RTCStatsCallback.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 RTCStatsRequestImpl* RTCStatsRequestImpl::create(ExecutionContext* context, RTCP
eerConnection* requester, RTCStatsCallback* callback, MediaStreamTrack* selector
) | 33 RTCStatsRequestImpl* RTCStatsRequestImpl::create(ExecutionContext* context, RTCP
eerConnection* requester, RTCStatsCallback* callback, MediaStreamTrack* selector
) |
34 { | 34 { |
35 return new RTCStatsRequestImpl(context, requester, callback, selector); | 35 RTCStatsRequestImpl* request = new RTCStatsRequestImpl(context, requester, c
allback, selector); |
| 36 request->suspendIfNeeded(); |
| 37 return request; |
36 } | 38 } |
37 | 39 |
38 RTCStatsRequestImpl::RTCStatsRequestImpl(ExecutionContext* context, RTCPeerConne
ction* requester, RTCStatsCallback* callback, MediaStreamTrack* selector) | 40 RTCStatsRequestImpl::RTCStatsRequestImpl(ExecutionContext* context, RTCPeerConne
ction* requester, RTCStatsCallback* callback, MediaStreamTrack* selector) |
39 : ContextLifecycleObserver(context) | 41 : ActiveDOMObject(context) |
40 , m_successCallback(callback) | 42 , m_successCallback(callback) |
41 , m_component(selector ? selector->component() : 0) | 43 , m_component(selector ? selector->component() : 0) |
42 , m_requester(requester) | 44 , m_requester(requester) |
43 { | 45 { |
44 ASSERT(m_requester); | 46 ASSERT(m_requester); |
45 } | 47 } |
46 | 48 |
47 RTCStatsRequestImpl::~RTCStatsRequestImpl() | 49 RTCStatsRequestImpl::~RTCStatsRequestImpl() |
48 { | 50 { |
49 } | 51 } |
(...skipping 14 matching lines...) Expand all Loading... |
64 } | 66 } |
65 | 67 |
66 void RTCStatsRequestImpl::requestSucceeded(RTCStatsResponseBase* response) | 68 void RTCStatsRequestImpl::requestSucceeded(RTCStatsResponseBase* response) |
67 { | 69 { |
68 bool shouldFireCallback = m_requester ? m_requester->shouldFireGetStatsCallb
ack() : false; | 70 bool shouldFireCallback = m_requester ? m_requester->shouldFireGetStatsCallb
ack() : false; |
69 if (shouldFireCallback && m_successCallback) | 71 if (shouldFireCallback && m_successCallback) |
70 m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response))
; | 72 m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response))
; |
71 clear(); | 73 clear(); |
72 } | 74 } |
73 | 75 |
74 void RTCStatsRequestImpl::contextDestroyed() | 76 void RTCStatsRequestImpl::stop() |
75 { | 77 { |
76 clear(); | 78 clear(); |
77 } | 79 } |
78 | 80 |
79 void RTCStatsRequestImpl::clear() | 81 void RTCStatsRequestImpl::clear() |
80 { | 82 { |
81 m_successCallback.clear(); | 83 m_successCallback.clear(); |
82 m_requester.clear(); | 84 m_requester.clear(); |
83 } | 85 } |
84 | 86 |
85 DEFINE_TRACE(RTCStatsRequestImpl) | 87 DEFINE_TRACE(RTCStatsRequestImpl) |
86 { | 88 { |
87 visitor->trace(m_successCallback); | 89 visitor->trace(m_successCallback); |
88 visitor->trace(m_component); | 90 visitor->trace(m_component); |
89 visitor->trace(m_requester); | 91 visitor->trace(m_requester); |
90 RTCStatsRequest::trace(visitor); | 92 RTCStatsRequest::trace(visitor); |
91 ContextLifecycleObserver::trace(visitor); | 93 ActiveDOMObject::trace(visitor); |
92 } | 94 } |
93 | 95 |
94 } // namespace blink | 96 } // namespace blink |
OLD | NEW |