OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ |
6 #define CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ | 6 #define CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ |
7 | 7 |
8 #include "base/file_descriptor_posix.h" | 8 #include <map> |
mdempsky
2014/09/22 18:30:51
Why?
| |
9 | |
10 #include "base/files/file.h" | |
11 #include "base/memory/scoped_vector.h" | |
12 #include "base/process/launch.h" | |
13 #include "content/common/content_export.h" | |
9 | 14 |
10 namespace content { | 15 namespace content { |
11 | 16 |
12 // This struct is used when passing files that should be mapped in a process | 17 // This class is used when passing files that should be mapped in a process |
13 // that is been created and allows to associate that file with a specific ID. | 18 // that is been created and allows to associate that file with a specific ID. |
14 // It also provides a way to know if the actual file descriptor should be | 19 // It also provides a way to know if the actual file descriptor should be |
mdempsky
2014/09/22 18:30:51
I think this sentence should just be removed: this
Hajime Morrita
2014/09/22 22:59:26
Rewrite to match what we have.
| |
15 // closed with the FileDescriptor.auto_close field. | 20 // closed. |
16 | 21 |
17 struct FileDescriptorInfo { | 22 class CONTENT_EXPORT FileDescriptorInfo { |
mdempsky
2014/09/22 18:30:51
No unit tests?
Hajime Morrita
2014/09/22 22:59:26
Done.
| |
18 FileDescriptorInfo(int id, const base::FileDescriptor& file_descriptor) | 23 public: |
19 : id(id), | 24 FileDescriptorInfo(); |
20 fd(file_descriptor) { | 25 ~FileDescriptorInfo(); |
21 } | |
22 | 26 |
23 int id; | 27 void Transfer(int id, base::ScopedFD fd); |
mdempsky
2014/09/22 18:30:51
Comments/documentation?
Hajime Morrita
2014/09/22 22:59:26
Done.
| |
24 base::FileDescriptor fd; | 28 void Share(int id, base::PlatformFile fd); |
29 void GetMapping(base::FileHandleMappingVector* mapping) const; | |
mdempsky
2014/09/22 18:30:51
GetMapping() doesn't seem to be implemented.
Hajime Morrita
2014/09/22 22:59:26
Acknowledged.
| |
30 base::PlatformFile GetFDAt(size_t i) const; | |
31 int GetIDAt(size_t i) const; | |
32 | |
33 const base::FileHandleMappingVector& descriptors() { return descriptors_; } | |
34 | |
35 size_t size() const { return descriptors_.size(); } | |
36 | |
37 private: | |
38 void AddToMapping(int id, base::PlatformFile fd); | |
39 | |
40 base::FileHandleMappingVector descriptors_; | |
41 ScopedVector<base::ScopedFD> owned_descriptors_; | |
25 }; | 42 }; |
26 | 43 |
27 } | 44 } |
28 | 45 |
29 #endif // CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ | 46 #endif // CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ |
OLD | NEW |