OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UMA_PRIVATE_RESOURCE_H_ | 5 #ifndef PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_DATA_H_ |
6 #define PPAPI_PROXY_UMA_PRIVATE_RESOURCE_H_ | 6 #define PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_DATA_H_ |
7 | 7 |
8 #include "ppapi/proxy/connection.h" | 8 #include <string.h> |
9 #include "ppapi/proxy/plugin_resource.h" | 9 |
10 #include "ppapi/proxy/ppapi_proxy_export.h" | 10 #include "gpu/command_buffer/common/mailbox.h" |
11 #include "ppapi/thunk/ppb_uma_singleton_api.h" | 11 #include "ppapi/c/ppb_compositor_layer.h" |
12 #include "ppapi/shared_impl/host_resource.h" | |
12 | 13 |
13 namespace ppapi { | 14 namespace ppapi { |
14 | 15 |
15 namespace proxy { | 16 struct CompositorLayerData { |
17 typedef int8_t Mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | |
piman
2014/06/04 13:19:44
just use gpu::Mailbox. It also has existing ParamT
Peng
2014/06/05 00:50:38
It has a constructor. The compiler does not allow
piman
2014/06/09 18:27:24
Then maybe a union is not a good choice.
Alternat
Peng
2014/06/10 16:20:28
Use 3 scoped_ptr. Done.
| |
16 | 18 |
17 class PPAPI_PROXY_EXPORT UMAPrivateResource | 19 enum Type { |
18 : public PluginResource, | 20 TYPE_UNKNOWN = 0, |
19 public thunk::PPB_UMA_Singleton_API { | 21 TYPE_COLOR, |
20 public: | 22 TYPE_TEXTURE, |
21 UMAPrivateResource(Connection connection, PP_Instance instance); | 23 TYPE_IMAGE, |
22 virtual ~UMAPrivateResource(); | 24 TYPE_LAST = TYPE_IMAGE, |
25 }; | |
23 | 26 |
24 // Resource overrides. | 27 CompositorLayerData() |
25 virtual thunk::PPB_UMA_Singleton_API* AsPPB_UMA_Singleton_API() OVERRIDE; | 28 : type(TYPE_UNKNOWN), |
29 size(PP_MakeSize(0, 0)), | |
30 clip_rect(PP_MakeRectFromXYWH(0, 0, 0, 0)), | |
31 blend_mode(PP_BLENDMODE_SRC_OVER), | |
32 opacity(255), | |
33 resource_id(0) { | |
34 transform[0] = 1.0f; | |
35 transform[1] = 0.0f; | |
36 transform[2] = 0.0f; | |
37 transform[3] = 0.0f; | |
38 transform[4] = 0.0f; | |
39 transform[5] = 1.0f; | |
40 transform[6] = 0.0f; | |
41 transform[7] = 0.0f; | |
42 transform[8] = 0.0f; | |
43 transform[9] = 0.0f; | |
44 transform[10] = 1.0f; | |
45 transform[11] = 0.0f; | |
46 transform[12] = 0.0f; | |
47 transform[13] = 0.0f; | |
48 transform[14] = 0.0f; | |
49 transform[15] = 1.0f; | |
26 | 50 |
27 // PPB_UMA_Singleton_API implementation. | 51 // Becasue texture is the biggest struct in the union, so |
piman
2014/06/04 13:19:43
typo becasue -> because
Peng
2014/06/05 00:50:38
Done.
| |
28 virtual void HistogramCustomTimes(PP_Instance instance, | 52 // we only need set it to 0. |
piman
2014/06/04 13:19:44
Technically, this is undefined behavior. Also, fra
Peng
2014/06/05 00:50:38
If I give it a name, I think I can not use union m
piman
2014/06/09 18:27:24
How is that a problem?
Peng
2014/06/10 16:20:28
I feel it looks a little weird. Anyway, change it
| |
29 struct PP_Var name, | 53 memset(&texture, 0, sizeof(texture)); |
30 int64_t sample, | 54 } |
31 int64_t min, | |
32 int64_t max, | |
33 uint32_t bucket_count) OVERRIDE; | |
34 | 55 |
35 virtual void HistogramCustomCounts(PP_Instance instance, | 56 Type type; |
36 struct PP_Var name, | 57 PP_Size size; |
37 int32_t sample, | 58 PP_Rect clip_rect; |
38 int32_t min, | 59 float transform[16]; |
39 int32_t max, | 60 PP_BlendMode blend_mode; |
40 uint32_t bucket_count) OVERRIDE; | 61 uint8_t opacity; |
41 | 62 |
42 virtual void HistogramEnumeration(PP_Instance instance, | 63 // Unique resource id for texture or image. |
43 struct PP_Var name, | 64 int32_t resource_id; |
raymes
2014/06/04 01:11:39
On the same note as my previous comments, I think
Peng
2014/06/05 00:50:38
Actually it is not a layer id. One single layer ca
| |
44 int32_t sample, | |
45 int32_t boundary_value) OVERRIDE; | |
46 | 65 |
47 virtual int32_t IsCrashReportingEnabled( | 66 union { |
48 PP_Instance instance, | 67 // Properties for a color layer. |
49 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 68 struct { |
69 uint8_t red; | |
70 uint8_t green; | |
71 uint8_t blue; | |
72 uint8_t alpha; | |
73 } color; | |
piman
2014/06/04 13:19:43
If you define those as actual structs, you can use
Peng
2014/06/05 00:50:38
Unless using a struct includes all fields in struc
piman
2014/06/09 18:27:24
If you define a struct ColorLayerData { ... }, Tex
Peng
2014/06/10 16:20:28
Done. Now we only has ParamTraits for the 4x4 matr
| |
50 | 74 |
51 private: | 75 // Properties for a texture layer. |
52 void OnPluginMsgIsCrashReportingEnabled( | 76 struct { |
53 const ResourceMessageReplyParams& params); | 77 Mailbox mailbox; |
54 scoped_refptr<TrackedCallback> pending_callback_; | 78 uint32_t sync_point; |
79 PP_FloatRect source_rect; | |
piman
2014/06/04 13:19:43
if you use gfx::RectF, ParamTraits already exist.
Peng
2014/06/05 00:50:38
Seems pepper does not use any gfx structs in IPC.
| |
80 bool premult_alpha; | |
81 } texture; | |
55 | 82 |
56 DISALLOW_COPY_AND_ASSIGN(UMAPrivateResource); | 83 // Properties for an image layer |
84 struct { | |
85 PP_Instance instance; | |
86 PP_Resource host_resource; | |
87 PP_FloatRect source_rect; | |
piman
2014/06/04 13:19:44
same here
Peng
2014/06/05 00:50:38
Seems pepper does not use any gfx structs in IPC.
| |
88 } image; | |
89 }; | |
57 }; | 90 }; |
58 | 91 |
59 } // namespace proxy | |
60 } // namespace ppapi | 92 } // namespace ppapi |
61 | 93 |
62 #endif // PPAPI_PROXY_UMA_PRIVATE_RESOURCE_H_ | 94 #endif // PPAPI_SHARED_IMPL_COMPOSITOR_LAYER_DATA_H_ |
OLD | NEW |