diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 17:32:25 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 17:32:25 +0000 |
commit | 698e4e24491c552eab312f57b19c2b967fcc4bc2 (patch) | |
tree | b105228d25a832bd0219cb46195cbf3495dafd4e /ppapi | |
parent | 8eaaa149fb593aa3e25ec3228f2b7c0418d74e61 (diff) | |
download | chromium_src-698e4e24491c552eab312f57b19c2b967fcc4bc2.zip chromium_src-698e4e24491c552eab312f57b19c2b967fcc4bc2.tar.gz chromium_src-698e4e24491c552eab312f57b19c2b967fcc4bc2.tar.bz2 |
Move the PP_ALLOW_THIS_IN_INITIALIZER_LIST macro from test_utils.h to
pp_macros.idl.
Now, PP_ALLOW_THIS_IN_INITIALIZER_LIST macro is provided for not only tests
but also C++ api implementation in NaCl.
BUG=87310
TEST=ui_tests
Review URL: http://codereview.chromium.org/8885012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/api/pp_macros.idl | 16 | ||||
-rw-r--r-- | ppapi/c/pp_macros.h | 18 | ||||
-rw-r--r-- | ppapi/tests/test_flash.cc | 2 | ||||
-rw-r--r-- | ppapi/tests/test_transport.cc | 1 | ||||
-rw-r--r-- | ppapi/tests/test_utils.h | 16 |
5 files changed, 35 insertions, 18 deletions
diff --git a/ppapi/api/pp_macros.idl b/ppapi/api/pp_macros.idl index f189d4a..fc6e4ad 100644 --- a/ppapi/api/pp_macros.idl +++ b/ppapi/api/pp_macros.idl @@ -86,6 +86,22 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE) #define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \ PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE) +/* This is roughly copied from base/compiler_specific.h, and makes it possible + to pass 'this' in a constructor initializer list, when you really mean it. + E.g.: + Foo::Foo(MyInstance* instance) + : PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {} + */ +#if defined(COMPILER_MSVC) +# define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) \ + __pragma(warning(push)) \ + __pragma(warning(disable:4355)) \ + code \ + __pragma(warning(pop)) +#else +# define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) code +#endif + /** * @} * End of addtogroup PP diff --git a/ppapi/c/pp_macros.h b/ppapi/c/pp_macros.h index e5cd7dd..22beebf 100644 --- a/ppapi/c/pp_macros.h +++ b/ppapi/c/pp_macros.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From pp_macros.idl modified Sat Jul 16 16:50:26 2011. */ +/* From pp_macros.idl modified Thu Dec 8 23:25:05 2011. */ #ifndef PPAPI_C_PP_MACROS_H_ #define PPAPI_C_PP_MACROS_H_ @@ -93,6 +93,22 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE) #define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \ PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE) +/* This is roughly copied from base/compiler_specific.h, and makes it possible + to pass 'this' in a constructor initializer list, when you really mean it. + E.g.: + Foo::Foo(MyInstance* instance) + : PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {} + */ +#if defined(COMPILER_MSVC) +# define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) \ + __pragma(warning(push)) \ + __pragma(warning(disable:4355)) \ + code \ + __pragma(warning(pop)) +#else +# define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) code +#endif + /** * @} * End of addtogroup PP diff --git a/ppapi/tests/test_flash.cc b/ppapi/tests/test_flash.cc index 2121325..9f666a8 100644 --- a/ppapi/tests/test_flash.cc +++ b/ppapi/tests/test_flash.cc @@ -4,11 +4,11 @@ #include "ppapi/tests/test_flash.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/c/private/ppb_flash.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/module.h" #include "ppapi/cpp/var.h" -#include "ppapi/tests/test_utils.h" #include "ppapi/tests/testing_instance.h" REGISTER_TEST_CASE(Flash); diff --git a/ppapi/tests/test_transport.cc b/ppapi/tests/test_transport.cc index 311cf9d..71f49b8 100644 --- a/ppapi/tests/test_transport.cc +++ b/ppapi/tests/test_transport.cc @@ -12,6 +12,7 @@ #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/pp_macros.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/dev/transport_dev.h" #include "ppapi/cpp/instance.h" diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h index c2d9207..8cfd2dd 100644 --- a/ppapi/tests/test_utils.h +++ b/ppapi/tests/test_utils.h @@ -79,20 +79,4 @@ class TestCompletionCallback { #define PPAPI_POSIX 1 #endif -// This is roughly copied from base/compiler_specific.h, and makes it possible -// to pass 'this' in a constructor initializer list, when you really mean it. -// -// Example usage: -// Foo::Foo(MyInstance* instance) -// : ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) {} -#if defined(COMPILER_MSVC) -#define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) \ - __pragma(warning(push)) \ - __pragma(warning(disable:4355)) \ - code \ - __pragma(warning(pop)) -#else -#define PP_ALLOW_THIS_IN_INITIALIZER_LIST(code) code -#endif - #endif // PPAPI_TESTS_TEST_UTILS_H_ |