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]; |
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(1.0f), |
| 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 // Because texture is the biggest struct in the union, so |
28 virtual void HistogramCustomTimes(PP_Instance instance, | 52 // we only need set it to 0. |
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 float 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; |
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 float red; |
| 70 float green; |
| 71 float blue; |
| 72 float alpha; |
| 73 } color; |
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; |
| 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; |
| 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 |