summaryrefslogtreecommitdiffstats
path: root/ipc/file_descriptor_set_posix.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 00:50:13 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-01 00:50:13 +0000
commit05094a3fd1209ad3c5fa5c92c78694da589b9448 (patch)
tree59eab02505b51bcff2c1a48ea097de85befbfaef /ipc/file_descriptor_set_posix.h
parentd643172a8573e7e75f325bec2125de8071bfd0fc (diff)
downloadchromium_src-05094a3fd1209ad3c5fa5c92c78694da589b9448.zip
chromium_src-05094a3fd1209ad3c5fa5c92c78694da589b9448.tar.gz
chromium_src-05094a3fd1209ad3c5fa5c92c78694da589b9448.tar.bz2
Convert some constants declared as anonymous enums into static consts so they have types. This defines the constants where they're declared to preserve the existing readability as well as allow us to do things like dimension arrays based on the values of the constants.
The drawback to defining constants at their declaration point is that supplying them to a templated function, like what DCHECK_EQ() expands into, triggers an "undefined symbol" error on Mac/Linux (and adding explicit storage for them in the .cc file can cause duplicate symbol errors on Windows). Here I've worked around that by converting DCHECK_EQ(a, b) to DCHECK(b == a). 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 in general naming enums used to declare constants like this is bizarre ("enum Constants { ... }"?). BUG=92247 TEST=Compiles Review URL: http://codereview.chromium.org/7817005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/file_descriptor_set_posix.h')
-rw-r--r--ipc/file_descriptor_set_posix.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/ipc/file_descriptor_set_posix.h b/ipc/file_descriptor_set_posix.h
index 1554c38..f7d4ad0 100644
--- a/ipc/file_descriptor_set_posix.h
+++ b/ipc/file_descriptor_set_posix.h
@@ -31,9 +31,7 @@ class IPC_EXPORT FileDescriptorSet
//
// In debugging mode, it's a fatal error to try and add more than this number
// of descriptors to a FileDescriptorSet.
- enum {
- MAX_DESCRIPTORS_PER_MESSAGE = 5,
- };
+ static const size_t kMaxDescriptorsPerMessage = 5;
// ---------------------------------------------------------------------------
// Interfaces for building during message serialisation...