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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/content_param_traits.h" 5 #include "content/common/content_param_traits.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "content/common/message_port.h"
11 #include "ipc/ipc_mojo_param_traits.h"
10 #include "net/base/ip_endpoint.h" 12 #include "net/base/ip_endpoint.h"
11 #include "ui/events/blink/web_input_event_traits.h" 13 #include "ui/events/blink/web_input_event_traits.h"
12 14
13 namespace IPC { 15 namespace IPC {
14 16
15 void ParamTraits<WebInputEventPointer>::GetSize(base::PickleSizer* s, 17 void ParamTraits<WebInputEventPointer>::GetSize(base::PickleSizer* s,
16 const param_type& p) { 18 const param_type& p) {
17 s->AddData(p->size()); 19 s->AddData(p->size());
18 } 20 }
19 21
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 std::string* l) { 57 std::string* l) {
56 l->append("("); 58 l->append("(");
57 LogParam(p->size(), l); 59 LogParam(p->size(), l);
58 l->append(", "); 60 l->append(", ");
59 LogParam(p->type(), l); 61 LogParam(p->type(), l);
60 l->append(", "); 62 l->append(", ");
61 LogParam(p->timeStampSeconds(), l); 63 LogParam(p->timeStampSeconds(), l);
62 l->append(")"); 64 l->append(")");
63 } 65 }
64 66
67 void ParamTraits<content::MessagePort>::GetSize(base::PickleSizer* s,
68 const param_type& p) {
69 ParamTraits<mojo::MessagePipeHandle>::GetSize(s, p.GetHandle().get());
70 }
71
72 void ParamTraits<content::MessagePort>::Write(base::Pickle* m,
73 const param_type& p) {
74 ParamTraits<mojo::MessagePipeHandle>::Write(m, p.ReleaseHandle().release());
75 }
76
77 bool ParamTraits<content::MessagePort>::Read(
78 const base::Pickle* m,
79 base::PickleIterator* iter,
80 param_type* r) {
81 mojo::MessagePipeHandle handle;
82 if (!ParamTraits<mojo::MessagePipeHandle>::Read(m, iter, &handle))
83 return false;
84 *r = content::MessagePort(mojo::ScopedMessagePipeHandle(handle));
85 return true;
86 }
87
88 void ParamTraits<content::MessagePort>::Log(const param_type& p,
89 std::string* l) {
90 }
91
65 } // namespace IPC 92 } // namespace IPC
66 93
67 // Generate param traits size methods. 94 // Generate param traits size methods.
68 #include "ipc/param_traits_size_macros.h" 95 #include "ipc/param_traits_size_macros.h"
69 namespace IPC { 96 namespace IPC {
70 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 97 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
71 #include "content/common/content_param_traits_macros.h" 98 #include "content/common/content_param_traits_macros.h"
72 } 99 }
73 100
74 // Generate param traits write methods. 101 // Generate param traits write methods.
75 #include "ipc/param_traits_write_macros.h" 102 #include "ipc/param_traits_write_macros.h"
76 namespace IPC { 103 namespace IPC {
77 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 104 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
78 #include "content/common/content_param_traits_macros.h" 105 #include "content/common/content_param_traits_macros.h"
79 } // namespace IPC 106 } // namespace IPC
80 107
81 // Generate param traits read methods. 108 // Generate param traits read methods.
82 #include "ipc/param_traits_read_macros.h" 109 #include "ipc/param_traits_read_macros.h"
83 namespace IPC { 110 namespace IPC {
84 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 111 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
85 #include "content/common/content_param_traits_macros.h" 112 #include "content/common/content_param_traits_macros.h"
86 } // namespace IPC 113 } // namespace IPC
87 114
88 // Generate param traits log methods. 115 // Generate param traits log methods.
89 #include "ipc/param_traits_log_macros.h" 116 #include "ipc/param_traits_log_macros.h"
90 namespace IPC { 117 namespace IPC {
91 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_ 118 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
92 #include "content/common/content_param_traits_macros.h" 119 #include "content/common/content_param_traits_macros.h"
93 } // namespace IPC 120 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698