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

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

Issue 534133002: [WIP] bindings: Introduce PropertyBag (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 * 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return false; 73 return false;
74 74
75 HashMap<String, String>::const_iterator iter = mandatoryConstraintsHashM ap.begin(); 75 HashMap<String, String>::const_iterator iter = mandatoryConstraintsHashM ap.begin();
76 for (; iter != mandatoryConstraintsHashMap.end(); ++iter) 76 for (; iter != mandatoryConstraintsHashMap.end(); ++iter)
77 mandatoryConstraintsVector.append(WebMediaConstraint(iter->key, iter ->value)); 77 mandatoryConstraintsVector.append(WebMediaConstraint(iter->key, iter ->value));
78 } 78 }
79 79
80 Vector<WebMediaConstraint> optionalConstraintsVector; 80 Vector<WebMediaConstraint> optionalConstraintsVector;
81 if (names.contains(optionalName)) { 81 if (names.contains(optionalName)) {
82 ArrayValue optionalConstraints; 82 ArrayValue optionalConstraints;
83 bool ok = DictionaryHelper::get(constraintsDictionary, optionalName, opt ionalConstraints); 83 bool ok = constraintsDictionary.get(optionalName, optionalConstraints);
84 if (!ok || optionalConstraints.isUndefinedOrNull()) 84 if (!ok || optionalConstraints.isUndefinedOrNull())
85 return false; 85 return false;
86 86
87 size_t numberOfConstraints; 87 size_t numberOfConstraints;
88 ok = optionalConstraints.length(numberOfConstraints); 88 ok = optionalConstraints.length(numberOfConstraints);
89 if (!ok) 89 if (!ok)
90 return false; 90 return false;
91 91
92 for (size_t i = 0; i < numberOfConstraints; ++i) { 92 for (size_t i = 0; i < numberOfConstraints; ++i) {
93 Dictionary constraint; 93 Dictionary constraint;
94 ok = optionalConstraints.get(i, constraint); 94 ok = optionalConstraints.get(i, constraint);
95 if (!ok || constraint.isUndefinedOrNull()) 95 if (!ok || constraint.isUndefinedOrNull())
96 return false; 96 return false;
97 Vector<String> localNames; 97 Vector<String> localNames;
98 constraint.getOwnPropertyNames(localNames); 98 constraint.getOwnPropertyNames(localNames);
99 if (localNames.size() != 1) 99 if (localNames.size() != 1)
100 return false; 100 return false;
101 String key = localNames[0]; 101 String key = localNames[0];
102 String value; 102 String value;
103 ok = DictionaryHelper::get(constraint, key, value); 103 ok = constraint.get(key, value);
104 if (!ok) 104 if (!ok)
105 return false; 105 return false;
106 optionalConstraintsVector.append(WebMediaConstraint(key, value)); 106 optionalConstraintsVector.append(WebMediaConstraint(key, value));
107 } 107 }
108 } 108 }
109 109
110 optional.assign(optionalConstraintsVector); 110 optional.assign(optionalConstraintsVector);
111 mandatory.assign(mandatoryConstraintsVector); 111 mandatory.assign(mandatoryConstraintsVector);
112 return true; 112 return true;
113 } 113 }
(...skipping 15 matching lines...) Expand all
129 129
130 WebMediaConstraints create() 130 WebMediaConstraints create()
131 { 131 {
132 WebMediaConstraints constraints; 132 WebMediaConstraints constraints;
133 constraints.initialize(); 133 constraints.initialize();
134 return constraints; 134 return constraints;
135 } 135 }
136 136
137 } // namespace MediaConstraintsImpl 137 } // namespace MediaConstraintsImpl
138 } // namespace blink 138 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/indexeddb/IDBObjectStore.cpp ('k') | Source/modules/mediastream/RTCIceCandidate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698