Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: content/child/appcache/appcache_frontend_impl.cc

Issue 847083002: replace COMPILE_ASSERT with static_assert in appcache_frontend_impl.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/appcache/appcache_frontend_impl.h" 5 #include "content/child/appcache/appcache_frontend_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/child/appcache/web_application_cache_host_impl.h" 8 #include "content/child/appcache/web_application_cache_host_impl.h"
9 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 9 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
10 10
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 void AppCacheFrontendImpl::OnContentBlocked(int host_id, 83 void AppCacheFrontendImpl::OnContentBlocked(int host_id,
84 const GURL& manifest_url) { 84 const GURL& manifest_url) {
85 WebApplicationCacheHostImpl* host = GetHost(host_id); 85 WebApplicationCacheHostImpl* host = GetHost(host_id);
86 if (host) 86 if (host)
87 host->OnContentBlocked(manifest_url); 87 host->OnContentBlocked(manifest_url);
88 } 88 }
89 89
90 // Ensure that enum values never get out of sync with the 90 // Ensure that enum values never get out of sync with the
91 // ones declared for use within the WebKit api 91 // ones declared for use within the WebKit api
92 COMPILE_ASSERT((int)WebApplicationCacheHost::Uncached ==
93 (int)APPCACHE_STATUS_UNCACHED, Uncached);
94 COMPILE_ASSERT((int)WebApplicationCacheHost::Idle ==
95 (int)APPCACHE_STATUS_IDLE, Idle);
96 COMPILE_ASSERT((int)WebApplicationCacheHost::Checking ==
97 (int)APPCACHE_STATUS_CHECKING, Checking);
98 COMPILE_ASSERT((int)WebApplicationCacheHost::Downloading ==
99 (int)APPCACHE_STATUS_DOWNLOADING, Downloading);
100 COMPILE_ASSERT((int)WebApplicationCacheHost::UpdateReady ==
101 (int)APPCACHE_STATUS_UPDATE_READY, UpdateReady);
102 COMPILE_ASSERT((int)WebApplicationCacheHost::Obsolete ==
103 (int)APPCACHE_STATUS_OBSOLETE, Obsolete);
104 92
105 COMPILE_ASSERT((int)WebApplicationCacheHost::CheckingEvent == 93 #define STATIC_ASSERT_ENUM(a, b, desc) \
106 (int)APPCACHE_CHECKING_EVENT, CheckingEvent); 94 static_assert((int)a == (int)b, desc)
107 COMPILE_ASSERT((int)WebApplicationCacheHost::ErrorEvent ==
108 (int)APPCACHE_ERROR_EVENT, ErrorEvent);
109 COMPILE_ASSERT((int)WebApplicationCacheHost::NoUpdateEvent ==
110 (int)APPCACHE_NO_UPDATE_EVENT, NoUpdateEvent);
111 COMPILE_ASSERT((int)WebApplicationCacheHost::DownloadingEvent ==
112 (int)APPCACHE_DOWNLOADING_EVENT, DownloadingEvent);
113 COMPILE_ASSERT((int)WebApplicationCacheHost::ProgressEvent ==
114 (int)APPCACHE_PROGRESS_EVENT, ProgressEvent);
115 COMPILE_ASSERT((int)WebApplicationCacheHost::UpdateReadyEvent ==
116 (int)APPCACHE_UPDATE_READY_EVENT, UpdateReadyEvent);
117 COMPILE_ASSERT((int)WebApplicationCacheHost::CachedEvent ==
118 (int)APPCACHE_CACHED_EVENT, CachedEvent);
119 COMPILE_ASSERT((int)WebApplicationCacheHost::ObsoleteEvent ==
120 (int)APPCACHE_OBSOLETE_EVENT, ObsoleteEvent);
121 95
122 COMPILE_ASSERT((int)WebConsoleMessage::LevelDebug == 96 // Confirm that WebApplicationCacheHost::<a> == APPCACHE_<b>.
123 (int)APPCACHE_LOG_DEBUG, LevelDebug); 97 #define STATIC_ASSERT_WAC_ENUM(a, b) \
124 COMPILE_ASSERT((int)WebConsoleMessage::LevelLog == 98 STATIC_ASSERT_ENUM(WebApplicationCacheHost:: a, APPCACHE_##b, #a)
125 (int)APPCACHE_LOG_INFO, LevelLog);
126 COMPILE_ASSERT((int)WebConsoleMessage::LevelWarning ==
127 (int)APPCACHE_LOG_WARNING, LevelWarning);
128 COMPILE_ASSERT((int)WebConsoleMessage::LevelError ==
129 (int)APPCACHE_LOG_ERROR, LevelError);
130 99
131 COMPILE_ASSERT((int)WebApplicationCacheHost::ManifestError == 100 STATIC_ASSERT_WAC_ENUM(Uncached, STATUS_UNCACHED);
132 (int)APPCACHE_MANIFEST_ERROR, 101 STATIC_ASSERT_WAC_ENUM(Idle, STATUS_IDLE);
133 ManifestError); 102 STATIC_ASSERT_WAC_ENUM(Checking, STATUS_CHECKING);
134 COMPILE_ASSERT((int)WebApplicationCacheHost::SignatureError == 103 STATIC_ASSERT_WAC_ENUM(Downloading, STATUS_DOWNLOADING);
135 (int)APPCACHE_SIGNATURE_ERROR, 104 STATIC_ASSERT_WAC_ENUM(UpdateReady, STATUS_UPDATE_READY);
136 SignatureError); 105 STATIC_ASSERT_WAC_ENUM(Obsolete, STATUS_OBSOLETE);
137 COMPILE_ASSERT((int)WebApplicationCacheHost::ResourceError == 106
138 (int)APPCACHE_RESOURCE_ERROR, 107 STATIC_ASSERT_WAC_ENUM(CheckingEvent, CHECKING_EVENT);
139 ResourceError); 108 STATIC_ASSERT_WAC_ENUM(ErrorEvent, ERROR_EVENT);
140 COMPILE_ASSERT((int)WebApplicationCacheHost::ChangedError == 109 STATIC_ASSERT_WAC_ENUM(NoUpdateEvent, NO_UPDATE_EVENT);
141 (int)APPCACHE_CHANGED_ERROR, 110 STATIC_ASSERT_WAC_ENUM(DownloadingEvent, DOWNLOADING_EVENT);
142 ChangedError); 111 STATIC_ASSERT_WAC_ENUM(ProgressEvent, PROGRESS_EVENT);
143 COMPILE_ASSERT((int)WebApplicationCacheHost::AbortError == 112 STATIC_ASSERT_WAC_ENUM(UpdateReadyEvent, UPDATE_READY_EVENT);
144 (int)APPCACHE_ABORT_ERROR, 113 STATIC_ASSERT_WAC_ENUM(CachedEvent, CACHED_EVENT);
145 AbortError); 114 STATIC_ASSERT_WAC_ENUM(ObsoleteEvent, OBSOLETE_EVENT);
146 COMPILE_ASSERT((int)WebApplicationCacheHost::QuotaError == 115
147 (int)APPCACHE_QUOTA_ERROR, 116 STATIC_ASSERT_WAC_ENUM(ManifestError, MANIFEST_ERROR);
148 QuotaError); 117 STATIC_ASSERT_WAC_ENUM(SignatureError, SIGNATURE_ERROR);
149 COMPILE_ASSERT((int)WebApplicationCacheHost::PolicyError == 118 STATIC_ASSERT_WAC_ENUM(ResourceError, RESOURCE_ERROR);
150 (int)APPCACHE_POLICY_ERROR, 119 STATIC_ASSERT_WAC_ENUM(ChangedError, CHANGED_ERROR);
151 PolicyError); 120 STATIC_ASSERT_WAC_ENUM(AbortError, ABORT_ERROR);
152 COMPILE_ASSERT((int)WebApplicationCacheHost::UnknownError == 121 STATIC_ASSERT_WAC_ENUM(QuotaError, QUOTA_ERROR);
153 (int)APPCACHE_UNKNOWN_ERROR, 122 STATIC_ASSERT_WAC_ENUM(PolicyError, POLICY_ERROR);
154 UnknownError); 123 STATIC_ASSERT_WAC_ENUM(UnknownError, UNKNOWN_ERROR);
124
125 // Confirm that WebConsoleMessage::<a> == APPCACHE_<b>.
126 #define STATIC_ASSERT_WCM_ENUM(a, b) \
127 STATIC_ASSERT_ENUM(WebConsoleMessage:: a, APPCACHE_##b, #a)
128
129 STATIC_ASSERT_WCM_ENUM(LevelDebug, LOG_DEBUG);
130 STATIC_ASSERT_WCM_ENUM(LevelLog, LOG_INFO);
131 STATIC_ASSERT_WCM_ENUM(LevelWarning, LOG_WARNING);
132 STATIC_ASSERT_WCM_ENUM(LevelError, LOG_ERROR);
155 133
156 } // namespace content 134 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698