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

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

Issue 1817943003: Constraints: Make advanced list be a list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
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 | « no previous file | 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 static WebMediaConstraints createFromNamedConstraints(ExecutionContext* context, WebVector<WebMediaConstraint>& mandatory, const WebVector<WebMediaConstraint>& optional, MediaErrorState& errorState) 386 static WebMediaConstraints createFromNamedConstraints(ExecutionContext* context, WebVector<WebMediaConstraint>& mandatory, const WebVector<WebMediaConstraint>& optional, MediaErrorState& errorState)
387 { 387 {
388 WebMediaTrackConstraintSet basic; 388 WebMediaTrackConstraintSet basic;
389 WebMediaTrackConstraintSet advanced; 389 WebMediaTrackConstraintSet advanced;
390 WebMediaConstraints constraints; 390 WebMediaConstraints constraints;
391 parseOldStyleNames(context, mandatory, true, basic, errorState); 391 parseOldStyleNames(context, mandatory, true, basic, errorState);
392 if (errorState.hadException()) 392 if (errorState.hadException())
393 return constraints; 393 return constraints;
394 // We ignore unknow names and syntax errors in optional constraints. 394 // We ignore unknow names and syntax errors in optional constraints.
395 MediaErrorState ignoredErrorState; 395 MediaErrorState ignoredErrorState;
396 parseOldStyleNames(context, optional, false, advanced, ignoredErrorState); 396 Vector<WebMediaTrackConstraintSet> advancedVector;
397 WebVector<WebMediaTrackConstraintSet> advancedVector(&advanced, 1); 397 for (const auto& optionalConstraint : optional) {
398 // Use the 4-argument initializer until Chrome has been converted. 398 WebMediaTrackConstraintSet advancedElement;
399 WebVector<WebMediaConstraint> elementAsList(&optionalConstraint, 1);
400 parseOldStyleNames(context, elementAsList, false, advancedElement, ignor edErrorState);
401 if (!advancedElement.isEmpty())
402 advancedVector.append(advancedElement);
403 }
399 constraints.initialize(optional, mandatory, basic, advancedVector); 404 constraints.initialize(optional, mandatory, basic, advancedVector);
400 return constraints; 405 return constraints;
401 } 406 }
402 407
403 // Deprecated. 408 // Deprecated.
404 WebMediaConstraints create(ExecutionContext* context, const Dictionary& constrai ntsDictionary, MediaErrorState& errorState) 409 WebMediaConstraints create(ExecutionContext* context, const Dictionary& constrai ntsDictionary, MediaErrorState& errorState)
405 { 410 {
406 WebVector<WebMediaConstraint> optional; 411 WebVector<WebMediaConstraint> optional;
407 WebVector<WebMediaConstraint> mandatory; 412 WebVector<WebMediaConstraint> mandatory;
408 if (!parse(constraintsDictionary, optional, mandatory)) { 413 if (!parse(constraintsDictionary, optional, mandatory)) {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 542
538 WebMediaConstraints create() 543 WebMediaConstraints create()
539 { 544 {
540 WebMediaConstraints constraints; 545 WebMediaConstraints constraints;
541 constraints.initialize(); 546 constraints.initialize();
542 return constraints; 547 return constraints;
543 } 548 }
544 549
545 } // namespace MediaConstraintsImpl 550 } // namespace MediaConstraintsImpl
546 } // namespace blink 551 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698