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

Side by Side Diff: ipc/file_descriptor_set_posix.h

Issue 7817005: Convert some constants declared as anonymous enums into static consts so they have types. This d... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ipc/file_descriptor_set_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef IPC_FILE_DESCRIPTOR_SET_POSIX_H_ 5 #ifndef IPC_FILE_DESCRIPTOR_SET_POSIX_H_
6 #define IPC_FILE_DESCRIPTOR_SET_POSIX_H_ 6 #define IPC_FILE_DESCRIPTOR_SET_POSIX_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 FileDescriptorSet(); 24 FileDescriptorSet();
25 25
26 // This is the maximum number of descriptors per message. We need to know this 26 // This is the maximum number of descriptors per message. We need to know this
27 // because the control message kernel interface has to be given a buffer which 27 // because the control message kernel interface has to be given a buffer which
28 // is large enough to store all the descriptor numbers. Otherwise the kernel 28 // is large enough to store all the descriptor numbers. Otherwise the kernel
29 // tells us that it truncated the control data and the extra descriptors are 29 // tells us that it truncated the control data and the extra descriptors are
30 // lost. 30 // lost.
31 // 31 //
32 // In debugging mode, it's a fatal error to try and add more than this number 32 // In debugging mode, it's a fatal error to try and add more than this number
33 // of descriptors to a FileDescriptorSet. 33 // of descriptors to a FileDescriptorSet.
34 enum { 34 static const size_t kMaxDescriptorsPerMessage = 5;
35 MAX_DESCRIPTORS_PER_MESSAGE = 5,
36 };
37 35
38 // --------------------------------------------------------------------------- 36 // ---------------------------------------------------------------------------
39 // Interfaces for building during message serialisation... 37 // Interfaces for building during message serialisation...
40 38
41 // Add a descriptor to the end of the set. Returns false iff the set is full. 39 // Add a descriptor to the end of the set. Returns false iff the set is full.
42 bool Add(int fd); 40 bool Add(int fd);
43 // Add a descriptor to the end of the set and automatically close it after 41 // Add a descriptor to the end of the set and automatically close it after
44 // transmission. Returns false iff the set is full. 42 // transmission. Returns false iff the set is full.
45 bool AddAndAutoClose(int fd); 43 bool AddAndAutoClose(int fd);
46 44
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // This contains the index of the next descriptor which should be consumed. 106 // This contains the index of the next descriptor which should be consumed.
109 // It's used in a couple of ways. Firstly, at destruction we can check that 107 // It's used in a couple of ways. Firstly, at destruction we can check that
110 // all the descriptors have been read (with GetNthDescriptor). Secondly, we 108 // all the descriptors have been read (with GetNthDescriptor). Secondly, we
111 // can check that they are read in order. 109 // can check that they are read in order.
112 mutable unsigned consumed_descriptor_highwater_; 110 mutable unsigned consumed_descriptor_highwater_;
113 111
114 DISALLOW_COPY_AND_ASSIGN(FileDescriptorSet); 112 DISALLOW_COPY_AND_ASSIGN(FileDescriptorSet);
115 }; 113 };
116 114
117 #endif // IPC_FILE_DESCRIPTOR_SET_POSIX_H_ 115 #endif // IPC_FILE_DESCRIPTOR_SET_POSIX_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/file_descriptor_set_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698