| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/common/presentation_connection_message.h" | 5 #include "content/public/common/presentation_connection_message.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| 11 // TODO(crbug.com/524128): This restriction comes from Cast. Raise this limit | 11 // TODO(crbug.com/524128): This restriction comes from Cast. Raise this limit |
| 12 // for non-Cast presentations. | 12 // for non-Cast presentations. |
| 13 const size_t kMaxPresentationConnectionMessageSize = 64 * 1024; // 64 KB. | 13 const size_t kMaxPresentationConnectionMessageSize = 64 * 1024; // 64 KB. |
| 14 | 14 |
| 15 PresentationConnectionMessage::PresentationConnectionMessage() = default; | 15 PresentationConnectionMessage::PresentationConnectionMessage() = default; |
| 16 | 16 |
| 17 PresentationConnectionMessage::PresentationConnectionMessage( | 17 PresentationConnectionMessage::PresentationConnectionMessage( |
| 18 std::string message) | 18 std::string message) |
| 19 : message(std::move(message)) {} | 19 : message(std::move(message)) {} |
| 20 | 20 |
| 21 PresentationConnectionMessage::PresentationConnectionMessage( | 21 PresentationConnectionMessage::PresentationConnectionMessage( |
| 22 std::vector<uint8_t> data) | 22 std::vector<uint8_t> data) |
| 23 : data(std::move(data)) {} | 23 : data(std::move(data)) {} |
| 24 | 24 |
| 25 PresentationConnectionMessage::PresentationConnectionMessage( | 25 PresentationConnectionMessage::PresentationConnectionMessage( |
| 26 PresentationConnectionMessage&& other) = default; | 26 const PresentationConnectionMessage& other) = default; |
| 27 |
| 28 // Note: "move constructor noexcept = default" currently does not compile on |
| 29 // Windows and Android (crbug.com/706963). |
| 30 PresentationConnectionMessage::PresentationConnectionMessage( |
| 31 PresentationConnectionMessage&& other) noexcept |
| 32 : message(std::move(other.message)), data(std::move(other.data)) {} |
| 27 | 33 |
| 28 PresentationConnectionMessage::~PresentationConnectionMessage() {} | 34 PresentationConnectionMessage::~PresentationConnectionMessage() {} |
| 29 | 35 |
| 30 bool PresentationConnectionMessage::operator==( | 36 bool PresentationConnectionMessage::operator==( |
| 31 const PresentationConnectionMessage& other) const { | 37 const PresentationConnectionMessage& other) const { |
| 32 return this->data == other.data && this->message == other.message; | 38 return this->data == other.data && this->message == other.message; |
| 33 } | 39 } |
| 34 | 40 |
| 35 PresentationConnectionMessage& PresentationConnectionMessage::operator=( | 41 PresentationConnectionMessage& PresentationConnectionMessage::operator=( |
| 42 const PresentationConnectionMessage& other) = default; |
| 43 |
| 44 PresentationConnectionMessage& PresentationConnectionMessage::operator=( |
| 36 PresentationConnectionMessage&& other) = default; | 45 PresentationConnectionMessage&& other) = default; |
| 37 | 46 |
| 38 bool PresentationConnectionMessage::is_binary() const { | 47 bool PresentationConnectionMessage::is_binary() const { |
| 39 return data.has_value(); | 48 return data.has_value(); |
| 40 } | 49 } |
| 41 | 50 |
| 42 } // namespace content | 51 } // namespace content |
| OLD | NEW |