Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: mojo/converters/surfaces/surfaces_type_converters.cc

Issue 1468803002: Switch to static_assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@assert1
Patch Set: message cleanup Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "mojo/converters/surfaces/surfaces_type_converters.h" 5 #include "mojo/converters/surfaces/surfaces_type_converters.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_metadata.h" 9 #include "cc/output/compositor_frame_metadata.h"
10 #include "cc/output/delegated_frame_data.h" 10 #include "cc/output/delegated_frame_data.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 using mus::mojom::TileQuadState; 62 using mus::mojom::TileQuadState;
63 using mus::mojom::TileQuadStatePtr; 63 using mus::mojom::TileQuadStatePtr;
64 using mus::mojom::TransferableResource; 64 using mus::mojom::TransferableResource;
65 using mus::mojom::TransferableResourcePtr; 65 using mus::mojom::TransferableResourcePtr;
66 using mus::mojom::YUVColorSpace; 66 using mus::mojom::YUVColorSpace;
67 using mus::mojom::YUVVideoQuadState; 67 using mus::mojom::YUVVideoQuadState;
68 using mus::mojom::YUVVideoQuadStatePtr; 68 using mus::mojom::YUVVideoQuadStatePtr;
69 69
70 namespace mojo { 70 namespace mojo {
71 71
72 #define ASSERT_ENUM_VALUES_EQUAL(value) \ 72 #define ASSERT_ENUM_VALUES_EQUAL(value) \
73 COMPILE_ASSERT(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \ 73 static_assert(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \
74 mus::mojom::MATERIAL_##value), \ 74 mus::mojom::MATERIAL_##value), \
75 value##_enum_value_matches) 75 #value " enum value must match")
76 76
77 ASSERT_ENUM_VALUES_EQUAL(DEBUG_BORDER); 77 ASSERT_ENUM_VALUES_EQUAL(DEBUG_BORDER);
78 ASSERT_ENUM_VALUES_EQUAL(IO_SURFACE_CONTENT); 78 ASSERT_ENUM_VALUES_EQUAL(IO_SURFACE_CONTENT);
79 ASSERT_ENUM_VALUES_EQUAL(PICTURE_CONTENT); 79 ASSERT_ENUM_VALUES_EQUAL(PICTURE_CONTENT);
80 ASSERT_ENUM_VALUES_EQUAL(RENDER_PASS); 80 ASSERT_ENUM_VALUES_EQUAL(RENDER_PASS);
81 ASSERT_ENUM_VALUES_EQUAL(SOLID_COLOR); 81 ASSERT_ENUM_VALUES_EQUAL(SOLID_COLOR);
82 ASSERT_ENUM_VALUES_EQUAL(STREAM_VIDEO_CONTENT); 82 ASSERT_ENUM_VALUES_EQUAL(STREAM_VIDEO_CONTENT);
83 ASSERT_ENUM_VALUES_EQUAL(SURFACE_CONTENT); 83 ASSERT_ENUM_VALUES_EQUAL(SURFACE_CONTENT);
84 ASSERT_ENUM_VALUES_EQUAL(TEXTURE_CONTENT); 84 ASSERT_ENUM_VALUES_EQUAL(TEXTURE_CONTENT);
85 ASSERT_ENUM_VALUES_EQUAL(TILED_CONTENT); 85 ASSERT_ENUM_VALUES_EQUAL(TILED_CONTENT);
86 ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT); 86 ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT);
87 87
88 COMPILE_ASSERT(cc::YUVVideoDrawQuad::REC_601 == 88 static_assert(cc::YUVVideoDrawQuad::REC_601 ==
89 static_cast<cc::YUVVideoDrawQuad::ColorSpace>( 89 static_cast<cc::YUVVideoDrawQuad::ColorSpace>(
90 mus::mojom::YUV_COLOR_SPACE_REC_601), 90 mus::mojom::YUV_COLOR_SPACE_REC_601),
91 rec_601_enum_matches); 91 "REC_601 enum value must match");
92 // TODO(jamesr): Add REC_709 and JPEG to the YUVColorSpace enum upstream in 92 // TODO(jamesr): Add REC_709 and JPEG to the YUVColorSpace enum upstream in
93 // mojo. 93 // mojo.
94 94
95 namespace { 95 namespace {
96 96
97 cc::SharedQuadState* ConvertSharedQuadState( 97 cc::SharedQuadState* ConvertSharedQuadState(
98 const mus::mojom::SharedQuadStatePtr& input, 98 const mus::mojom::SharedQuadStatePtr& input,
99 cc::RenderPass* render_pass) { 99 cc::RenderPass* render_pass) {
100 cc::SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); 100 cc::SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState();
101 state->SetAll(input->quad_to_target_transform.To<gfx::Transform>(), 101 state->SetAll(input->quad_to_target_transform.To<gfx::Transform>(),
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 } 732 }
733 733
734 // static 734 // static
735 scoped_ptr<cc::CompositorFrame> 735 scoped_ptr<cc::CompositorFrame>
736 TypeConverter<scoped_ptr<cc::CompositorFrame>, CompositorFramePtr>::Convert( 736 TypeConverter<scoped_ptr<cc::CompositorFrame>, CompositorFramePtr>::Convert(
737 const CompositorFramePtr& input) { 737 const CompositorFramePtr& input) {
738 return ConvertToCompositorFrame(input, nullptr); 738 return ConvertToCompositorFrame(input, nullptr);
739 } 739 }
740 740
741 } // namespace mojo 741 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/converters/input_events/input_events_type_converters.cc ('k') | mojo/environment/default_logger_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698