OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppapi_param_traits.h" | 5 #include "ppapi/proxy/ppapi_param_traits.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include "ppapi/c/dev/pp_file_info_dev.h" | 9 #include "ppapi/c/pp_file_info.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/proxy/host_resource.h" | 11 #include "ppapi/proxy/host_resource.h" |
12 #include "ppapi/proxy/interface_proxy.h" | 12 #include "ppapi/proxy/interface_proxy.h" |
13 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
14 #include "ppapi/proxy/serialized_var.h" | 14 #include "ppapi/proxy/serialized_var.h" |
15 #include "ppapi/proxy/serialized_flash_menu.h" | 15 #include "ppapi/proxy/serialized_flash_menu.h" |
16 | 16 |
17 namespace IPC { | 17 namespace IPC { |
18 | 18 |
19 namespace { | 19 namespace { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 if (!ParamTraits<bool>::Read(m, iter, &result)) | 89 if (!ParamTraits<bool>::Read(m, iter, &result)) |
90 return false; | 90 return false; |
91 *r = pp::proxy::BoolToPPBool(result); | 91 *r = pp::proxy::BoolToPPBool(result); |
92 return true; | 92 return true; |
93 } | 93 } |
94 | 94 |
95 // static | 95 // static |
96 void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { | 96 void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { |
97 } | 97 } |
98 | 98 |
99 // PP_FileInfo_Dev ------------------------------------------------------------- | 99 // PP_FileInfo ------------------------------------------------------------- |
100 | 100 |
101 // static | 101 // static |
102 void ParamTraits<PP_FileInfo_Dev>::Write(Message* m, const param_type& p) { | 102 void ParamTraits<PP_FileInfo>::Write(Message* m, const param_type& p) { |
103 ParamTraits<int64_t>::Write(m, p.size); | 103 ParamTraits<int64_t>::Write(m, p.size); |
104 ParamTraits<int>::Write(m, static_cast<int>(p.type)); | 104 ParamTraits<int>::Write(m, static_cast<int>(p.type)); |
105 ParamTraits<int>::Write(m, static_cast<int>(p.system_type)); | 105 ParamTraits<int>::Write(m, static_cast<int>(p.system_type)); |
106 ParamTraits<double>::Write(m, p.creation_time); | 106 ParamTraits<double>::Write(m, p.creation_time); |
107 ParamTraits<double>::Write(m, p.last_access_time); | 107 ParamTraits<double>::Write(m, p.last_access_time); |
108 ParamTraits<double>::Write(m, p.last_modified_time); | 108 ParamTraits<double>::Write(m, p.last_modified_time); |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 bool ParamTraits<PP_FileInfo_Dev>::Read(const Message* m, void** iter, | 112 bool ParamTraits<PP_FileInfo>::Read(const Message* m, void** iter, |
113 param_type* r) { | 113 param_type* r) { |
114 int type, system_type; | 114 int type, system_type; |
115 if (!ParamTraits<int64_t>::Read(m, iter, &r->size) || | 115 if (!ParamTraits<int64_t>::Read(m, iter, &r->size) || |
116 !ParamTraits<int>::Read(m, iter, &type) || | 116 !ParamTraits<int>::Read(m, iter, &type) || |
117 !ParamTraits<int>::Read(m, iter, &system_type) || | 117 !ParamTraits<int>::Read(m, iter, &system_type) || |
118 !ParamTraits<double>::Read(m, iter, &r->creation_time) || | 118 !ParamTraits<double>::Read(m, iter, &r->creation_time) || |
119 !ParamTraits<double>::Read(m, iter, &r->last_access_time) || | 119 !ParamTraits<double>::Read(m, iter, &r->last_access_time) || |
120 !ParamTraits<double>::Read(m, iter, &r->last_modified_time)) | 120 !ParamTraits<double>::Read(m, iter, &r->last_modified_time)) |
121 return false; | 121 return false; |
122 if (type != PP_FILETYPE_REGULAR && | 122 if (type != PP_FILETYPE_REGULAR && |
123 type != PP_FILETYPE_DIRECTORY && | 123 type != PP_FILETYPE_DIRECTORY && |
124 type != PP_FILETYPE_OTHER) | 124 type != PP_FILETYPE_OTHER) |
125 return false; | 125 return false; |
126 r->type = static_cast<PP_FileType_Dev>(type); | 126 r->type = static_cast<PP_FileType>(type); |
127 if (system_type != PP_FILESYSTEMTYPE_EXTERNAL && | 127 if (system_type != PP_FILESYSTEMTYPE_EXTERNAL && |
128 system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && | 128 system_type != PP_FILESYSTEMTYPE_LOCALPERSISTENT && |
129 system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) | 129 system_type != PP_FILESYSTEMTYPE_LOCALTEMPORARY) |
130 return false; | 130 return false; |
131 r->system_type = static_cast<PP_FileSystemType_Dev>(system_type); | 131 r->system_type = static_cast<PP_FileSystemType>(system_type); |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 // static | 135 // static |
136 void ParamTraits<PP_FileInfo_Dev>::Log(const param_type& p, std::string* l) { | 136 void ParamTraits<PP_FileInfo>::Log(const param_type& p, std::string* l) { |
137 } | 137 } |
138 | 138 |
139 // PP_InputEvent --------------------------------------------------------------- | 139 // PP_InputEvent --------------------------------------------------------------- |
140 | 140 |
141 // static | 141 // static |
142 void ParamTraits<PP_InputEvent>::Write(Message* m, const param_type& p) { | 142 void ParamTraits<PP_InputEvent>::Write(Message* m, const param_type& p) { |
143 // PP_InputEvent is just POD so we can just memcpy it. | 143 // PP_InputEvent is just POD so we can just memcpy it. |
144 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(PP_InputEvent)); | 144 m->WriteData(reinterpret_cast<const char*>(&p), sizeof(PP_InputEvent)); |
145 } | 145 } |
146 | 146 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 param_type* r) { | 466 param_type* r) { |
467 return r->ReadFromMessage(m, iter); | 467 return r->ReadFromMessage(m, iter); |
468 } | 468 } |
469 | 469 |
470 // static | 470 // static |
471 void ParamTraits<pp::proxy::SerializedFlashMenu>::Log(const param_type& p, | 471 void ParamTraits<pp::proxy::SerializedFlashMenu>::Log(const param_type& p, |
472 std::string* l) { | 472 std::string* l) { |
473 } | 473 } |
474 | 474 |
475 } // namespace IPC | 475 } // namespace IPC |
OLD | NEW |