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

Unified Diff: content/common/content_param_traits.cc

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Eliminate unnecessary PostTask Created 3 years, 10 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/common/content_param_traits.cc
diff --git a/content/common/content_param_traits.cc b/content/common/content_param_traits.cc
index d38e9310fed42b5a1c7c59e42c2048b16ce480ba..2960f78727f01daa5f6b4bc895018e08b40fc121 100644
--- a/content/common/content_param_traits.cc
+++ b/content/common/content_param_traits.cc
@@ -7,6 +7,8 @@
#include <stddef.h>
#include "base/strings/string_number_conversions.h"
+#include "content/common/message_port.h"
+#include "ipc/ipc_mojo_param_traits.h"
#include "net/base/ip_endpoint.h"
#include "ui/events/blink/web_input_event_traits.h"
@@ -62,6 +64,31 @@ void ParamTraits<WebInputEventPointer>::Log(const param_type& p,
l->append(")");
}
+void ParamTraits<content::MessagePort>::GetSize(base::PickleSizer* s,
+ const param_type& p) {
+ 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) {
+}
+
} // namespace IPC
// Generate param traits size methods.

Powered by Google App Engine
This is Rietveld 408576698