blob: f1d90f21a2b936837a4217b6fc25c03b18da50de [file] [log] [blame]
[email protected]a0e1adc52012-01-27 07:21:131// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]fb35dcf2010-11-14 17:08:002// 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]3acbbae42010-12-08 07:50:4011#include "base/shared_memory.h"
12#include "build/build_config.h"
[email protected]f24448db2011-01-27 20:40:3913#include "ipc/ipc_platform_file.h"
[email protected]fb35dcf2010-11-14 17:08:0014#include "ppapi/c/pp_bool.h"
[email protected]859a7f32011-01-15 03:44:1315#include "ppapi/c/pp_instance.h"
[email protected]fb35dcf2010-11-14 17:08:0016#include "ppapi/c/pp_point.h"
17#include "ppapi/c/pp_rect.h"
[email protected]fb35dcf2010-11-14 17:08:0018#include "ppapi/proxy/serialized_var.h"
[email protected]be0a84b2011-08-13 04:18:4419#include "ppapi/shared_impl/host_resource.h"
[email protected]fb35dcf2010-11-14 17:08:0020
21struct PP_FontDescription_Dev;
22
[email protected]4d2efd22011-08-18 21:58:0223namespace ppapi {
[email protected]fb35dcf2010-11-14 17:08:0024namespace proxy {
25
26class 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]f0a04c42011-08-26 22:43:2030struct PPAPI_PROXY_EXPORT SerializedFontDescription {
[email protected]aa20e062010-12-07 23:07:2731 SerializedFontDescription();
32 ~SerializedFontDescription();
33
[email protected]fb35dcf2010-11-14 17:08:0034 // 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]4d2efd22011-08-18 21:58:0258 SerializedVar face;
[email protected]fb35dcf2010-11-14 17:08:0059 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
68struct SerializedDirEntry {
69 std::string name;
70 bool is_dir;
71};
72
[email protected]fb35dcf2010-11-14 17:08:0073struct PPBFlash_DrawGlyphs_Params {
[email protected]aa20e062010-12-07 23:07:2774 PPBFlash_DrawGlyphs_Params();
75 ~PPBFlash_DrawGlyphs_Params();
76
[email protected]859a7f32011-01-15 03:44:1377 PP_Instance instance;
[email protected]be0a84b2011-08-13 04:18:4478 ppapi::HostResource image_data;
[email protected]fb35dcf2010-11-14 17:08:0079 SerializedFontDescription font_desc;
80 uint32_t color;
81 PP_Point position;
82 PP_Rect clip;
83 float transformation[3][3];
[email protected]2e4361ae2011-12-15 00:03:3584 PP_Bool allow_subpixel_aa;
[email protected]fb35dcf2010-11-14 17:08:0085 std::vector<uint16_t> glyph_indices;
86 std::vector<PP_Point> glyph_advances;
87};
88
[email protected]f24448db2011-01-27 20:40:3989struct PPBAudio_NotifyAudioStreamCreated_Params {
[email protected]be0a84b2011-08-13 04:18:4490 ppapi::HostResource audio_id;
[email protected]f24448db2011-01-27 20:40:3991 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
97struct PPBURLLoader_UpdateProgress_Params {
98 PP_Instance instance;
[email protected]be0a84b2011-08-13 04:18:4499 ppapi::HostResource resource;
[email protected]f24448db2011-01-27 20:40:39100 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]0fa46e82011-08-09 07:31:49106struct PPPVideoCapture_Buffer {
[email protected]be0a84b2011-08-13 04:18:44107 ppapi::HostResource resource;
[email protected]0fa46e82011-08-09 07:31:49108 uint32_t size;
109 base::SharedMemoryHandle handle;
110};
111
[email protected]3acbbae42010-12-08 07:50:40112#if defined(OS_WIN)
113typedef HANDLE ImageHandle;
[email protected]a0e1adc52012-01-27 07:21:13114#elif defined(OS_MACOSX) || defined(OS_ANDROID)
[email protected]3acbbae42010-12-08 07:50:40115typedef base::SharedMemoryHandle ImageHandle;
116#else
117// On X Windows this is a SysV shared memory key.
118typedef int ImageHandle;
119#endif
120
[email protected]fb35dcf2010-11-14 17:08:00121} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:02122} // namespace ppapi
[email protected]fb35dcf2010-11-14 17:08:00123
[email protected]fb35dcf2010-11-14 17:08:00124#endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_