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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/RTCVoidRequestImpl.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
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/RTCVoidRequestImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 22 matching lines...) Expand all
33 #include "core/dom/DOMException.h" 33 #include "core/dom/DOMException.h"
34 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
35 #include "core/html/VoidCallback.h" 35 #include "core/html/VoidCallback.h"
36 #include "modules/mediastream/RTCPeerConnection.h" 36 #include "modules/mediastream/RTCPeerConnection.h"
37 #include "modules/mediastream/RTCPeerConnectionErrorCallback.h" 37 #include "modules/mediastream/RTCPeerConnectionErrorCallback.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 RTCVoidRequestImpl* RTCVoidRequestImpl::create(ExecutionContext* context, RTCPee rConnection* requester, VoidCallback* successCallback, RTCPeerConnectionErrorCal lback* errorCallback) 41 RTCVoidRequestImpl* RTCVoidRequestImpl::create(ExecutionContext* context, RTCPee rConnection* requester, VoidCallback* successCallback, RTCPeerConnectionErrorCal lback* errorCallback)
42 { 42 {
43 RTCVoidRequestImpl* request = new RTCVoidRequestImpl(context, requester, suc cessCallback, errorCallback); 43 return new RTCVoidRequestImpl(context, requester, successCallback, errorCall back);
44 request->suspendIfNeeded();
45 return request;
46 } 44 }
47 45
48 RTCVoidRequestImpl::RTCVoidRequestImpl(ExecutionContext* context, RTCPeerConnect ion* requester, VoidCallback* successCallback, RTCPeerConnectionErrorCallback* e rrorCallback) 46 RTCVoidRequestImpl::RTCVoidRequestImpl(ExecutionContext* context, RTCPeerConnect ion* requester, VoidCallback* successCallback, RTCPeerConnectionErrorCallback* e rrorCallback)
49 : ActiveDOMObject(context) 47 : ContextLifecycleObserver(context)
50 , m_successCallback(successCallback) 48 , m_successCallback(successCallback)
51 , m_errorCallback(errorCallback) 49 , m_errorCallback(errorCallback)
52 , m_requester(requester) 50 , m_requester(requester)
53 { 51 {
54 ASSERT(m_requester); 52 ASSERT(m_requester);
55 } 53 }
56 54
57 RTCVoidRequestImpl::~RTCVoidRequestImpl() 55 RTCVoidRequestImpl::~RTCVoidRequestImpl()
58 { 56 {
59 } 57 }
(...skipping 11 matching lines...) Expand all
71 { 69 {
72 bool shouldFireCallback = m_requester && m_requester->shouldFireDefaultCallb acks(); 70 bool shouldFireCallback = m_requester && m_requester->shouldFireDefaultCallb acks();
73 if (shouldFireCallback && m_errorCallback.get()) { 71 if (shouldFireCallback && m_errorCallback.get()) {
74 // TODO(guidou): The error code should come from the content layer. See crbug.com/589455 72 // TODO(guidou): The error code should come from the content layer. See crbug.com/589455
75 m_errorCallback->handleEvent(DOMException::create(OperationError, error) ); 73 m_errorCallback->handleEvent(DOMException::create(OperationError, error) );
76 } 74 }
77 75
78 clear(); 76 clear();
79 } 77 }
80 78
81 void RTCVoidRequestImpl::stop() 79 void RTCVoidRequestImpl::contextDestroyed()
82 { 80 {
83 clear(); 81 clear();
84 } 82 }
85 83
86 void RTCVoidRequestImpl::clear() 84 void RTCVoidRequestImpl::clear()
87 { 85 {
88 m_successCallback.clear(); 86 m_successCallback.clear();
89 m_errorCallback.clear(); 87 m_errorCallback.clear();
90 m_requester.clear(); 88 m_requester.clear();
91 } 89 }
92 90
93 DEFINE_TRACE(RTCVoidRequestImpl) 91 DEFINE_TRACE(RTCVoidRequestImpl)
94 { 92 {
95 visitor->trace(m_successCallback); 93 visitor->trace(m_successCallback);
96 visitor->trace(m_errorCallback); 94 visitor->trace(m_errorCallback);
97 visitor->trace(m_requester); 95 visitor->trace(m_requester);
98 RTCVoidRequest::trace(visitor); 96 RTCVoidRequest::trace(visitor);
99 ActiveDOMObject::trace(visitor); 97 ContextLifecycleObserver::trace(visitor);
100 } 98 }
101 99
102 } // namespace blink 100 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/RTCVoidRequestImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698