[email protected] | a0e1adc5 | 2012-01-27 07:21:13 | [diff] [blame^] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef PPAPI_PROXY_SERIALIZED_STRUCTS_H_ | ||||
6 | #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_ | ||||
7 | |||||
8 | #include <string> | ||||
9 | #include <vector> | ||||
10 | |||||
[email protected] | 3acbbae4 | 2010-12-08 07:50:40 | [diff] [blame] | 11 | #include "base/shared_memory.h" |
12 | #include "build/build_config.h" | ||||
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 13 | #include "ipc/ipc_platform_file.h" |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 14 | #include "ppapi/c/pp_bool.h" |
[email protected] | 859a7f3 | 2011-01-15 03:44:13 | [diff] [blame] | 15 | #include "ppapi/c/pp_instance.h" |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 16 | #include "ppapi/c/pp_point.h" |
17 | #include "ppapi/c/pp_rect.h" | ||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 18 | #include "ppapi/proxy/serialized_var.h" |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 19 | #include "ppapi/shared_impl/host_resource.h" |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 20 | |
21 | struct PP_FontDescription_Dev; | ||||
22 | |||||
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 23 | namespace ppapi { |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 24 | namespace proxy { |
25 | |||||
26 | class Dispatcher; | ||||
27 | |||||
28 | // PP_FontDescript_Dev has to be redefined with a SerializedVar in place of | ||||
29 | // the PP_Var used for the face name. | ||||
[email protected] | f0a04c4 | 2011-08-26 22:43:20 | [diff] [blame] | 30 | struct PPAPI_PROXY_EXPORT SerializedFontDescription { |
[email protected] | aa20e06 | 2010-12-07 23:07:27 | [diff] [blame] | 31 | SerializedFontDescription(); |
32 | ~SerializedFontDescription(); | ||||
33 | |||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 34 | // Converts a PP_FontDescription_Dev to a SerializedFontDescription. |
35 | // | ||||
36 | // If source_owns_ref is true, the reference owned by the | ||||
37 | // PP_FontDescription_Dev will be unchanged and the caller is responsible for | ||||
38 | // freeing it. When false, the SerializedFontDescription will take ownership | ||||
39 | // of the ref. This is the difference between serializing as an input value | ||||
40 | // (owns_ref = true) and an output value (owns_ref = true). | ||||
41 | void SetFromPPFontDescription(Dispatcher* dispatcher, | ||||
42 | const PP_FontDescription_Dev& desc, | ||||
43 | bool source_owns_ref); | ||||
44 | |||||
45 | // Converts to a PP_FontDescription_Dev. The face name will have one ref | ||||
46 | // assigned to it on behalf of the caller. | ||||
47 | // | ||||
48 | // If dest_owns_ref is set, the resulting PP_FontDescription_Dev will keep a | ||||
49 | // reference to any strings we made on its behalf even when the | ||||
50 | // SerializedFontDescription goes away. When false, ownership of the ref will | ||||
51 | // stay with the SerializedFontDescription and the PP_FontDescription_Dev | ||||
52 | // will just refer to that one. This is the difference between deserializing | ||||
53 | // as an input value (owns_ref = false) and an output value (owns_ref = true). | ||||
54 | void SetToPPFontDescription(Dispatcher* dispatcher, | ||||
55 | PP_FontDescription_Dev* desc, | ||||
56 | bool dest_owns_ref) const; | ||||
57 | |||||
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 58 | SerializedVar face; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 59 | int32_t family; |
60 | uint32_t size; | ||||
61 | int32_t weight; | ||||
62 | PP_Bool italic; | ||||
63 | PP_Bool small_caps; | ||||
64 | int32_t letter_spacing; | ||||
65 | int32_t word_spacing; | ||||
66 | }; | ||||
67 | |||||
68 | struct SerializedDirEntry { | ||||
69 | std::string name; | ||||
70 | bool is_dir; | ||||
71 | }; | ||||
72 | |||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 73 | struct PPBFlash_DrawGlyphs_Params { |
[email protected] | aa20e06 | 2010-12-07 23:07:27 | [diff] [blame] | 74 | PPBFlash_DrawGlyphs_Params(); |
75 | ~PPBFlash_DrawGlyphs_Params(); | ||||
76 | |||||
[email protected] | 859a7f3 | 2011-01-15 03:44:13 | [diff] [blame] | 77 | PP_Instance instance; |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 78 | ppapi::HostResource image_data; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 79 | SerializedFontDescription font_desc; |
80 | uint32_t color; | ||||
81 | PP_Point position; | ||||
82 | PP_Rect clip; | ||||
83 | float transformation[3][3]; | ||||
[email protected] | 2e4361ae | 2011-12-15 00:03:35 | [diff] [blame] | 84 | PP_Bool allow_subpixel_aa; |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 85 | std::vector<uint16_t> glyph_indices; |
86 | std::vector<PP_Point> glyph_advances; | ||||
87 | }; | ||||
88 | |||||
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 89 | struct PPBAudio_NotifyAudioStreamCreated_Params { |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 90 | ppapi::HostResource audio_id; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 91 | int32_t result_code; // Will be != PP_OK on failure |
92 | IPC::PlatformFileForTransit socket_handle; | ||||
93 | base::SharedMemoryHandle handle; | ||||
94 | int32_t length; | ||||
95 | }; | ||||
96 | |||||
97 | struct PPBURLLoader_UpdateProgress_Params { | ||||
98 | PP_Instance instance; | ||||
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 99 | ppapi::HostResource resource; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 100 | int64_t bytes_sent; |
101 | int64_t total_bytes_to_be_sent; | ||||
102 | int64_t bytes_received; | ||||
103 | int64_t total_bytes_to_be_received; | ||||
104 | }; | ||||
105 | |||||
[email protected] | 0fa46e8 | 2011-08-09 07:31:49 | [diff] [blame] | 106 | struct PPPVideoCapture_Buffer { |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 107 | ppapi::HostResource resource; |
[email protected] | 0fa46e8 | 2011-08-09 07:31:49 | [diff] [blame] | 108 | uint32_t size; |
109 | base::SharedMemoryHandle handle; | ||||
110 | }; | ||||
111 | |||||
[email protected] | 3acbbae4 | 2010-12-08 07:50:40 | [diff] [blame] | 112 | #if defined(OS_WIN) |
113 | typedef HANDLE ImageHandle; | ||||
[email protected] | a0e1adc5 | 2012-01-27 07:21:13 | [diff] [blame^] | 114 | #elif defined(OS_MACOSX) || defined(OS_ANDROID) |
[email protected] | 3acbbae4 | 2010-12-08 07:50:40 | [diff] [blame] | 115 | typedef base::SharedMemoryHandle ImageHandle; |
116 | #else | ||||
117 | // On X Windows this is a SysV shared memory key. | ||||
118 | typedef int ImageHandle; | ||||
119 | #endif | ||||
120 | |||||
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 121 | } // namespace proxy |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 122 | } // namespace ppapi |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 123 | |
[email protected] | fb35dcf | 2010-11-14 17:08:00 | [diff] [blame] | 124 | #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_ |