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

Unified Diff: chrome/common/media_router/discovery/media_sink_internal.cc

Issue 2965843002: [Media Router] Support dual discovery (Closed)
Patch Set: resovle code review comments from Derek and Mark Created 3 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 | « chrome/common/media_router/discovery/media_sink_internal.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/media_router/discovery/media_sink_internal.cc
diff --git a/chrome/common/media_router/discovery/media_sink_internal.cc b/chrome/common/media_router/discovery/media_sink_internal.cc
index 0cab52e6c67ec6b50f39863e5d4e9981b8d69510..9b1a380ba4c8bcd49b90e724fa1d4cd0cba085bb 100644
--- a/chrome/common/media_router/discovery/media_sink_internal.cc
+++ b/chrome/common/media_router/discovery/media_sink_internal.cc
@@ -27,6 +27,10 @@ MediaSinkInternal::MediaSinkInternal(const MediaSinkInternal& other) {
InternalCopyConstructFrom(other);
}
+MediaSinkInternal::MediaSinkInternal(MediaSinkInternal&& other) {
+ InternalMoveConstructFrom(std::move(other));
+}
+
MediaSinkInternal::~MediaSinkInternal() {
InternalCleanup();
}
@@ -45,6 +49,14 @@ MediaSinkInternal& MediaSinkInternal::operator=(
return *this;
}
+MediaSinkInternal& MediaSinkInternal::operator=(
+ MediaSinkInternal&& other) noexcept {
+ InternalCleanup();
+ InternalMoveConstructFrom(std::move(other));
+
+ return *this;
+}
+
bool MediaSinkInternal::operator==(const MediaSinkInternal& other) const {
if (sink_type_ != other.sink_type_)
return false;
@@ -147,6 +159,23 @@ void MediaSinkInternal::InternalCopyConstructFrom(
NOTREACHED();
}
+void MediaSinkInternal::InternalMoveConstructFrom(MediaSinkInternal&& other) {
+ sink_ = std::move(other.sink_);
+ sink_type_ = other.sink_type_;
+
+ switch (sink_type_) {
+ case SinkType::DIAL:
+ dial_data_.InitFromMove(std::move(other.dial_data_));
+ return;
+ case SinkType::CAST:
+ cast_data_.InitFromMove(std::move(other.cast_data_));
+ return;
+ case SinkType::GENERIC:
+ return;
+ }
+ NOTREACHED();
+}
+
void MediaSinkInternal::InternalCleanup() {
switch (sink_type_) {
case SinkType::DIAL:
@@ -175,9 +204,10 @@ CastSinkExtraData::CastSinkExtraData(const CastSinkExtraData& other) = default;
CastSinkExtraData::~CastSinkExtraData() = default;
bool CastSinkExtraData::operator==(const CastSinkExtraData& other) const {
- return ip_address == other.ip_address && model_name == other.model_name &&
- capabilities == other.capabilities &&
- cast_channel_id == other.cast_channel_id;
+ return ip_address == other.ip_address && port == other.port &&
+ model_name == other.model_name && capabilities == other.capabilities &&
+ cast_channel_id == other.cast_channel_id &&
+ discovered_by_dial == other.discovered_by_dial;
}
} // namespace media_router
« no previous file with comments | « chrome/common/media_router/discovery/media_sink_internal.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698