OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/webkit_param_traits.h" | 5 #include "chrome/common/webkit_param_traits.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | |
9 | 8 |
10 namespace IPC { | 9 namespace IPC { |
11 | 10 |
12 void ParamTraits<WebKit::WebRect>::Write(Message* m, const param_type& p) { | |
13 WriteParam(m, p.x); | |
14 WriteParam(m, p.y); | |
15 WriteParam(m, p.width); | |
16 WriteParam(m, p.height); | |
17 } | |
18 | |
19 bool ParamTraits<WebKit::WebRect>::Read(const Message* m, void** iter, | |
20 param_type* p) { | |
21 return | |
22 ReadParam(m, iter, &p->x) && | |
23 ReadParam(m, iter, &p->y) && | |
24 ReadParam(m, iter, &p->width) && | |
25 ReadParam(m, iter, &p->height); | |
26 } | |
27 | |
28 void ParamTraits<WebKit::WebRect>::Log(const param_type& p, std::string* l) { | |
29 l->append("("); | |
30 LogParam(p.x, l); | |
31 l->append(", "); | |
32 LogParam(p.y, l); | |
33 l->append(", "); | |
34 LogParam(p.width, l); | |
35 l->append(", "); | |
36 LogParam(p.height, l); | |
37 l->append(")"); | |
38 } | |
39 | |
40 void ParamTraits<WebKit::WebScreenInfo>::Write(Message* m, | |
41 const param_type& p) { | |
42 WriteParam(m, p.depth); | |
43 WriteParam(m, p.depthPerComponent); | |
44 WriteParam(m, p.isMonochrome); | |
45 WriteParam(m, p.rect); | |
46 WriteParam(m, p.availableRect); | |
47 } | |
48 | |
49 bool ParamTraits<WebKit::WebScreenInfo>::Read(const Message* m, void** iter, | |
50 param_type* p) { | |
51 return | |
52 ReadParam(m, iter, &p->depth) && | |
53 ReadParam(m, iter, &p->depthPerComponent) && | |
54 ReadParam(m, iter, &p->isMonochrome) && | |
55 ReadParam(m, iter, &p->rect) && | |
56 ReadParam(m, iter, &p->availableRect); | |
57 } | |
58 | |
59 void ParamTraits<WebKit::WebScreenInfo>::Log(const param_type& p, | |
60 std::string* l) { | |
61 l->append("("); | |
62 LogParam(p.depth, l); | |
63 l->append(", "); | |
64 LogParam(p.depthPerComponent, l); | |
65 l->append(", "); | |
66 LogParam(p.isMonochrome, l); | |
67 l->append(", "); | |
68 LogParam(p.rect, l); | |
69 l->append(", "); | |
70 LogParam(p.availableRect, l); | |
71 l->append(")"); | |
72 } | |
73 | |
74 void ParamTraits<WebKit::WebCache::ResourceTypeStat>::Log( | 11 void ParamTraits<WebKit::WebCache::ResourceTypeStat>::Log( |
75 const param_type& p, std::string* l) { | 12 const param_type& p, std::string* l) { |
76 l->append(base::StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS " %" PRIuS, | 13 l->append(base::StringPrintf("%" PRIuS " %" PRIuS " %" PRIuS " %" PRIuS, |
77 p.count, p.size, p.liveSize, p.decodedSize)); | 14 p.count, p.size, p.liveSize, p.decodedSize)); |
78 } | 15 } |
79 | 16 |
80 void ParamTraits<WebKit::WebTextCheckingResult>::Write(Message* m, | 17 void ParamTraits<WebKit::WebTextCheckingResult>::Write(Message* m, |
81 const param_type& p) { | 18 const param_type& p) { |
82 #if defined(WEB_TEXT_CHECKING_RESULT_IS_A_STRUCT) | 19 #if defined(WEB_TEXT_CHECKING_RESULT_IS_A_STRUCT) |
83 WriteParam(m, static_cast<int>(p.error)); | 20 WriteParam(m, static_cast<int>(p.error)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 LogParam(static_cast<int>(p.error()), l); | 63 LogParam(static_cast<int>(p.error()), l); |
127 l->append(", "); | 64 l->append(", "); |
128 LogParam(p.position(), l); | 65 LogParam(p.position(), l); |
129 l->append(", "); | 66 l->append(", "); |
130 LogParam(p.length(), l); | 67 LogParam(p.length(), l); |
131 #endif | 68 #endif |
132 l->append(")"); | 69 l->append(")"); |
133 } | 70 } |
134 | 71 |
135 } // namespace IPC | 72 } // namespace IPC |
OLD | NEW |