summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormostynb <mostynb@opera.com>2014-12-23 01:02:43 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-23 09:03:34 +0000
commit3a46e0bf9308a42642689c4b73b6b8622aeecbe5 (patch)
tree6af2d11124f5c7f992c4a669cabbaf0e3b61e563
parent4e068052de57e692e4104d7974ff17e7788405fc (diff)
downloadchromium_src-3a46e0bf9308a42642689c4b73b6b8622aeecbe5.zip
chromium_src-3a46e0bf9308a42642689c4b73b6b8622aeecbe5.tar.gz
chromium_src-3a46e0bf9308a42642689c4b73b6b8622aeecbe5.tar.bz2
replace COMPILE_ASSERT with static_assert in chrome/browser/
BUG=442514 Review URL: https://codereview.chromium.org/815363002 Cr-Commit-Position: refs/heads/master@{#309547}
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover.cc4
-rw-r--r--chrome/browser/chrome_browser_main_mac.mm4
-rw-r--r--chrome/browser/chromeos/drive/resource_metadata_storage.cc4
-rw-r--r--chrome/browser/chromeos/login/wizard_controller_browsertest.cc4
-rw-r--r--chrome/browser/chromeos/policy/consumer_management_service.cc4
-rw-r--r--chrome/browser/component_updater/widevine_cdm_component_installer.cc4
-rw-r--r--chrome/browser/diagnostics/diagnostics_metrics.cc4
-rw-r--r--chrome/browser/download/download_item_model_unittest.cc10
-rw-r--r--chrome/browser/extensions/api/alarms/alarms_api.cc6
-rw-r--r--chrome/browser/extensions/api/content_settings/content_settings_helpers.cc12
-rw-r--r--chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc10
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api.cc8
-rw-r--r--chrome/browser/extensions/api/messaging/native_message_process_host.cc3
-rw-r--r--chrome/browser/extensions/api/proxy/proxy_api_constants.cc14
-rw-r--r--chrome/browser/extensions/api/proxy/proxy_api_helpers.cc7
-rw-r--r--chrome/browser/extensions/api/web_request/web_request_api_unittest.cc5
-rw-r--r--chrome/browser/external_extension_browsertest.cc4
-rw-r--r--chrome/browser/history/visit_tracker.cc4
-rw-r--r--chrome/browser/internal_auth.cc11
-rw-r--r--chrome/browser/mac/relauncher.cc8
-rw-r--r--chrome/browser/predictors/autocomplete_action_predictor.cc6
-rw-r--r--chrome/browser/prefs/proxy_prefs.cc4
-rw-r--r--chrome/browser/prerender/prerender_events.cc4
-rw-r--r--chrome/browser/prerender/prerender_field_trial.cc18
-rw-r--r--chrome/browser/prerender/prerender_final_status.cc4
-rw-r--r--chrome/browser/prerender/prerender_link_manager.cc8
-rw-r--r--chrome/browser/prerender/prerender_local_predictor.cc4
-rw-r--r--chrome/browser/prerender/prerender_origin.cc4
-rw-r--r--chrome/browser/profile_resetter/profile_resetter.h4
-rw-r--r--chrome/browser/profile_resetter/profile_resetter_unittest.cc4
-rw-r--r--chrome/browser/profile_resetter/resettable_settings_snapshot.cc8
-rw-r--r--chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc40
-rw-r--r--chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc4
-rw-r--r--chrome/browser/signin/signin_error_notifier_ash_unittest.cc4
-rw-r--r--chrome/browser/signin/signin_global_error_unittest.cc4
-rw-r--r--chrome/browser/sync/profile_sync_service.cc3
-rw-r--r--chrome/browser/sync/test/integration/performance/typed_urls_sync_perf_test.cc4
-rw-r--r--chrome/browser/themes/browser_theme_pack.cc4
-rw-r--r--chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc4
-rw-r--r--chrome/browser/ui/tabs/tab_utils.cc4
-rw-r--r--chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc5
-rw-r--r--chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc5
-rw-r--r--chrome/browser/ui/website_settings/website_settings_ui.cc25
43 files changed, 158 insertions, 146 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index 71cd23a..1f72547 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -273,11 +273,11 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
}
// If this fires, we added a new BrowsingDataHelper::OriginSetMask without
// updating the user metrics above.
- COMPILE_ASSERT(
+ static_assert(
BrowsingDataHelper::ALL == (BrowsingDataHelper::UNPROTECTED_WEB |
BrowsingDataHelper::PROTECTED_WEB |
BrowsingDataHelper::EXTENSION),
- forgotten_to_add_origin_mask_type);
+ "OriginSetMask has been updated without updating user metrics");
if ((remove_mask & REMOVE_HISTORY) && may_delete_history) {
HistoryService* history_service = HistoryServiceFactory::GetForProfile(
diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm
index 2dc68c8..11aa996 100644
--- a/chrome/browser/chrome_browser_main_mac.mm
+++ b/chrome/browser/chrome_browser_main_mac.mm
@@ -141,8 +141,8 @@ void RecordCatSixtyFour() {
// some headroom and then leave it alone. See UMA_HISTOGRAM_ENUMERATION in
// base/metrics/histogram.h.
const int kMaxCatsAndSixtyFours = 32;
- COMPILE_ASSERT(kMaxCatsAndSixtyFours >= CAT_SIXTY_FOUR_MAX,
- CatSixtyFour_enum_grew_too_large);
+ static_assert(kMaxCatsAndSixtyFours >= CAT_SIXTY_FOUR_MAX,
+ "kMaxCatsAndSixtyFours is too large");
UMA_HISTOGRAM_ENUMERATION("OSX.CatSixtyFour",
cat_sixty_four,
diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage.cc b/chrome/browser/chromeos/drive/resource_metadata_storage.cc
index c5bc887..249d388 100644
--- a/chrome/browser/chromeos/drive/resource_metadata_storage.cc
+++ b/chrome/browser/chromeos/drive/resource_metadata_storage.cc
@@ -242,9 +242,9 @@ bool ResourceMetadataStorage::Iterator::HasError() const {
bool ResourceMetadataStorage::UpgradeOldDB(
const base::FilePath& directory_path) {
base::ThreadRestrictions::AssertIOAllowed();
- COMPILE_ASSERT(
+ static_assert(
kDBVersion == 13,
- db_version_and_this_function_should_be_updated_at_the_same_time);
+ "database version and this function must be updated at the same time");
const base::FilePath resource_map_path =
directory_path.Append(kResourceMapDBName);
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
index a6bf6a3..92d8df2 100644
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -1229,7 +1229,7 @@ IN_PROC_BROWSER_TEST_F(WizardControllerOobeResumeTest,
// TODO(dzhioev): Add tests for controller/host pairing flow.
// http://crbug.com/375191
-COMPILE_ASSERT(BaseScreenDelegate::EXIT_CODES_COUNT == 24,
- add_tests_for_new_control_flow_you_just_introduced);
+static_assert(BaseScreenDelegate::EXIT_CODES_COUNT == 24,
+ "tests for new control flow are missing");
} // namespace chromeos
diff --git a/chrome/browser/chromeos/policy/consumer_management_service.cc b/chrome/browser/chromeos/policy/consumer_management_service.cc
index 4caff08..2e64d9b 100644
--- a/chrome/browser/chromeos/policy/consumer_management_service.cc
+++ b/chrome/browser/chromeos/policy/consumer_management_service.cc
@@ -32,9 +32,9 @@ const char* const kStatusString[] = {
"StatusUnenrolling",
};
-COMPILE_ASSERT(
+static_assert(
arraysize(kStatusString) == policy::ConsumerManagementService::STATUS_LAST,
- "invalid kStatusString array size.");
+ "invalid kStatusString array size");
} // namespace
diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
index 66698f3..811321c 100644
--- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc
+++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc
@@ -83,8 +83,8 @@ const char kWidevineCdmArch[] =
// All values that are lists are delimited by commas. No trailing commas.
// For example, "1,2,4".
const char kCdmValueDelimiter = ',';
-COMPILE_ASSERT(kCdmValueDelimiter == kCdmSupportedCodecsValueDelimiter,
- cdm_delimiters_do_not_match);
+static_assert(kCdmValueDelimiter == kCdmSupportedCodecsValueDelimiter,
+ "cdm delimiters must match");
// The following entries are required.
// Interface versions are lists of integers (e.g. "1" or "1,2,4").
// These are checked in this file before registering the CDM.
diff --git a/chrome/browser/diagnostics/diagnostics_metrics.cc b/chrome/browser/diagnostics/diagnostics_metrics.cc
index 51d4769..eea8278 100644
--- a/chrome/browser/diagnostics/diagnostics_metrics.cc
+++ b/chrome/browser/diagnostics/diagnostics_metrics.cc
@@ -53,8 +53,8 @@ const TestNameInfo kTestNameInfo[] = {
// Add new entries in the same order as DiagnosticsTestId.
};
-COMPILE_ASSERT(arraysize(kTestNameInfo) == DIAGNOSTICS_TEST_ID_COUNT,
- diagnostics_test_info_mismatch);
+static_assert(arraysize(kTestNameInfo) == DIAGNOSTICS_TEST_ID_COUNT,
+ "diagnostics test info mismatch");
const TestNameInfo* FindTestInfo(DiagnosticsTestId id) {
DCHECK(id < DIAGNOSTICS_TEST_ID_COUNT);
diff --git a/chrome/browser/download/download_item_model_unittest.cc b/chrome/browser/download/download_item_model_unittest.cc
index 25bdfe4..b7cd6ad 100644
--- a/chrome/browser/download/download_item_model_unittest.cc
+++ b/chrome/browser/download/download_item_model_unittest.cc
@@ -31,7 +31,7 @@ using ::testing::_;
namespace {
// Create a char array that has as many elements as there are download
-// interrupt reasons. We can then use that in a COMPILE_ASSERT to make sure
+// interrupt reasons. We can then use that in a static_assert to make sure
// that all the interrupt reason codes are accounted for. The reason codes are
// unfortunately sparse, making this necessary.
char kInterruptReasonCounter[] = {
@@ -170,8 +170,8 @@ TEST_F(DownloadItemModelTest, InterruptedStatus) {
{ content::DOWNLOAD_INTERRUPT_REASON_CRASH,
"Failed - Crash" },
};
- COMPILE_ASSERT(kInterruptReasonCount == arraysize(kTestCases),
- interrupt_reason_mismatch);
+ static_assert(kInterruptReasonCount == arraysize(kTestCases),
+ "interrupt reason mismatch");
SetupDownloadItemDefaults();
for (unsigned i = 0; i < arraysize(kTestCases); ++i) {
@@ -246,8 +246,8 @@ TEST_F(DownloadItemModelTest, InterruptTooltip) {
{ content::DOWNLOAD_INTERRUPT_REASON_CRASH,
"foo.bar\nCrash" },
};
- COMPILE_ASSERT(kInterruptReasonCount == arraysize(kTestCases),
- interrupt_reason_mismatch);
+ static_assert(kInterruptReasonCount == arraysize(kTestCases),
+ "interrupt reason mismatch");
// Large tooltip width. Should be large enough to accommodate the entire
// tooltip without truncation.
diff --git a/chrome/browser/extensions/api/alarms/alarms_api.cc b/chrome/browser/extensions/api/alarms/alarms_api.cc
index 9a80a49..9ac6ab2 100644
--- a/chrome/browser/extensions/api/alarms/alarms_api.cc
+++ b/chrome/browser/extensions/api/alarms/alarms_api.cc
@@ -51,7 +51,8 @@ bool ValidateAlarmCreateInfo(const std::string& alarm_name,
// relative delays that are shorter than we'll honor.
if (create_info.delay_in_minutes.get()) {
if (*create_info.delay_in_minutes < kReleaseDelayMinimum) {
- COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below);
+ static_assert(kReleaseDelayMinimum == 1,
+ "warning message must be updated");
if (Manifest::IsUnpackedLocation(extension->location()))
warnings->push_back(ErrorUtils::FormatErrorMessage(
"Alarm delay is less than minimum of 1 minutes."
@@ -67,7 +68,8 @@ bool ValidateAlarmCreateInfo(const std::string& alarm_name,
}
if (create_info.period_in_minutes.get()) {
if (*create_info.period_in_minutes < kReleaseDelayMinimum) {
- COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below);
+ static_assert(kReleaseDelayMinimum == 1,
+ "warning message must be updated");
if (Manifest::IsUnpackedLocation(extension->location()))
warnings->push_back(ErrorUtils::FormatErrorMessage(
"Alarm period is less than minimum of 1 minutes."
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
index 6601abd..7fc2e85 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_helpers.cc
@@ -26,9 +26,9 @@ const char* const kContentSettingsTypeNames[] = {
"location",
"notifications",
};
-COMPILE_ASSERT(arraysize(kContentSettingsTypeNames) <=
- CONTENT_SETTINGS_NUM_TYPES,
- content_settings_type_names_size_invalid);
+static_assert(arraysize(kContentSettingsTypeNames) <=
+ CONTENT_SETTINGS_NUM_TYPES,
+ "kContentSettingsTypeNames has an unexpected number of elements");
const char* const kContentSettingNames[] = {
"default",
@@ -37,9 +37,9 @@ const char* const kContentSettingNames[] = {
"ask",
"session_only",
};
-COMPILE_ASSERT(arraysize(kContentSettingNames) <=
- CONTENT_SETTING_NUM_SETTINGS,
- content_setting_names_size_invalid);
+static_assert(arraysize(kContentSettingNames) <=
+ CONTENT_SETTING_NUM_SETTINGS,
+ "kContentSettingNames has an unexpected number of elements");
// TODO(bauerb): Move this someplace where it can be reused.
std::string GetDefaultPort(const std::string& scheme) {
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
index 4474755..e096f6d 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
@@ -644,10 +644,12 @@ TEST_F(WebRequestRulesRegistryTest, GetMatchesDifferentUrls) {
};
// Which rules should match in subsequent test iterations.
const char* const matchingRuleIds[] = { kRuleId1, kRuleId2 };
- COMPILE_ASSERT(arraysize(urls) == arraysize(firstPartyUrls),
- urls_and_firstPartyUrls_need_to_have_the_same_size);
- COMPILE_ASSERT(arraysize(urls) == arraysize(matchingRuleIds),
- urls_and_matchingRuleIds_need_to_have_the_same_size);
+ static_assert(arraysize(urls) == arraysize(firstPartyUrls),
+ "urls and firstPartyUrls must have the same number "
+ "of elements");
+ static_assert(arraysize(urls) == arraysize(matchingRuleIds),
+ "urls and matchingRuleIds must have the same number "
+ "of elements");
net::TestURLRequestContext context;
for (size_t i = 0; i < arraysize(matchingRuleIds); ++i) {
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc
index 2129437..d20aa8c 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc
@@ -178,8 +178,8 @@ const char* const kDangerStrings[] = {
kDangerHost,
kDangerUnwanted
};
-COMPILE_ASSERT(arraysize(kDangerStrings) == content::DOWNLOAD_DANGER_TYPE_MAX,
- download_danger_type_enum_changed);
+static_assert(arraysize(kDangerStrings) == content::DOWNLOAD_DANGER_TYPE_MAX,
+ "kDangerStrings should have DOWNLOAD_DANGER_TYPE_MAX elements");
// Note: Any change to the state strings, should be accompanied by a
// corresponding change to downloads.json.
@@ -189,8 +189,8 @@ const char* const kStateStrings[] = {
kStateInterrupted,
kStateInterrupted,
};
-COMPILE_ASSERT(arraysize(kStateStrings) == DownloadItem::MAX_DOWNLOAD_STATE,
- download_item_state_enum_changed);
+static_assert(arraysize(kStateStrings) == DownloadItem::MAX_DOWNLOAD_STATE,
+ "kStateStrings should have MAX_DOWNLOAD_STATE elements");
const char* DangerString(content::DownloadDangerType danger) {
DCHECK(danger >= 0);
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
index c28b233..5a98ed8 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
@@ -153,7 +153,8 @@ void NativeMessageProcessHost::OnMessage(const std::string& json) {
new net::IOBufferWithSize(json.size() + kMessageHeaderSize);
// Copy size and content of the message to the buffer.
- COMPILE_ASSERT(sizeof(uint32) == kMessageHeaderSize, incorrect_header_size);
+ static_assert(sizeof(uint32) == kMessageHeaderSize,
+ "kMessageHeaderSize is incorrect");
*reinterpret_cast<uint32*>(buffer->data()) = json.size();
memcpy(buffer->data() + kMessageHeaderSize, json.data(), json.size());
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_constants.cc b/chrome/browser/extensions/api/proxy/proxy_api_constants.cc
index 3142b2f..0c1ee3a 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_constants.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_constants.cc
@@ -42,13 +42,13 @@ const char* const scheme_name[] = { "*error*",
"ftp",
"socks" };
-COMPILE_ASSERT(SCHEME_MAX == SCHEME_FALLBACK,
- SCHEME_MAX_must_equal_SCHEME_FALLBACK);
-COMPILE_ASSERT(arraysize(field_name) == SCHEME_MAX + 1,
- field_name_array_is_wrong_size);
-COMPILE_ASSERT(arraysize(scheme_name) == SCHEME_MAX + 1,
- scheme_name_array_is_wrong_size);
-COMPILE_ASSERT(SCHEME_ALL == 0, singleProxy_must_be_first_option);
+static_assert(SCHEME_MAX == SCHEME_FALLBACK,
+ "SCHEME_MAX is incorrect");
+static_assert(arraysize(field_name) == SCHEME_MAX + 1,
+ "field_name array size is incorrect");
+static_assert(arraysize(scheme_name) == SCHEME_MAX + 1,
+ "scheme_name array size is incorrect");
+static_assert(SCHEME_ALL == 0, "SCHEME_ALL must be the first value");
} // namespace proxy_api_constants
} // namespace extensions
diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
index 64a4282..54f9357 100644
--- a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
+++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc
@@ -220,7 +220,7 @@ bool GetProxyRulesStringFromExtensionPref(
}
}
- COMPILE_ASSERT(keys::SCHEME_ALL == 0, singleProxy_must_be_first_option);
+ static_assert(keys::SCHEME_ALL == 0, "SCHEME_ALL must be the first value");
// Handle case that only singleProxy is specified.
if (has_proxy[keys::SCHEME_ALL]) {
@@ -409,9 +409,10 @@ base::DictionaryValue* CreateProxyRulesDict(
break;
}
- // If we add a new scheme some time, we need to also store a new dictionary
+ // If we add a new scheme sometime, we need to also store a new dictionary
// representing this scheme in the code above.
- COMPILE_ASSERT(keys::SCHEME_MAX == 4, SCHEME_FORGOTTEN);
+ static_assert(keys::SCHEME_MAX == 4,
+ "rules need to be updated along with schemes");
if (proxy_config.HasBypassList()) {
std::string bypass_list_string;
diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
index 26d0867..c867fab 100644
--- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc
@@ -603,8 +603,9 @@ TEST_F(ExtensionWebRequestTest, AccessRequestBodyData) {
&raw,
&raw,
};
- COMPILE_ASSERT(arraysize(kPath) == arraysize(kExpected),
- the_arrays_kPath_and_kExpected_need_to_be_the_same_size);
+ static_assert(arraysize(kPath) == arraysize(kExpected),
+ "kPath and kExpected arrays should have the same number "
+ "of elements");
// Header.
const char kMultipart[] = "multipart/form-data; boundary=" kBoundary;
#undef kBoundary
diff --git a/chrome/browser/external_extension_browsertest.cc b/chrome/browser/external_extension_browsertest.cc
index 9728727..a2f18de 100644
--- a/chrome/browser/external_extension_browsertest.cc
+++ b/chrome/browser/external_extension_browsertest.cc
@@ -106,8 +106,8 @@ IN_PROC_BROWSER_TEST_F(SearchProviderTest,
const char* expected_results[] = { "2",
"1",
"0" };
- COMPILE_ASSERT(arraysize(test_hosts) == arraysize(expected_results),
- there_should_be_a_result_for_each_host);
+ static_assert(arraysize(test_hosts) == arraysize(expected_results),
+ "each host should have a test result");
IsSearchProviderTestData test_data[2 * arraysize(test_hosts)];
// Start results for the normal mode.
diff --git a/chrome/browser/history/visit_tracker.cc b/chrome/browser/history/visit_tracker.cc
index fe06075..c541d87 100644
--- a/chrome/browser/history/visit_tracker.cc
+++ b/chrome/browser/history/visit_tracker.cc
@@ -13,8 +13,8 @@ namespace history {
// the data rather than constantly shuffle stuff around in the vector.
static const size_t kMaxItemsInTransitionList = 96;
static const size_t kResizeBigTransitionListTo = 64;
-COMPILE_ASSERT(kResizeBigTransitionListTo < kMaxItemsInTransitionList,
- max_items_must_be_larger_than_resize_to);
+static_assert(kResizeBigTransitionListTo < kMaxItemsInTransitionList,
+ "maxium number of items must be larger than we are resizing to");
VisitTracker::VisitTracker() {
}
diff --git a/chrome/browser/internal_auth.cc b/chrome/browser/internal_auth.cc
index acdd442..4286011 100644
--- a/chrome/browser/internal_auth.cc
+++ b/chrome/browser/internal_auth.cc
@@ -37,10 +37,11 @@ const int kVerificationWindowTicks = 2000;
const int kGenerationWindowTicks = 20;
// Makes no sense to compare other way round.
-COMPILE_ASSERT(kGenerationWindowTicks <= kVerificationWindowTicks,
- makes_no_sense_to_have_generation_window_larger_than_verification_one);
+static_assert(kGenerationWindowTicks <= kVerificationWindowTicks,
+ "generation window should not be larger than the verification window");
// We are not optimized for high value of kGenerationWindowTicks.
-COMPILE_ASSERT(kGenerationWindowTicks < 30, too_large_generation_window);
+static_assert(kGenerationWindowTicks < 30,
+ "generation window should not be too large");
// Regenerate key after this number of ticks.
const int kKeyRegenerationSoftTicks = 500000;
@@ -99,8 +100,8 @@ bool IsVarSane(const std::string& var) {
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
"_";
- COMPILE_ASSERT(
- sizeof(kAllowedChars) == 26 + 26 + 10 + 1 + 1, some_mess_with_chars);
+ static_assert(
+ sizeof(kAllowedChars) == 26 + 26 + 10 + 1 + 1, "some mess with chars");
// We must not allow kItemSeparator in anything used as an input to construct
// message to sign.
DCHECK(std::find(kAllowedChars, kAllowedChars + arraysize(kAllowedChars),
diff --git a/chrome/browser/mac/relauncher.cc b/chrome/browser/mac/relauncher.cc
index 0a00609..48b94a9 100644
--- a/chrome/browser/mac/relauncher.cc
+++ b/chrome/browser/mac/relauncher.cc
@@ -139,10 +139,10 @@ bool RelaunchAppWithHelper(const std::string& helper,
// Make sure kRelauncherSyncFD is a safe value. base::LaunchProcess will
// preserve these three FDs in forked processes, so kRelauncherSyncFD should
// not conflict with them.
- COMPILE_ASSERT(kRelauncherSyncFD != STDIN_FILENO &&
- kRelauncherSyncFD != STDOUT_FILENO &&
- kRelauncherSyncFD != STDERR_FILENO,
- kRelauncherSyncFD_must_not_conflict_with_stdio_fds);
+ static_assert(kRelauncherSyncFD != STDIN_FILENO &&
+ kRelauncherSyncFD != STDOUT_FILENO &&
+ kRelauncherSyncFD != STDERR_FILENO,
+ "kRelauncherSyncFD must not conflict with stdio fds");
base::FileHandleMappingVector fd_map;
fd_map.push_back(std::make_pair(pipe_write_fd.get(), kRelauncherSyncFD));
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc
index ff7b0fe..b5e3aa8 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc
@@ -44,9 +44,9 @@ const float kConfidenceCutoff[] = {
0.5f
};
-COMPILE_ASSERT(arraysize(kConfidenceCutoff) ==
- predictors::AutocompleteActionPredictor::LAST_PREDICT_ACTION,
- ConfidenceCutoff_count_mismatch);
+static_assert(arraysize(kConfidenceCutoff) ==
+ predictors::AutocompleteActionPredictor::LAST_PREDICT_ACTION,
+ "kConfidenceCutoff count should match LAST_PREDICT_ACTION");
const size_t kMinimumUserTextLength = 1;
const int kMinimumNumberOfHits = 3;
diff --git a/chrome/browser/prefs/proxy_prefs.cc b/chrome/browser/prefs/proxy_prefs.cc
index 3a06a2b..04785ec 100644
--- a/chrome/browser/prefs/proxy_prefs.cc
+++ b/chrome/browser/prefs/proxy_prefs.cc
@@ -19,8 +19,8 @@ const char* kProxyModeNames[] = { kDirectProxyModeName,
kFixedServersProxyModeName,
kSystemProxyModeName };
-COMPILE_ASSERT(arraysize(kProxyModeNames) == kModeCount,
- kProxyModeNames_must_have_size_of_NUM_MODES);
+static_assert(arraysize(kProxyModeNames) == kModeCount,
+ "kProxyModeNames must have kModeCount elements");
} // namespace
diff --git a/chrome/browser/prerender/prerender_events.cc b/chrome/browser/prerender/prerender_events.cc
index 5e8389d..a7ac644 100644
--- a/chrome/browser/prerender/prerender_events.cc
+++ b/chrome/browser/prerender/prerender_events.cc
@@ -38,8 +38,8 @@ const char* kEventNames[] = {
"Max",
};
-COMPILE_ASSERT(arraysize(kEventNames) == PRERENDER_EVENT_MAX + 1,
- PrerenderEvent_name_count_mismatch);
+static_assert(arraysize(kEventNames) == PRERENDER_EVENT_MAX + 1,
+ "kEventNames array size is incorrect");
} // namespace
diff --git a/chrome/browser/prerender/prerender_field_trial.cc b/chrome/browser/prerender/prerender_field_trial.cc
index 468d44b..d505582 100644
--- a/chrome/browser/prerender/prerender_field_trial.cc
+++ b/chrome/browser/prerender/prerender_field_trial.cc
@@ -105,14 +105,14 @@ void SetupPrerenderFieldTrial() {
const FieldTrial::Probability release_experiment_no_use_probability = 0;
const FieldTrial::Probability
release_experiment_match_complete_probability = 10;
- COMPILE_ASSERT(
+ static_assert(
release_prerender_enabled_probability +
release_control_probability +
release_experiment_multi_prerender_probability +
release_experiment_15min_ttl_probability +
release_experiment_no_use_probability +
release_experiment_match_complete_probability == divisor,
- release_experiment_probabilities_must_equal_divisor);
+ "release experiment probabilities must equal divisor");
control_probability = release_control_probability;
experiment_multi_prerender_probability =
@@ -132,13 +132,13 @@ void SetupPrerenderFieldTrial() {
const FieldTrial::Probability dev_experiment_no_use_probability = 100;
const FieldTrial::Probability
dev_experiment_match_complete_probability = 200;
- COMPILE_ASSERT(dev_prerender_enabled_probability +
- dev_control_probability +
- dev_experiment_multi_prerender_probability +
- dev_experiment_15min_ttl_probability +
- dev_experiment_no_use_probability +
- dev_experiment_match_complete_probability == divisor,
- dev_experiment_probabilities_must_equal_divisor);
+ static_assert(dev_prerender_enabled_probability +
+ dev_control_probability +
+ dev_experiment_multi_prerender_probability +
+ dev_experiment_15min_ttl_probability +
+ dev_experiment_no_use_probability +
+ dev_experiment_match_complete_probability == divisor,
+ "dev experiment probabilities must equal divisor");
control_probability = dev_control_probability;
experiment_multi_prerender_probability =
diff --git a/chrome/browser/prerender/prerender_final_status.cc b/chrome/browser/prerender/prerender_final_status.cc
index eae02a6..3c7e8f9 100644
--- a/chrome/browser/prerender/prerender_final_status.cc
+++ b/chrome/browser/prerender/prerender_final_status.cc
@@ -65,8 +65,8 @@ const char* kFinalStatusNames[] = {
"Navigation Intercepted",
"Max",
};
-COMPILE_ASSERT(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1,
- PrerenderFinalStatus_name_count_mismatch);
+static_assert(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1,
+ "status name count mismatch");
} // namespace
diff --git a/chrome/browser/prerender/prerender_link_manager.cc b/chrome/browser/prerender/prerender_link_manager.cc
index 21a1dac..8120577 100644
--- a/chrome/browser/prerender/prerender_link_manager.cc
+++ b/chrome/browser/prerender/prerender_link_manager.cc
@@ -60,10 +60,10 @@ bool ShouldStartPrerender(const uint32 rel_types) {
return false;
}
-COMPILE_ASSERT(PrerenderRelTypePrerender == 0x1,
- RelTypeHistogramEnum_must_match_PrerenderRelType);
-COMPILE_ASSERT(PrerenderRelTypeNext == 0x2,
- RelTypeHistogramEnum_must_match_PrerenderRelType);
+static_assert(PrerenderRelTypePrerender == 0x1,
+ "RelTypeHistogrameEnum must match PrerenderRelType");
+static_assert(PrerenderRelTypeNext == 0x2,
+ "RelTypeHistogramEnum must match PrerenderRelType");
enum RelTypeHistogramEnum {
RelTypeHistogramEnumNone = 0,
RelTypeHistogramEnumPrerender = PrerenderRelTypePrerender,
diff --git a/chrome/browser/prerender/prerender_local_predictor.cc b/chrome/browser/prerender/prerender_local_predictor.cc
index 3516d95..1da0f04 100644
--- a/chrome/browser/prerender/prerender_local_predictor.cc
+++ b/chrome/browser/prerender/prerender_local_predictor.cc
@@ -307,14 +307,14 @@ bool IsLogOutURL(const GURL& url) {
}
int64 URLHashToInt64(const unsigned char* data) {
- COMPILE_ASSERT(kURLHashSize < sizeof(int64), url_hash_must_fit_in_int64);
+ static_assert(kURLHashSize < sizeof(int64), "url hash must fit in int64");
int64 value = 0;
memcpy(&value, data, kURLHashSize);
return value;
}
int64 GetInt64URLHashForURL(const GURL& url) {
- COMPILE_ASSERT(kURLHashSize < sizeof(int64), url_hash_must_fit_in_int64);
+ static_assert(kURLHashSize < sizeof(int64), "url hash must fit in int64");
scoped_ptr<crypto::SecureHash> hash(
crypto::SecureHash::Create(crypto::SecureHash::SHA256));
int64 hash_value = 0;
diff --git a/chrome/browser/prerender/prerender_origin.cc b/chrome/browser/prerender/prerender_origin.cc
index 56e6c07..ae8d9ac 100644
--- a/chrome/browser/prerender/prerender_origin.cc
+++ b/chrome/browser/prerender/prerender_origin.cc
@@ -28,8 +28,8 @@ const char* kOriginNames[] = {
"Link Rel Next",
"Max",
};
-COMPILE_ASSERT(arraysize(kOriginNames) == ORIGIN_MAX + 1,
- PrerenderOrigin_name_count_mismatch);
+static_assert(arraysize(kOriginNames) == ORIGIN_MAX + 1,
+ "prerender origin name count mismatch");
} // namespace
diff --git a/chrome/browser/profile_resetter/profile_resetter.h b/chrome/browser/profile_resetter/profile_resetter.h
index 2df678f..b4044fa 100644
--- a/chrome/browser/profile_resetter/profile_resetter.h
+++ b/chrome/browser/profile_resetter/profile_resetter.h
@@ -52,8 +52,8 @@ class ProfileResetter : public base::NonThreadSafe,
// Bit vector for Resettable enum.
typedef uint32 ResettableFlags;
- COMPILE_ASSERT(sizeof(ResettableFlags) == sizeof(Resettable),
- type_ResettableFlags_doesnt_match_Resettable);
+ static_assert(sizeof(ResettableFlags) == sizeof(Resettable),
+ "ResettableFlags should be the same size as Resettable");
explicit ProfileResetter(Profile* profile);
~ProfileResetter() override;
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index b34d6be..e60f96b 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -967,8 +967,8 @@ TEST_F(ProfileResetterTest, FeedbackSerializationTest) {
// Let it enumerate shortcuts on the FILE thread.
base::MessageLoop::current()->RunUntilIdle();
- COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31,
- expand_this_test);
+ static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
+ "this test needs to be expanded");
for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS;
++field_mask) {
std::string report = SerializeSettingsReport(nonorganic_snap, field_mask);
diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
index fb58ee3..336a8a7 100644
--- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
+++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc
@@ -126,8 +126,8 @@ int ResettableSettingsSnapshot::FindDifferentFields(
if (shortcuts_ != snapshot.shortcuts_)
bit_mask |= SHORTCUTS;
- COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31,
- add_new_field_here);
+ static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
+ "new field needs to be added here");
return bit_mask;
}
@@ -211,8 +211,8 @@ std::string SerializeSettingsReport(const ResettableSettingsSnapshot& snapshot,
dict.Set(kShortcuts, list);
}
- COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31,
- serialize_new_field_here);
+ static_assert(ResettableSettingsSnapshot::ALL_FIELDS == 31,
+ "new field needs to be serialized here");
std::string json;
base::JSONWriter::Write(&dict, &json);
diff --git a/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc b/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc
index c80e929..c785071 100644
--- a/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc
+++ b/chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.cc
@@ -30,40 +30,40 @@ namespace chrome {
namespace {
#if defined(OS_CHROMEOS)
-COMPILE_ASSERT(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE) ==
+static_assert(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_NONE),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE);
-COMPILE_ASSERT(
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE value mismatch");
+static_assert(
static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_UNKNOWN),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN);
-COMPILE_ASSERT(
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN value mismatch");
+static_assert(
static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_INTERNAL),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL);
-COMPILE_ASSERT(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA) ==
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL value mismatch");
+static_assert(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_VGA),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA);
-COMPILE_ASSERT(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) ==
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA value mismatch");
+static_assert(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_HDMI),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI);
-COMPILE_ASSERT(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI) ==
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI value mismatch");
+static_assert(static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_DVI),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI);
-COMPILE_ASSERT(
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI value mismatch");
+static_assert(
static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_DISPLAYPORT),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT);
-COMPILE_ASSERT(
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT value mismatch");
+static_assert(
static_cast<int>(PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK) ==
static_cast<int>(ui::DISPLAY_CONNECTION_TYPE_NETWORK),
- PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK);
-COMPILE_ASSERT(static_cast<int>(PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE) ==
+ "PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK value mismatch");
+static_assert(static_cast<int>(PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE) ==
static_cast<int>(ui::CONTENT_PROTECTION_METHOD_NONE),
- PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE);
-COMPILE_ASSERT(static_cast<int>(PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP) ==
+ "PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE value mismatch");
+static_assert(static_cast<int>(PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP) ==
static_cast<int>(ui::CONTENT_PROTECTION_METHOD_HDCP),
- PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP);
+ "PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP value mismatch");
bool GetCurrentDisplayId(content::RenderFrameHost* rfh, int64* display_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
index ae2fe3c..e5ecf729 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
@@ -121,8 +121,8 @@ IncidentType GetIncidentType(
return VARIATIONS_SEED_SIGNATURE;
// Add detection for new incident types here.
- COMPILE_ASSERT(VARIATIONS_SEED_SIGNATURE + 1 == NUM_INCIDENT_TYPES,
- add_support_for_new_types);
+ static_assert(VARIATIONS_SEED_SIGNATURE + 1 == NUM_INCIDENT_TYPES,
+ "support for new types must be added");
NOTREACHED();
return NUM_INCIDENT_TYPES;
}
diff --git a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc
index 0f5b4f2..e49b489 100644
--- a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc
+++ b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc
@@ -236,8 +236,8 @@ TEST_F(SigninErrorNotifierTest, AuthStatusEnumerateAllErrors) {
{ GoogleServiceAuthError::SERVICE_ERROR, true },
{ GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true },
};
- COMPILE_ASSERT(arraysize(table) == GoogleServiceAuthError::NUM_STATES,
- kTable_size_does_not_match_number_of_auth_error_types);
+ static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES,
+ "table size should match number of auth error types");
for (size_t i = 0; i < arraysize(table); ++i) {
FakeAuthStatusProvider provider(error_controller_);
diff --git a/chrome/browser/signin/signin_global_error_unittest.cc b/chrome/browser/signin/signin_global_error_unittest.cc
index 94e3882..e34adb9 100644
--- a/chrome/browser/signin/signin_global_error_unittest.cc
+++ b/chrome/browser/signin/signin_global_error_unittest.cc
@@ -110,8 +110,8 @@ TEST_F(SigninGlobalErrorTest, AuthStatusEnumerateAllErrors) {
{ GoogleServiceAuthError::SERVICE_ERROR, true },
{ GoogleServiceAuthError::WEB_LOGIN_REQUIRED, true },
};
- COMPILE_ASSERT(arraysize(table) == GoogleServiceAuthError::NUM_STATES,
- kTable_size_does_not_match_number_of_auth_error_types);
+ static_assert(arraysize(table) == GoogleServiceAuthError::NUM_STATES,
+ "table size should match number of auth error types");
for (size_t i = 0; i < arraysize(table); ++i) {
FakeAuthStatusProvider provider(error_controller_);
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index b39380e..506ebe2a 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -1755,7 +1755,8 @@ void ProfileSyncService::UpdateSelectedTypesHistogram(
sync_driver::user_selectable_type::PROXY_TABS,
};
- COMPILE_ASSERT(34 == syncer::MODEL_TYPE_COUNT, UpdateCustomConfigHistogram);
+ static_assert(34 == syncer::MODEL_TYPE_COUNT,
+ "custom config histogram must be updated");
if (!sync_everything) {
const syncer::ModelTypeSet current_types = GetPreferredDataTypes();
diff --git a/chrome/browser/sync/test/integration/performance/typed_urls_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/typed_urls_sync_perf_test.cc
index 78396f0..ffed1e8 100644
--- a/chrome/browser/sync/test/integration/performance/typed_urls_sync_perf_test.cc
+++ b/chrome/browser/sync/test/integration/performance/typed_urls_sync_perf_test.cc
@@ -21,12 +21,12 @@ using typed_urls_helper::GetTypedUrlsFromClient;
static const int kNumUrls = 163;
// This compile assert basically asserts that kNumUrls is right in the
// middle between two multiples of kDefaultMaxCommitBatchSize.
-COMPILE_ASSERT(
+static_assert(
((kNumUrls % syncer::kDefaultMaxCommitBatchSize) >=
(syncer::kDefaultMaxCommitBatchSize / 2)) &&
((kNumUrls % syncer::kDefaultMaxCommitBatchSize) <=
((syncer::kDefaultMaxCommitBatchSize + 1) / 2)),
- kNumUrlsShouldBeBetweenTwoMultiplesOfkDefaultMaxCommitBatchSize);
+ "kNumUrls should be between two multiples of kDefaultMaxCommitBatchSize");
class TypedUrlsSyncPerfTest : public SyncTest {
public:
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index ab80732..b1c07b3 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -959,8 +959,8 @@ void BrowserThemePack::BuildHeader(const Extension* extension) {
// is that ui::DataPack removes this same check.
#if defined(__BYTE_ORDER)
// Linux check
- COMPILE_ASSERT(__BYTE_ORDER == __LITTLE_ENDIAN,
- datapack_assumes_little_endian);
+ static_assert(__BYTE_ORDER == __LITTLE_ENDIAN,
+ "datapack assumes little endian");
#elif defined(__BIG_ENDIAN__)
// Mac check
#error DataPack assumes little endian
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc
index a4a8850..fd0ab5b 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.cc
@@ -195,8 +195,8 @@ FullscreenControllerStateTest::FullscreenControllerStateTest()
STATE_TAB_FULLSCREEN, // Event WINDOW_CHANGE
},
};
- COMPILE_ASSERT(sizeof(transition_table_data) == sizeof(transition_table_),
- transition_table_incorrect_size);
+ static_assert(sizeof(transition_table_data) == sizeof(transition_table_),
+ "transition_table has unexpected size");
memcpy(transition_table_, transition_table_data,
sizeof(transition_table_data));
diff --git a/chrome/browser/ui/tabs/tab_utils.cc b/chrome/browser/ui/tabs/tab_utils.cc
index a619967..1f17621 100644
--- a/chrome/browser/ui/tabs/tab_utils.cc
+++ b/chrome/browser/ui/tabs/tab_utils.cc
@@ -62,8 +62,8 @@ double TabRecordingIndicatorAnimation::GetCurrentValue() const {
scoped_ptr<TabRecordingIndicatorAnimation>
TabRecordingIndicatorAnimation::Create() {
MultiAnimation::Parts parts;
- COMPILE_ASSERT(kCaptureIndicatorThrobCycles % 2 != 0,
- must_be_odd_so_animation_finishes_in_showing_state);
+ static_assert(kCaptureIndicatorThrobCycles % 2 != 0,
+ "odd number of cycles required so animation finishes in showing state");
for (int i = 0; i < kCaptureIndicatorThrobCycles; ++i) {
parts.push_back(MultiAnimation::Part(
i % 2 ? kIndicatorFadeOutDurationMs : kIndicatorFadeInDurationMs,
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
index 4588409..afa5ce6 100644
--- a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
@@ -223,8 +223,9 @@ InstalledBubbleContent::InstalledBubbleContent(
}
default: {
// When adding a new bubble type, the flavor needs to be set.
- COMPILE_ASSERT(ExtensionInstalledBubble::GENERIC == 3,
- kBubbleTypeEnumHasChangedButNotThisSwitchStatement);
+ static_assert(ExtensionInstalledBubble::GENERIC == 3,
+ "kBubbleType enum has changed, this switch statement must "
+ "be updateed");
break;
}
}
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 20a5cb4..8443bdc 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -1859,9 +1859,10 @@ const float kDeviceScaleFactorExpectations[] = {
1.0f,
};
-COMPILE_ASSERT(
+static_assert(
arraysize(kDragPoints) == arraysize(kDeviceScaleFactorExpectations),
- kDragPoints_and_kDeviceScaleFactorExpectations_must_have_same_size);
+ "kDragPoints and kDeviceScaleFactorExpectations must have the same "
+ "number of elements");
// Drags tab to |kDragPoints[index]|, then calls the next step function.
void CursorDeviceScaleFactorStep(
diff --git a/chrome/browser/ui/website_settings/website_settings_ui.cc b/chrome/browser/ui/website_settings/website_settings_ui.cc
index 1bd9168..05e7da8 100644
--- a/chrome/browser/ui/website_settings/website_settings_ui.cc
+++ b/chrome/browser/ui/website_settings/website_settings_ui.cc
@@ -24,9 +24,9 @@ const int kPermissionButtonTextIDPolicyManaged[] = {
kInvalidResourceID,
kInvalidResourceID,
kInvalidResourceID};
-COMPILE_ASSERT(arraysize(kPermissionButtonTextIDPolicyManaged) ==
- CONTENT_SETTING_NUM_SETTINGS,
- button_text_id_array_size_incorrect);
+static_assert(arraysize(kPermissionButtonTextIDPolicyManaged) ==
+ CONTENT_SETTING_NUM_SETTINGS,
+ "kPermissionButtonTextIDPolicyManaged array size is incorrect");
// The resource id's for the strings that are displayed on the permissions
// button if the permission setting is managed by an extension.
@@ -37,9 +37,10 @@ const int kPermissionButtonTextIDExtensionManaged[] = {
kInvalidResourceID,
kInvalidResourceID,
kInvalidResourceID};
-COMPILE_ASSERT(arraysize(kPermissionButtonTextIDExtensionManaged) ==
- CONTENT_SETTING_NUM_SETTINGS,
- button_text_id_array_size_incorrect);
+static_assert(arraysize(kPermissionButtonTextIDExtensionManaged) ==
+ CONTENT_SETTING_NUM_SETTINGS,
+ "kPermissionButtonTextIDExtensionManaged array size is "
+ "incorrect");
// The resource id's for the strings that are displayed on the permissions
// button if the permission setting is managed by the user.
@@ -50,9 +51,9 @@ const int kPermissionButtonTextIDUserManaged[] = {
kInvalidResourceID,
kInvalidResourceID,
kInvalidResourceID};
-COMPILE_ASSERT(arraysize(kPermissionButtonTextIDUserManaged) ==
- CONTENT_SETTING_NUM_SETTINGS,
- button_text_id_array_size_incorrect);
+static_assert(arraysize(kPermissionButtonTextIDUserManaged) ==
+ CONTENT_SETTING_NUM_SETTINGS,
+ "kPermissionButtonTextIDUserManaged array size is incorrect");
// The resource id's for the strings that are displayed on the permissions
// button if the permission setting is the global default setting.
@@ -63,9 +64,9 @@ const int kPermissionButtonTextIDDefaultSetting[] = {
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_ASK_BY_DEFAULT,
kInvalidResourceID,
IDS_WEBSITE_SETTINGS_BUTTON_TEXT_DETECT_IMPORTANT_CONTENT_BY_DEFAULT};
-COMPILE_ASSERT(arraysize(kPermissionButtonTextIDDefaultSetting) ==
- CONTENT_SETTING_NUM_SETTINGS,
- button_text_id_array_size_incorrect);
+static_assert(arraysize(kPermissionButtonTextIDDefaultSetting) ==
+ CONTENT_SETTING_NUM_SETTINGS,
+ "kPermissionButtonTextIDDefaultSetting array size is incorrect");
} // namespace