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

Side by Side Diff: base/file_descriptor_shuffle.h

Issue 10735044: Remove #pragma once. Just from base/ for now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « base/file_descriptor_posix.h ('k') | base/file_path.h » ('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 BASE_FILE_DESCRIPTOR_SHUFFLE_H_ 5 #ifndef BASE_FILE_DESCRIPTOR_SHUFFLE_H_
6 #define BASE_FILE_DESCRIPTOR_SHUFFLE_H_ 6 #define BASE_FILE_DESCRIPTOR_SHUFFLE_H_
7 #pragma once
8 7
9 // This code exists to perform the shuffling of file descriptors which is 8 // This code exists to perform the shuffling of file descriptors which is
10 // commonly needed when forking subprocesses. The naive approve is very simple, 9 // commonly needed when forking subprocesses. The naive approve is very simple,
11 // just call dup2 to setup the desired descriptors, but wrong. It's tough to 10 // just call dup2 to setup the desired descriptors, but wrong. It's tough to
12 // handle the edge cases (like mapping 0 -> 1, 1 -> 0) correctly. 11 // handle the edge cases (like mapping 0 -> 1, 1 -> 0) correctly.
13 // 12 //
14 // In order to unittest this code, it's broken into the abstract action (an 13 // In order to unittest this code, it's broken into the abstract action (an
15 // injective multimap) and the concrete code for dealing with file descriptors. 14 // injective multimap) and the concrete code for dealing with file descriptors.
16 // Users should use the code like this: 15 // Users should use the code like this:
17 // base::InjectiveMultimap file_descriptor_map; 16 // base::InjectiveMultimap file_descriptor_map;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 78
80 // This function will not call malloc but will mutate |map| 79 // This function will not call malloc but will mutate |map|
81 static inline bool ShuffleFileDescriptors(InjectiveMultimap* map) { 80 static inline bool ShuffleFileDescriptors(InjectiveMultimap* map) {
82 FileDescriptorTableInjection delegate; 81 FileDescriptorTableInjection delegate;
83 return PerformInjectiveMultimapDestructive(map, &delegate); 82 return PerformInjectiveMultimapDestructive(map, &delegate);
84 } 83 }
85 84
86 } // namespace base 85 } // namespace base
87 86
88 #endif // BASE_FILE_DESCRIPTOR_SHUFFLE_H_ 87 #endif // BASE_FILE_DESCRIPTOR_SHUFFLE_H_
OLDNEW
« no previous file with comments | « base/file_descriptor_posix.h ('k') | base/file_path.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698