diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 18:46:15 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 18:46:15 +0000 |
commit | 653dc46f668da5aed227aafe39ec66fada3df230 (patch) | |
tree | 8e727f8d7cfc758b8ca32a06947c161aea05d8fd /content/browser/load_from_memory_cache_details.h | |
parent | 59f994ca94ee8bcb4e87467eed3d3f50b358fd5a (diff) | |
download | chromium_src-653dc46f668da5aed227aafe39ec66fada3df230.zip chromium_src-653dc46f668da5aed227aafe39ec66fada3df230.tar.gz chromium_src-653dc46f668da5aed227aafe39ec66fada3df230.tar.bz2 |
For the SSL cert status, convert anonymous enum that gives bit values into a typedefed uint32. This allows code all over Chromium to use an explicit type instead of "int". (This isn't possible by simply naming the enum as technically the enum doesn't define all of the possible combinations of bits.) This also means the individual named bit constants themselves have the same explicit type. I find the resulting code to be noticeably clearer. This also exposed a bug in SSLErrorInfo::GetErrorsForCertStatus() where not having an explicit type allowed a function argument ordering bug to creep in, so I claim this is safer too.
I also added CERT_STATUS_NO_ERROR in place of "0" as a magic number.
Normally this makes things like DCHECK_EQ() unhappy, but when I'd originally tested this I didn't seem to need to make any changes due to that. Will be watching the trybots...
The original motiviation for this change was to find a way to eliminate some cases of passing anonymous-typed values as template arguments (which happens when you use a value from the enum in e.g. EXPECT_EQ()), which is technically illegal in C++03, though we don't warn about it. Simply naming the enum would have done this, but this would have encouraged readers to actually use the enum name as a type, which for a bitfield is inappropriate for the reason given in the first paragraph.
BUG=92247
TEST=Compiles
Review URL: http://codereview.chromium.org/7819009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/load_from_memory_cache_details.h')
-rw-r--r-- | content/browser/load_from_memory_cache_details.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/content/browser/load_from_memory_cache_details.h b/content/browser/load_from_memory_cache_details.h index 0689792..4524014 100644 --- a/content/browser/load_from_memory_cache_details.h +++ b/content/browser/load_from_memory_cache_details.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "googleurl/src/gurl.h" +#include "net/base/cert_status_flags.h" class LoadFromMemoryCacheDetails { public: @@ -15,19 +16,19 @@ class LoadFromMemoryCacheDetails { const GURL& url, int pid, int cert_id, - int cert_status); + net::CertStatus cert_status); ~LoadFromMemoryCacheDetails(); const GURL& url() const { return url_; } int pid() const { return pid_; } int ssl_cert_id() const { return cert_id_; } - int ssl_cert_status() const { return cert_status_; } + net::CertStatus ssl_cert_status() const { return cert_status_; } private: GURL url_; int pid_; int cert_id_; - int cert_status_; + net::CertStatus cert_status_; DISALLOW_COPY_AND_ASSIGN(LoadFromMemoryCacheDetails); }; |