summaryrefslogtreecommitdiffstats
path: root/base/json
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-15 19:39:31 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-15 19:39:31 +0000
commitd030986aeece4dc8eaf8cb04ce3609a6437b3bff (patch)
tree43af22cb83d32ef9d562dc94cc0f33a93af35cda /base/json
parent8380ebeede55b13b95032dce721b5fbdc7d9cf8a (diff)
downloadchromium_src-d030986aeece4dc8eaf8cb04ce3609a6437b3bff.zip
chromium_src-d030986aeece4dc8eaf8cb04ce3609a6437b3bff.tar.gz
chromium_src-d030986aeece4dc8eaf8cb04ce3609a6437b3bff.tar.bz2
Remove FRIEND_TEST declarations to improve optimizations
Friends may access methods that are otherwise unused. Removing friends may cause dead-code elimination, and also reduce the need for copies of entry points (allowing more inlining). r=laforge git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json')
-rw-r--r--base/json/json_reader.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index be3aef2..2df1b6b 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -37,8 +37,19 @@
// Chromium and Chromium OS check out gtest to different places, so we're
// unable to compile on both if we include gtest_prod.h here. Instead, include
// its only contents -- this will need to be updated if the macro ever changes.
-#define FRIEND_TEST(test_case_name, test_name)\
-friend class test_case_name##_##test_name##_Test
+#if defined(GOOGLE_CHROME_BUILD)
+
+// Provide a no-op that can live in a class definition.
+// We can't use an expression, so we define a useless local class name.
+#define FRIEND_TEST(test_case_name, test_name) \
+ class test_case_name##_##test_name##_Test {int garbage;}
+
+#else
+
+#define FRIEND_TEST(test_case_name, test_name) \
+ friend class test_case_name##_##test_name##_Test
+
+#endif
#define FRIEND_TEST_ALL_PREFIXES(test_case_name, test_name) \
FRIEND_TEST(test_case_name, test_name); \