Index: mojo/edk/embedder/connection_param.cc |
diff --git a/mojo/edk/embedder/connection_param.cc b/mojo/edk/embedder/connection_param.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7ab3953f0fe05b15cbc5eef7744bc210df741d17 |
--- /dev/null |
+++ b/mojo/edk/embedder/connection_param.cc |
@@ -0,0 +1,62 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "mojo/edk/embedder/connection_param.h" |
+ |
+#include <utility> |
+ |
+namespace mojo { |
+namespace edk { |
+ |
+ConnectionParam::ConnectionParam(ScopedPlatformHandle channel) |
+ : channel_(std::move(channel)) {} |
+ |
+#if defined(OS_ANDROID) |
+ConnectionParam::ConnectionParam( |
+ ScopedPlatformHandle channel, |
+ base::android::ParcelableChannelClient parcelable_channel_client, |
+ base::android::ParcelableChannelServer parcelable_channel_server) |
+ : channel_(std::move(channel)), |
+ parcelable_channel_client_(std::move(parcelable_channel_client)), |
+ parcelable_channel_server_(std::move(parcelable_channel_server)) {} |
+#endif |
+ |
+ConnectionParam::ConnectionParam(ConnectionParam&& param) |
+ : channel_(std::move(param.channel_)) |
+#if defined(OS_ANDROID) |
+ , |
+ parcelable_channel_client_(std::move(param.parcelable_channel_client_)), |
+ parcelable_channel_server_(std::move(param.parcelable_channel_server_)) |
+#endif |
+{ |
+} |
+ |
+ConnectionParam& ConnectionParam::operator=(ConnectionParam&& param) { |
+ channel_ = std::move(param.channel_); |
+#if defined(OS_ANDROID) |
+ parcelable_channel_client_ = std::move(param.parcelable_channel_client_); |
+ parcelable_channel_server_ = std::move(param.parcelable_channel_server_); |
+#endif |
+ return *this; |
+} |
+ |
+ScopedPlatformHandle ConnectionParam::TakeChannelHandle() { |
+ return std::move(channel_); |
+} |
+ |
+#if defined(OS_ANDROID) |
+base::android::ParcelableChannelClient |
+ConnectionParam::TakeParcelableChannelClient() { |
+ return std::move(parcelable_channel_client_); |
+} |
+ |
+base::android::ParcelableChannelServer |
+ConnectionParam::TakeParcelableChannelServer() { |
+ return std::move(parcelable_channel_server_); |
+} |
+ |
+#endif |
+ |
+} // namespace edk |
+} // namespace mojo |