Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCStatsRequestImpl.cpp

Issue 1744133002: Reduce ActiveDOMObjects from modules/mediastream/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 RTCStatsRequestImpl* request = new RTCStatsRequestImpl(context, requester, c allback, selector); 35 return new RTCStatsRequestImpl(context, requester, callback, selector);
36 request->suspendIfNeeded();
37 return request;
38 } 36 }
39 37
40 RTCStatsRequestImpl::RTCStatsRequestImpl(ExecutionContext* context, RTCPeerConne ction* requester, RTCStatsCallback* callback, MediaStreamTrack* selector) 38 RTCStatsRequestImpl::RTCStatsRequestImpl(ExecutionContext* context, RTCPeerConne ction* requester, RTCStatsCallback* callback, MediaStreamTrack* selector)
41 : ActiveDOMObject(context) 39 : ContextLifecycleObserver(context)
42 , m_successCallback(callback) 40 , m_successCallback(callback)
43 , m_component(selector ? selector->component() : 0) 41 , m_component(selector ? selector->component() : 0)
44 , m_requester(requester) 42 , m_requester(requester)
45 { 43 {
46 ASSERT(m_requester); 44 ASSERT(m_requester);
47 } 45 }
48 46
49 RTCStatsRequestImpl::~RTCStatsRequestImpl() 47 RTCStatsRequestImpl::~RTCStatsRequestImpl()
50 { 48 {
51 } 49 }
(...skipping 14 matching lines...) Expand all
66 } 64 }
67 65
68 void RTCStatsRequestImpl::requestSucceeded(RTCStatsResponseBase* response) 66 void RTCStatsRequestImpl::requestSucceeded(RTCStatsResponseBase* response)
69 { 67 {
70 bool shouldFireCallback = m_requester ? m_requester->shouldFireGetStatsCallb ack() : false; 68 bool shouldFireCallback = m_requester ? m_requester->shouldFireGetStatsCallb ack() : false;
71 if (shouldFireCallback && m_successCallback) 69 if (shouldFireCallback && m_successCallback)
72 m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response)) ; 70 m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response)) ;
73 clear(); 71 clear();
74 } 72 }
75 73
76 void RTCStatsRequestImpl::stop() 74 void RTCStatsRequestImpl::contextDestroyed()
77 { 75 {
78 clear(); 76 clear();
79 } 77 }
80 78
81 void RTCStatsRequestImpl::clear() 79 void RTCStatsRequestImpl::clear()
82 { 80 {
83 m_successCallback.clear(); 81 m_successCallback.clear();
84 m_requester.clear(); 82 m_requester.clear();
85 } 83 }
86 84
87 DEFINE_TRACE(RTCStatsRequestImpl) 85 DEFINE_TRACE(RTCStatsRequestImpl)
88 { 86 {
89 visitor->trace(m_successCallback); 87 visitor->trace(m_successCallback);
90 visitor->trace(m_component); 88 visitor->trace(m_component);
91 visitor->trace(m_requester); 89 visitor->trace(m_requester);
92 RTCStatsRequest::trace(visitor); 90 RTCStatsRequest::trace(visitor);
93 ActiveDOMObject::trace(visitor); 91 ContextLifecycleObserver::trace(visitor);
94 } 92 }
95 93
96 } // namespace blink 94 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698