OLD | NEW |
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 #ifndef PPAPI_PROXY_SERIALIZED_STRUCTS_H_ | 5 #ifndef PPAPI_PROXY_SERIALIZED_STRUCTS_H_ |
6 #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_ | 6 #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "ipc/ipc_platform_file.h" | 14 #include "ipc/ipc_platform_file.h" |
15 #include "ppapi/c/pp_bool.h" | 15 #include "ppapi/c/pp_bool.h" |
16 #include "ppapi/c/pp_instance.h" | 16 #include "ppapi/c/pp_instance.h" |
17 #include "ppapi/c/pp_point.h" | 17 #include "ppapi/c/pp_point.h" |
18 #include "ppapi/c/pp_rect.h" | 18 #include "ppapi/c/pp_rect.h" |
19 #include "ppapi/proxy/serialized_var.h" | 19 #include "ppapi/proxy/ppapi_proxy_export.h" |
20 #include "ppapi/shared_impl/host_resource.h" | 20 #include "ppapi/shared_impl/host_resource.h" |
21 | 21 |
22 class Pickle; | 22 class Pickle; |
23 struct PP_FontDescription_Dev; | 23 struct PP_FontDescription_Dev; |
24 | 24 |
25 namespace ppapi { | 25 namespace ppapi { |
26 namespace proxy { | 26 namespace proxy { |
27 | 27 |
28 class Dispatcher; | 28 // PP_FontDescript_Dev has to be redefined with a string in place of the PP_Var |
29 | 29 // used for the face name. |
30 // PP_FontDescript_Dev has to be redefined with a SerializedVar in place of | |
31 // the PP_Var used for the face name. | |
32 struct PPAPI_PROXY_EXPORT SerializedFontDescription { | 30 struct PPAPI_PROXY_EXPORT SerializedFontDescription { |
33 SerializedFontDescription(); | 31 SerializedFontDescription(); |
34 ~SerializedFontDescription(); | 32 ~SerializedFontDescription(); |
35 | 33 |
36 // Converts a PP_FontDescription_Dev to a SerializedFontDescription. | 34 // Converts a PP_FontDescription_Dev to a SerializedFontDescription. |
37 // | 35 // |
38 // If source_owns_ref is true, the reference owned by the | 36 // The reference of |face| owned by the PP_FontDescription_Dev will be |
39 // PP_FontDescription_Dev will be unchanged and the caller is responsible for | 37 // unchanged and the caller is responsible for freeing it. |
40 // freeing it. When false, the SerializedFontDescription will take ownership | 38 void SetFromPPFontDescription(const PP_FontDescription_Dev& desc); |
41 // of the ref. This is the difference between serializing as an input value | |
42 // (owns_ref = true) and an output value (owns_ref = true). | |
43 void SetFromPPFontDescription(Dispatcher* dispatcher, | |
44 const PP_FontDescription_Dev& desc, | |
45 bool source_owns_ref); | |
46 | 39 |
47 // Converts to a PP_FontDescription_Dev. The face name will have one ref | 40 // Converts to a PP_FontDescription_Dev. The face name will have one ref |
48 // assigned to it on behalf of the caller. | 41 // assigned to it. The caller is responsible for freeing it. |
49 // | 42 void SetToPPFontDescription(PP_FontDescription_Dev* desc) const; |
50 // If dest_owns_ref is set, the resulting PP_FontDescription_Dev will keep a | |
51 // reference to any strings we made on its behalf even when the | |
52 // SerializedFontDescription goes away. When false, ownership of the ref will | |
53 // stay with the SerializedFontDescription and the PP_FontDescription_Dev | |
54 // will just refer to that one. This is the difference between deserializing | |
55 // as an input value (owns_ref = false) and an output value (owns_ref = true). | |
56 void SetToPPFontDescription(Dispatcher* dispatcher, | |
57 PP_FontDescription_Dev* desc, | |
58 bool dest_owns_ref) const; | |
59 | 43 |
60 SerializedVar face; | 44 std::string face; |
61 int32_t family; | 45 int32_t family; |
62 uint32_t size; | 46 uint32_t size; |
63 int32_t weight; | 47 int32_t weight; |
64 PP_Bool italic; | 48 PP_Bool italic; |
65 PP_Bool small_caps; | 49 PP_Bool small_caps; |
66 int32_t letter_spacing; | 50 int32_t letter_spacing; |
67 int32_t word_spacing; | 51 int32_t word_spacing; |
68 }; | 52 }; |
69 | 53 |
70 struct SerializedDirEntry { | 54 struct SerializedDirEntry { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 typedef base::SharedMemoryHandle ImageHandle; | 200 typedef base::SharedMemoryHandle ImageHandle; |
217 #else | 201 #else |
218 // On X Windows this is a SysV shared memory key. | 202 // On X Windows this is a SysV shared memory key. |
219 typedef int ImageHandle; | 203 typedef int ImageHandle; |
220 #endif | 204 #endif |
221 | 205 |
222 } // namespace proxy | 206 } // namespace proxy |
223 } // namespace ppapi | 207 } // namespace ppapi |
224 | 208 |
225 #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_ | 209 #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_ |
OLD | NEW |