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 MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_TYPE_CONVERTERS_H_ | 5 #ifndef MOJO_CONVERTERS_SURFACES_TYPE_CONVERTERS_H_ |
6 #define MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_TYPE_CONVERTERS_H_ | 6 #define MOJO_CONVERTERS_SURFACES_TYPE_CONVERTERS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/resources/returned_resource.h" | 9 #include "cc/resources/returned_resource.h" |
10 #include "cc/resources/transferable_resource.h" | 10 #include "cc/resources/transferable_resource.h" |
11 #include "cc/surfaces/surface_id.h" | 11 #include "cc/surfaces/surface_id.h" |
12 #include "gpu/command_buffer/common/mailbox.h" | 12 #include "gpu/command_buffer/common/mailbox.h" |
13 #include "gpu/command_buffer/common/mailbox_holder.h" | 13 #include "gpu/command_buffer/common/mailbox_holder.h" |
14 #include "mojo/services/public/cpp/surfaces/mojo_surfaces_export.h" | 14 #include "mojo/converters/mojo_converters_export.h" |
15 #include "mojo/services/public/interfaces/surfaces/quads.mojom.h" | 15 #include "mojo/services/public/interfaces/surfaces/quads.mojom.h" |
16 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" | 16 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" |
17 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" | 17 #include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 class CompositorFrame; | 21 class CompositorFrame; |
22 class DrawQuad; | 22 class DrawQuad; |
23 class RenderPass; | 23 class RenderPass; |
24 class RenderPassId; | 24 class RenderPassId; |
25 class SharedQuadState; | 25 class SharedQuadState; |
26 } // namespace cc | 26 } // namespace cc |
27 | 27 |
28 namespace mojo { | 28 namespace mojo { |
29 | 29 |
30 // Types from surface_id.mojom | 30 // Types from surface_id.mojom |
31 template <> | 31 template <> |
32 struct MOJO_SURFACES_EXPORT TypeConverter<SurfaceIdPtr, cc::SurfaceId> { | 32 struct MOJO_CONVERTERS_EXPORT TypeConverter<SurfaceIdPtr, cc::SurfaceId> { |
33 static SurfaceIdPtr Convert(const cc::SurfaceId& input); | 33 static SurfaceIdPtr Convert(const cc::SurfaceId& input); |
34 }; | 34 }; |
35 template <> | 35 template <> |
36 struct MOJO_SURFACES_EXPORT TypeConverter<cc::SurfaceId, SurfaceIdPtr> { | 36 struct MOJO_CONVERTERS_EXPORT TypeConverter<cc::SurfaceId, SurfaceIdPtr> { |
37 static cc::SurfaceId Convert(const SurfaceIdPtr& input); | 37 static cc::SurfaceId Convert(const SurfaceIdPtr& input); |
38 }; | 38 }; |
39 | 39 |
40 // Types from quads.mojom | 40 // Types from quads.mojom |
41 template <> | 41 template <> |
42 struct MOJO_SURFACES_EXPORT TypeConverter<ColorPtr, SkColor> { | 42 struct MOJO_CONVERTERS_EXPORT TypeConverter<ColorPtr, SkColor> { |
43 static ColorPtr Convert(const SkColor& input); | 43 static ColorPtr Convert(const SkColor& input); |
44 }; | 44 }; |
45 template <> | 45 template <> |
46 struct MOJO_SURFACES_EXPORT TypeConverter<SkColor, ColorPtr> { | 46 struct MOJO_CONVERTERS_EXPORT TypeConverter<SkColor, ColorPtr> { |
47 static SkColor Convert(const ColorPtr& input); | 47 static SkColor Convert(const ColorPtr& input); |
48 }; | 48 }; |
49 | 49 |
50 template <> | 50 template <> |
51 struct MOJO_SURFACES_EXPORT TypeConverter<RenderPassIdPtr, cc::RenderPassId> { | 51 struct MOJO_CONVERTERS_EXPORT TypeConverter<RenderPassIdPtr, cc::RenderPassId> { |
52 static RenderPassIdPtr Convert(const cc::RenderPassId& input); | 52 static RenderPassIdPtr Convert(const cc::RenderPassId& input); |
53 }; | 53 }; |
54 | 54 |
55 template <> | 55 template <> |
56 struct MOJO_SURFACES_EXPORT TypeConverter<cc::RenderPassId, RenderPassIdPtr> { | 56 struct MOJO_CONVERTERS_EXPORT TypeConverter<cc::RenderPassId, RenderPassIdPtr> { |
57 static cc::RenderPassId Convert(const RenderPassIdPtr& input); | 57 static cc::RenderPassId Convert(const RenderPassIdPtr& input); |
58 }; | 58 }; |
59 | 59 |
60 template <> | 60 template <> |
61 struct MOJO_SURFACES_EXPORT TypeConverter<QuadPtr, cc::DrawQuad> { | 61 struct MOJO_CONVERTERS_EXPORT TypeConverter<QuadPtr, cc::DrawQuad> { |
62 static QuadPtr Convert(const cc::DrawQuad& input); | 62 static QuadPtr Convert(const cc::DrawQuad& input); |
63 }; | 63 }; |
64 | 64 |
65 template <> | 65 template <> |
66 struct MOJO_SURFACES_EXPORT | 66 struct MOJO_CONVERTERS_EXPORT |
67 TypeConverter<SharedQuadStatePtr, cc::SharedQuadState> { | 67 TypeConverter<SharedQuadStatePtr, cc::SharedQuadState> { |
68 static SharedQuadStatePtr Convert(const cc::SharedQuadState& input); | 68 static SharedQuadStatePtr Convert(const cc::SharedQuadState& input); |
69 }; | 69 }; |
70 | 70 |
71 template <> | 71 template <> |
72 struct MOJO_SURFACES_EXPORT TypeConverter<PassPtr, cc::RenderPass> { | 72 struct MOJO_CONVERTERS_EXPORT TypeConverter<PassPtr, cc::RenderPass> { |
73 static PassPtr Convert(const cc::RenderPass& input); | 73 static PassPtr Convert(const cc::RenderPass& input); |
74 }; | 74 }; |
75 | 75 |
76 template <> | 76 template <> |
77 struct MOJO_SURFACES_EXPORT TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr> { | 77 struct MOJO_CONVERTERS_EXPORT |
| 78 TypeConverter<scoped_ptr<cc::RenderPass>, PassPtr> { |
78 static scoped_ptr<cc::RenderPass> Convert(const PassPtr& input); | 79 static scoped_ptr<cc::RenderPass> Convert(const PassPtr& input); |
79 }; | 80 }; |
80 | 81 |
81 // Types from surfaces.mojom | 82 // Types from surfaces.mojom |
82 template <> | 83 template <> |
83 struct MOJO_SURFACES_EXPORT TypeConverter<MailboxPtr, gpu::Mailbox> { | 84 struct MOJO_CONVERTERS_EXPORT TypeConverter<MailboxPtr, gpu::Mailbox> { |
84 static MailboxPtr Convert(const gpu::Mailbox& input); | 85 static MailboxPtr Convert(const gpu::Mailbox& input); |
85 }; | 86 }; |
86 template <> | 87 template <> |
87 struct MOJO_SURFACES_EXPORT TypeConverter<gpu::Mailbox, MailboxPtr> { | 88 struct MOJO_CONVERTERS_EXPORT TypeConverter<gpu::Mailbox, MailboxPtr> { |
88 static gpu::Mailbox Convert(const MailboxPtr& input); | 89 static gpu::Mailbox Convert(const MailboxPtr& input); |
89 }; | 90 }; |
90 | 91 |
91 template <> | 92 template <> |
92 struct MOJO_SURFACES_EXPORT | 93 struct MOJO_CONVERTERS_EXPORT |
93 TypeConverter<MailboxHolderPtr, gpu::MailboxHolder> { | 94 TypeConverter<MailboxHolderPtr, gpu::MailboxHolder> { |
94 static MailboxHolderPtr Convert(const gpu::MailboxHolder& input); | 95 static MailboxHolderPtr Convert(const gpu::MailboxHolder& input); |
95 }; | 96 }; |
96 template <> | 97 template <> |
97 struct MOJO_SURFACES_EXPORT | 98 struct MOJO_CONVERTERS_EXPORT |
98 TypeConverter<gpu::MailboxHolder, MailboxHolderPtr> { | 99 TypeConverter<gpu::MailboxHolder, MailboxHolderPtr> { |
99 static gpu::MailboxHolder Convert(const MailboxHolderPtr& input); | 100 static gpu::MailboxHolder Convert(const MailboxHolderPtr& input); |
100 }; | 101 }; |
101 | 102 |
102 template <> | 103 template <> |
103 struct MOJO_SURFACES_EXPORT | 104 struct MOJO_CONVERTERS_EXPORT |
104 TypeConverter<TransferableResourcePtr, cc::TransferableResource> { | 105 TypeConverter<TransferableResourcePtr, cc::TransferableResource> { |
105 static TransferableResourcePtr Convert(const cc::TransferableResource& input); | 106 static TransferableResourcePtr Convert(const cc::TransferableResource& input); |
106 }; | 107 }; |
107 template <> | 108 template <> |
108 struct MOJO_SURFACES_EXPORT | 109 struct MOJO_CONVERTERS_EXPORT |
109 TypeConverter<cc::TransferableResource, TransferableResourcePtr> { | 110 TypeConverter<cc::TransferableResource, TransferableResourcePtr> { |
110 static cc::TransferableResource Convert(const TransferableResourcePtr& input); | 111 static cc::TransferableResource Convert(const TransferableResourcePtr& input); |
111 }; | 112 }; |
112 | 113 |
113 template <> | 114 template <> |
114 struct MOJO_SURFACES_EXPORT | 115 struct MOJO_CONVERTERS_EXPORT |
115 TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray> { | 116 TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray> { |
116 static Array<TransferableResourcePtr> Convert( | 117 static Array<TransferableResourcePtr> Convert( |
117 const cc::TransferableResourceArray& input); | 118 const cc::TransferableResourceArray& input); |
118 }; | 119 }; |
119 template <> | 120 template <> |
120 struct MOJO_SURFACES_EXPORT | 121 struct MOJO_CONVERTERS_EXPORT |
121 TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> > { | 122 TypeConverter<cc::TransferableResourceArray, Array<TransferableResourcePtr> > { |
122 static cc::TransferableResourceArray Convert( | 123 static cc::TransferableResourceArray Convert( |
123 const Array<TransferableResourcePtr>& input); | 124 const Array<TransferableResourcePtr>& input); |
124 }; | 125 }; |
125 | 126 |
126 template <> | 127 template <> |
127 struct MOJO_SURFACES_EXPORT | 128 struct MOJO_CONVERTERS_EXPORT |
128 TypeConverter<ReturnedResourcePtr, cc::ReturnedResource> { | 129 TypeConverter<ReturnedResourcePtr, cc::ReturnedResource> { |
129 static ReturnedResourcePtr Convert(const cc::ReturnedResource& input); | 130 static ReturnedResourcePtr Convert(const cc::ReturnedResource& input); |
130 }; | 131 }; |
131 template <> | 132 template <> |
132 struct MOJO_SURFACES_EXPORT | 133 struct MOJO_CONVERTERS_EXPORT |
133 TypeConverter<cc::ReturnedResource, ReturnedResourcePtr> { | 134 TypeConverter<cc::ReturnedResource, ReturnedResourcePtr> { |
134 static cc::ReturnedResource Convert(const ReturnedResourcePtr& input); | 135 static cc::ReturnedResource Convert(const ReturnedResourcePtr& input); |
135 }; | 136 }; |
136 | 137 |
137 template <> | 138 template <> |
138 struct MOJO_SURFACES_EXPORT | 139 struct MOJO_CONVERTERS_EXPORT |
139 TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray> { | 140 TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray> { |
140 static Array<ReturnedResourcePtr> Convert( | 141 static Array<ReturnedResourcePtr> Convert( |
141 const cc::ReturnedResourceArray& input); | 142 const cc::ReturnedResourceArray& input); |
142 }; | 143 }; |
143 | 144 |
144 template <> | 145 template <> |
145 struct MOJO_SURFACES_EXPORT TypeConverter<FramePtr, cc::CompositorFrame> { | 146 struct MOJO_CONVERTERS_EXPORT TypeConverter<FramePtr, cc::CompositorFrame> { |
146 static FramePtr Convert(const cc::CompositorFrame& input); | 147 static FramePtr Convert(const cc::CompositorFrame& input); |
147 }; | 148 }; |
148 | 149 |
149 template <> | 150 template <> |
150 struct MOJO_SURFACES_EXPORT | 151 struct MOJO_CONVERTERS_EXPORT |
151 TypeConverter<scoped_ptr<cc::CompositorFrame>, FramePtr> { | 152 TypeConverter<scoped_ptr<cc::CompositorFrame>, FramePtr> { |
152 static scoped_ptr<cc::CompositorFrame> Convert(const FramePtr& input); | 153 static scoped_ptr<cc::CompositorFrame> Convert(const FramePtr& input); |
153 }; | 154 }; |
154 | 155 |
155 } // namespace mojo | 156 } // namespace mojo |
156 | 157 |
157 #endif // MOJO_SERVICES_PUBLIC_CPP_SURFACES_SURFACES_TYPE_CONVERTERS_H_ | 158 #endif // MOJO_CONVERTERS_SURFACES_TYPE_CONVERTERS_H_ |
OLD | NEW |