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 // This file contains ParamTraits templates to support serialization of WebKit | 5 // This file contains ParamTraits templates to support serialization of WebKit |
6 // data types over IPC. | 6 // data types over IPC. |
7 // | 7 // |
8 // NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. | 8 // NOTE: IT IS IMPORTANT THAT ONLY POD (plain old data) TYPES ARE SERIALIZED. |
9 // | 9 // |
10 // There are several reasons for this restrictions: | 10 // There are several reasons for this restrictions: |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 #ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 23 #ifndef CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |
24 #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 24 #define CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |
25 #pragma once | 25 #pragma once |
26 | 26 |
27 #include "ipc/ipc_message_utils.h" | 27 #include "ipc/ipc_message_utils.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileError.h" |
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextInputType.h" |
35 | 34 |
36 namespace WebKit { | 35 namespace WebKit { |
37 struct WebRect; | 36 struct WebRect; |
38 struct WebScreenInfo; | |
39 } | 37 } |
40 | 38 |
41 namespace IPC { | 39 namespace IPC { |
42 | 40 |
43 template <> | 41 template <> |
44 struct ParamTraits<WebKit::WebRect> { | |
45 typedef WebKit::WebRect param_type; | |
46 static void Write(Message* m, const param_type& p); | |
47 static bool Read(const Message* m, void** iter, param_type* p); | |
48 static void Log(const param_type& p, std::string* l); | |
49 }; | |
50 | |
51 template <> | |
52 struct ParamTraits<WebKit::WebScreenInfo> { | |
53 typedef WebKit::WebScreenInfo param_type; | |
54 static void Write(Message* m, const param_type& p); | |
55 static bool Read(const Message* m, void** iter, param_type* p); | |
56 static void Log(const param_type& p, std::string* l); | |
57 }; | |
58 | |
59 template <> | |
60 struct SimilarTypeTraits<WebKit::WebConsoleMessage::Level> { | 42 struct SimilarTypeTraits<WebKit::WebConsoleMessage::Level> { |
61 typedef int Type; | 43 typedef int Type; |
62 }; | 44 }; |
63 | 45 |
64 template <> | 46 template <> |
65 struct SimilarTypeTraits<WebKit::WebPopupType> { | |
66 typedef int Type; | |
67 }; | |
68 | |
69 template <> | |
70 struct ParamTraits<WebKit::WebCache::UsageStats> { | 47 struct ParamTraits<WebKit::WebCache::UsageStats> { |
71 typedef WebKit::WebCache::UsageStats param_type; | 48 typedef WebKit::WebCache::UsageStats param_type; |
72 static void Write(Message* m, const param_type& p) { | 49 static void Write(Message* m, const param_type& p) { |
73 WriteParam(m, p.minDeadCapacity); | 50 WriteParam(m, p.minDeadCapacity); |
74 WriteParam(m, p.maxDeadCapacity); | 51 WriteParam(m, p.maxDeadCapacity); |
75 WriteParam(m, p.capacity); | 52 WriteParam(m, p.capacity); |
76 WriteParam(m, p.liveSize); | 53 WriteParam(m, p.liveSize); |
77 WriteParam(m, p.deadSize); | 54 WriteParam(m, p.deadSize); |
78 } | 55 } |
79 static bool Read(const Message* m, void** iter, param_type* r) { | 56 static bool Read(const Message* m, void** iter, param_type* r) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 struct ParamTraits<WebKit::WebTextCheckingResult> { | 159 struct ParamTraits<WebKit::WebTextCheckingResult> { |
183 typedef WebKit::WebTextCheckingResult param_type; | 160 typedef WebKit::WebTextCheckingResult param_type; |
184 static void Write(Message* m, const param_type& p); | 161 static void Write(Message* m, const param_type& p); |
185 static bool Read(const Message* m, void** iter, param_type* r); | 162 static bool Read(const Message* m, void** iter, param_type* r); |
186 static void Log(const param_type& p, std::string* l); | 163 static void Log(const param_type& p, std::string* l); |
187 }; | 164 }; |
188 | 165 |
189 } // namespace IPC | 166 } // namespace IPC |
190 | 167 |
191 #endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ | 168 #endif // CHROME_COMMON_WEBKIT_PARAM_TRAITS_H_ |
OLD | NEW |