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

Side by Side Diff: ppapi/thunk/ppb_text_input_thunk.cc

Issue 824153003: replace COMPILE_ASSERT with static_assert in ppapi/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 5 years, 11 months 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
« no previous file with comments | « ppapi/shared_impl/private/net_address_private_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "ppapi/c/dev/ppb_text_input_dev.h" 6 #include "ppapi/c/dev/ppb_text_input_dev.h"
7 #include "ppapi/c/ppb_text_input_controller.h" 7 #include "ppapi/c/ppb_text_input_controller.h"
8 #include "ppapi/shared_impl/var.h" 8 #include "ppapi/shared_impl/var.h"
9 #include "ppapi/thunk/enter.h" 9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/ppb_instance_api.h" 10 #include "ppapi/thunk/ppb_instance_api.h"
11 #include "ppapi/thunk/thunk.h" 11 #include "ppapi/thunk/thunk.h"
12 12
13 namespace ppapi { 13 namespace ppapi {
14 namespace thunk { 14 namespace thunk {
15 15
16 namespace { 16 namespace {
17 17
18 COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_NONE) == int(PP_TEXTINPUT_TYPE_NONE), 18 #define STATIC_ASSERT_ENUM(a, b) \
19 mismatching_enums); 19 static_assert(int(a) == int(b), "mismatching enum values: " #a)
20 COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_TEXT) == int(PP_TEXTINPUT_TYPE_TEXT), 20
21 mismatching_enums); 21 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_NONE, PP_TEXTINPUT_TYPE_NONE);
22 COMPILE_ASSERT( 22 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_TEXT, PP_TEXTINPUT_TYPE_TEXT);
23 int(PP_TEXTINPUT_TYPE_DEV_PASSWORD) == int(PP_TEXTINPUT_TYPE_PASSWORD), 23 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_PASSWORD, PP_TEXTINPUT_TYPE_PASSWORD);
24 mismatching_enums); 24 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_SEARCH, PP_TEXTINPUT_TYPE_SEARCH);
25 COMPILE_ASSERT( 25 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_EMAIL, PP_TEXTINPUT_TYPE_EMAIL);
26 int(PP_TEXTINPUT_TYPE_DEV_SEARCH) == int(PP_TEXTINPUT_TYPE_SEARCH), 26 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_NUMBER, PP_TEXTINPUT_TYPE_NUMBER);
27 mismatching_enums); 27 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_TELEPHONE,
28 COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_EMAIL) == int(PP_TEXTINPUT_TYPE_EMAIL), 28 PP_TEXTINPUT_TYPE_TELEPHONE);
29 mismatching_enums); 29 STATIC_ASSERT_ENUM(PP_TEXTINPUT_TYPE_DEV_URL, PP_TEXTINPUT_TYPE_URL);
30 COMPILE_ASSERT(
31 int(PP_TEXTINPUT_TYPE_DEV_NUMBER) == int(PP_TEXTINPUT_TYPE_NUMBER),
32 mismatching_enums);
33 COMPILE_ASSERT(
34 int(PP_TEXTINPUT_TYPE_DEV_TELEPHONE) == int(PP_TEXTINPUT_TYPE_TELEPHONE),
35 mismatching_enums);
36 COMPILE_ASSERT(int(PP_TEXTINPUT_TYPE_DEV_URL) == int(PP_TEXTINPUT_TYPE_URL),
37 mismatching_enums);
38 30
39 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) { 31 void SetTextInputType(PP_Instance instance, PP_TextInput_Type type) {
40 EnterInstance enter(instance); 32 EnterInstance enter(instance);
41 if (enter.succeeded()) 33 if (enter.succeeded())
42 enter.functions()->SetTextInputType(instance, type); 34 enter.functions()->SetTextInputType(instance, type);
43 } 35 }
44 36
45 void SetTextInputType_0_2(PP_Instance instance, PP_TextInput_Type_Dev type) { 37 void SetTextInputType_0_2(PP_Instance instance, PP_TextInput_Type_Dev type) {
46 EnterInstance enter(instance); 38 EnterInstance enter(instance);
47 if (enter.succeeded()) 39 if (enter.succeeded())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() { 116 const PPB_TextInput_Dev_0_2* GetPPB_TextInput_Dev_0_2_Thunk() {
125 return &g_ppb_textinput_0_2_thunk; 117 return &g_ppb_textinput_0_2_thunk;
126 } 118 }
127 119
128 const PPB_TextInputController_1_0* GetPPB_TextInputController_1_0_Thunk() { 120 const PPB_TextInputController_1_0* GetPPB_TextInputController_1_0_Thunk() {
129 return &g_ppb_textinputcontroller_1_0_thunk; 121 return &g_ppb_textinputcontroller_1_0_thunk;
130 } 122 }
131 123
132 } // namespace thunk 124 } // namespace thunk
133 } // namespace ppapi 125 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/private/net_address_private_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698