Index: ppapi/tests/test_utils.h |
diff --git a/ppapi/tests/test_utils.h b/ppapi/tests/test_utils.h |
index a7996b6af4963aaa39b02d7159b830e301019f01..ed5c1af7a0425877da8a8e60cb3ce622fa28658d 100644 |
--- a/ppapi/tests/test_utils.h |
+++ b/ppapi/tests/test_utils.h |
@@ -49,4 +49,20 @@ class TestCompletionCallback { |
PP_Instance instance_; |
}; |
+// 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_ |