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
diff --git a/ppapi/api/pp_macros.idl b/ppapi/api/pp_macros.idl
index f189d4a9..fc6e4ad 100644
--- a/ppapi/api/pp_macros.idl
+++ b/ppapi/api/pp_macros.idl
@@ -86,6 +86,22 @@
#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