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

Unified Diff: third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp

Issue 2519403002: binding: Lets Dictionary::getPropertyNames, etc. rethrow an exception. (Closed)
Patch Set: Addressed review comments. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
index b0be707fb374aacb0d98ea5f5baa8524130fba7a..2820caf9b10ba096f4b0f2c724062d7ef025e07d 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
@@ -151,10 +151,11 @@ const char kTestConstraint2[] = "valid_and_supported_2";
static bool parseMandatoryConstraintsDictionary(
const Dictionary& mandatoryConstraintsDictionary,
Vector<NameValueStringConstraint>& mandatory) {
- HashMap<String, String> mandatoryConstraintsHashMap;
- bool ok = mandatoryConstraintsDictionary.getOwnPropertiesAsStringHashMap(
- mandatoryConstraintsHashMap);
- if (!ok)
+ TrackExceptionState exceptionState;
+ const HashMap<String, String>& mandatoryConstraintsHashMap =
+ mandatoryConstraintsDictionary.getOwnPropertiesAsStringHashMap(
+ exceptionState);
+ if (exceptionState.hadException())
return false;
for (const auto& iter : mandatoryConstraintsHashMap)
@@ -165,15 +166,16 @@ static bool parseMandatoryConstraintsDictionary(
static bool parseOptionalConstraintsVectorElement(
const Dictionary& constraint,
Vector<NameValueStringConstraint>& optionalConstraintsVector) {
- Vector<String> localNames;
- bool ok = constraint.getPropertyNames(localNames);
- if (!ok)
+ TrackExceptionState exceptionState;
+ const Vector<String>& localNames =
+ constraint.getPropertyNames(exceptionState);
+ if (exceptionState.hadException())
return false;
if (localNames.size() != 1)
return false;
const String& key = localNames[0];
String value;
- ok = DictionaryHelper::get(constraint, key, value);
+ bool ok = DictionaryHelper::get(constraint, key, value);
if (!ok)
return false;
optionalConstraintsVector.append(NameValueStringConstraint(key, value));
@@ -187,16 +189,17 @@ static bool parse(const Dictionary& constraintsDictionary,
if (constraintsDictionary.isUndefinedOrNull())
return true;
- Vector<String> names;
- bool ok = constraintsDictionary.getPropertyNames(names);
- if (!ok)
+ TrackExceptionState exceptionState;
+ const Vector<String>& names =
+ constraintsDictionary.getPropertyNames(exceptionState);
+ if (exceptionState.hadException())
return false;
String mandatoryName("mandatory");
String optionalName("optional");
- for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) {
- if (*it != mandatoryName && *it != optionalName)
+ for (const auto& name : names) {
+ if (name != mandatoryName && name != optionalName)
return false;
}
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Headers.cpp ('k') | third_party/WebKit/Source/modules/payments/PaymentRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698