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

Unified Diff: content/public/common/common_param_traits.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add metrics and support for non-ASCII text messages to Java endpoints Created 3 years, 11 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
Index: content/public/common/common_param_traits.cc
diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc
index 3fcfdda02de585798129621632ded831b39508b0..ce87211082f68cd589f3547e5f7fc27953663957 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -7,8 +7,10 @@
#include <string>
#include "content/public/common/content_constants.h"
+#include "content/public/common/message_port.h"
#include "content/public/common/page_state.h"
#include "content/public/common/referrer.h"
+#include "ipc/ipc_mojo_param_traits.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
@@ -146,6 +148,31 @@ void ParamTraits<net::IPAddress>::Log(const param_type& p, std::string* l) {
LogParam("IPAddress:" + (p.empty() ? "(empty)" : p.ToString()), l);
}
+void ParamTraits<content::MessagePort>::GetSize(base::PickleSizer* s,
+ const param_type& p) {
jam 2017/01/23 18:08:56 nit: indentation here, 157, 173
+ ParamTraits<mojo::MessagePipeHandle>::GetSize(s, p.GetHandle().get());
+}
+
+void ParamTraits<content::MessagePort>::Write(base::Pickle* m,
+ const param_type& p) {
+ ParamTraits<mojo::MessagePipeHandle>::Write(m, p.ReleaseHandle().release());
+}
+
+bool ParamTraits<content::MessagePort>::Read(
+ const base::Pickle* m,
+ base::PickleIterator* iter,
+ param_type* r) {
+ mojo::MessagePipeHandle handle;
+ if (!ParamTraits<mojo::MessagePipeHandle>::Read(m, iter, &handle))
+ return false;
+ *r = content::MessagePort(mojo::ScopedMessagePipeHandle(handle));
+ return true;
+}
+
+void ParamTraits<content::MessagePort>::Log(
+ const param_type& p, std::string* l) {
+}
+
void ParamTraits<content::PageState>::GetSize(base::PickleSizer* s,
const param_type& p) {
GetParamSize(s, p.ToEncodedData());

Powered by Google App Engine
This is Rietveld 408576698