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

Unified Diff: remoting/protocol/content_description.cc

Issue 10831022: Skip unknown channel configurations when parsing session config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/content_description.h ('k') | remoting/protocol/content_description_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/content_description.cc
diff --git a/remoting/protocol/content_description.cc b/remoting/protocol/content_description.cc
index 0cd7ce441d56bf781ebc87a72f63f090341e3da9..70ba05b570ae48b4747ec83b0f998368fff7562a 100644
--- a/remoting/protocol/content_description.cc
+++ b/remoting/protocol/content_description.cc
@@ -235,9 +235,9 @@ bool ContentDescription::ParseChannelConfigs(
const XmlElement* child = element->FirstNamed(tag);
while (child) {
ChannelConfig channel_config;
- if (!ParseChannelConfig(child, codec_required, &channel_config))
- return false;
- configs->push_back(channel_config);
+ if (ParseChannelConfig(child, codec_required, &channel_config)) {
+ configs->push_back(channel_config);
+ }
child = child->NextNamed(tag);
}
if (optional && configs->empty()) {
@@ -251,39 +251,32 @@ bool ContentDescription::ParseChannelConfigs(
}
// static
-ContentDescription* ContentDescription::ParseXml(
+scoped_ptr<ContentDescription> ContentDescription::ParseXml(
const XmlElement* element) {
- if (element->Name() == QName(kChromotingXmlNamespace, kDescriptionTag)) {
- scoped_ptr<CandidateSessionConfig> config(
- CandidateSessionConfig::CreateEmpty());
- const XmlElement* child = NULL;
-
- if (!ParseChannelConfigs(element, kControlTag, false, false,
- config->mutable_control_configs())) {
- return NULL;
- }
- if (!ParseChannelConfigs(element, kEventTag, false, false,
- config->mutable_event_configs())) {
- return NULL;
- }
- if (!ParseChannelConfigs(element, kVideoTag, true, false,
- config->mutable_video_configs())) {
- return NULL;
- }
- if (!ParseChannelConfigs(element, kAudioTag, true, true,
- config->mutable_audio_configs())) {
- return NULL;
- }
+ if (element->Name() != QName(kChromotingXmlNamespace, kDescriptionTag)) {
+ LOG(ERROR) << "Invalid description: " << element->Str();
+ return scoped_ptr<ContentDescription>();
+ }
+ scoped_ptr<CandidateSessionConfig> config(
+ CandidateSessionConfig::CreateEmpty());
+ if (!ParseChannelConfigs(element, kControlTag, false, false,
+ config->mutable_control_configs()) ||
+ !ParseChannelConfigs(element, kEventTag, false, false,
+ config->mutable_event_configs()) ||
+ !ParseChannelConfigs(element, kVideoTag, true, false,
+ config->mutable_video_configs()) ||
+ !ParseChannelConfigs(element, kAudioTag, true, true,
+ config->mutable_audio_configs())) {
+ return scoped_ptr<ContentDescription>();
+ }
- scoped_ptr<XmlElement> authenticator_message;
- child = Authenticator::FindAuthenticatorMessage(element);
- if (child)
- authenticator_message.reset(new XmlElement(*child));
+ scoped_ptr<XmlElement> authenticator_message;
+ const XmlElement* child = Authenticator::FindAuthenticatorMessage(element);
+ if (child)
+ authenticator_message.reset(new XmlElement(*child));
- return new ContentDescription(config.Pass(), authenticator_message.Pass());
- }
- LOG(ERROR) << "Invalid description: " << element->Str();
- return NULL;
+ return scoped_ptr<ContentDescription>(
+ new ContentDescription(config.Pass(), authenticator_message.Pass()));
}
} // namespace protocol
« no previous file with comments | « remoting/protocol/content_description.h ('k') | remoting/protocol/content_description_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698