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

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

Issue 1862163002: WebKit MediaStream cleanup: ASSERT-->DCHECK and ASSERT_NOT_REACHED-->NOTREACHED etc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted CHECK --> RELEASE_ASSERT and added TODO Created 4 years, 8 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/URLMediaStream.cpp ('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) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 static WebMediaConstraints parseOptions(ExecutionContext* context, const Boolean OrMediaTrackConstraintSet& options, MediaErrorState& errorState) 51 static WebMediaConstraints parseOptions(ExecutionContext* context, const Boolean OrMediaTrackConstraintSet& options, MediaErrorState& errorState)
52 { 52 {
53 WebMediaConstraints constraints; 53 WebMediaConstraints constraints;
54 54
55 Dictionary constraintsDictionary; 55 Dictionary constraintsDictionary;
56 if (options.isNull()) { 56 if (options.isNull()) {
57 // Do nothing. 57 // Do nothing.
58 } else if (options.isMediaTrackConstraintSet()) { 58 } else if (options.isMediaTrackConstraintSet()) {
59 constraints = MediaConstraintsImpl::create(context, options.getAsMediaTr ackConstraintSet(), errorState); 59 constraints = MediaConstraintsImpl::create(context, options.getAsMediaTr ackConstraintSet(), errorState);
60 } else { 60 } else {
61 ASSERT(options.isBoolean()); 61 DCHECK(options.isBoolean());
62 if (options.getAsBoolean()) { 62 if (options.getAsBoolean()) {
63 constraints = MediaConstraintsImpl::create(); 63 constraints = MediaConstraintsImpl::create();
64 } 64 }
65 } 65 }
66 66
67 return constraints; 67 return constraints;
68 } 68 }
69 69
70 UserMediaRequest* UserMediaRequest::create(ExecutionContext* context, UserMediaC ontroller* controller, const MediaStreamConstraints& options, NavigatorUserMedia SuccessCallback* successCallback, NavigatorUserMediaErrorCallback* errorCallback , MediaErrorState& errorState) 70 UserMediaRequest* UserMediaRequest::create(ExecutionContext* context, UserMediaC ontroller* controller, const MediaStreamConstraints& options, NavigatorUserMedia SuccessCallback* successCallback, NavigatorUserMediaErrorCallback* errorCallback , MediaErrorState& errorState)
71 { 71 {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 void UserMediaRequest::failPermissionDenied(const String& message) 181 void UserMediaRequest::failPermissionDenied(const String& message)
182 { 182 {
183 if (!getExecutionContext()) 183 if (!getExecutionContext())
184 return; 184 return;
185 m_errorCallback->handleEvent(NavigatorUserMediaError::create(NavigatorUserMe diaError::NamePermissionDenied, message, String())); 185 m_errorCallback->handleEvent(NavigatorUserMediaError::create(NavigatorUserMe diaError::NamePermissionDenied, message, String()));
186 } 186 }
187 187
188 void UserMediaRequest::failConstraint(const String& constraintName, const String & message) 188 void UserMediaRequest::failConstraint(const String& constraintName, const String & message)
189 { 189 {
190 ASSERT(!constraintName.isEmpty()); 190 DCHECK(!constraintName.isEmpty());
191 if (!getExecutionContext()) 191 if (!getExecutionContext())
192 return; 192 return;
193 m_errorCallback->handleEvent(NavigatorUserMediaError::create(NavigatorUserMe diaError::NameConstraintNotSatisfied, message, constraintName)); 193 m_errorCallback->handleEvent(NavigatorUserMediaError::create(NavigatorUserMe diaError::NameConstraintNotSatisfied, message, constraintName));
194 } 194 }
195 195
196 void UserMediaRequest::failUASpecific(const String& name, const String& message, const String& constraintName) 196 void UserMediaRequest::failUASpecific(const String& name, const String& message, const String& constraintName)
197 { 197 {
198 ASSERT(!name.isEmpty()); 198 DCHECK(!name.isEmpty());
199 if (!getExecutionContext()) 199 if (!getExecutionContext())
200 return; 200 return;
201 m_errorCallback->handleEvent(NavigatorUserMediaError::create(name, message, constraintName)); 201 m_errorCallback->handleEvent(NavigatorUserMediaError::create(name, message, constraintName));
202 } 202 }
203 203
204 void UserMediaRequest::contextDestroyed() 204 void UserMediaRequest::contextDestroyed()
205 { 205 {
206 if (m_controller) { 206 if (m_controller) {
207 m_controller->cancelUserMediaRequest(this); 207 m_controller->cancelUserMediaRequest(this);
208 m_controller = nullptr; 208 m_controller = nullptr;
209 } 209 }
210 210
211 ContextLifecycleObserver::contextDestroyed(); 211 ContextLifecycleObserver::contextDestroyed();
212 } 212 }
213 213
214 DEFINE_TRACE(UserMediaRequest) 214 DEFINE_TRACE(UserMediaRequest)
215 { 215 {
216 visitor->trace(m_controller); 216 visitor->trace(m_controller);
217 visitor->trace(m_successCallback); 217 visitor->trace(m_successCallback);
218 visitor->trace(m_errorCallback); 218 visitor->trace(m_errorCallback);
219 ContextLifecycleObserver::trace(visitor); 219 ContextLifecycleObserver::trace(visitor);
220 } 220 }
221 221
222 } // namespace blink 222 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/mediastream/URLMediaStream.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698