Chromium Code Reviews| Index: content/public/browser/file_descriptor_info.h |
| diff --git a/content/public/browser/file_descriptor_info.h b/content/public/browser/file_descriptor_info.h |
| index 2248eb690f1b942aac9a4901f86ed6e825d65403..229d23483030b49679381e80c94d16c5f13ed5a1 100644 |
| --- a/content/public/browser/file_descriptor_info.h |
| +++ b/content/public/browser/file_descriptor_info.h |
| @@ -5,23 +5,40 @@ |
| #ifndef CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ |
| #define CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_ |
| -#include "base/file_descriptor_posix.h" |
| +#include <map> |
|
mdempsky
2014/09/22 18:30:51
Why?
|
| + |
| +#include "base/files/file.h" |
| +#include "base/memory/scoped_vector.h" |
| +#include "base/process/launch.h" |
| +#include "content/common/content_export.h" |
| namespace content { |
| -// This struct is used when passing files that should be mapped in a process |
| +// This class is used when passing files that should be mapped in a process |
| // that is been created and allows to associate that file with a specific ID. |
| // 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.
|
| -// closed with the FileDescriptor.auto_close field. |
| +// closed. |
| + |
| +class CONTENT_EXPORT FileDescriptorInfo { |
|
mdempsky
2014/09/22 18:30:51
No unit tests?
Hajime Morrita
2014/09/22 22:59:26
Done.
|
| + public: |
| + FileDescriptorInfo(); |
| + ~FileDescriptorInfo(); |
| + |
| + 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.
|
| + void Share(int id, base::PlatformFile fd); |
| + 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.
|
| + base::PlatformFile GetFDAt(size_t i) const; |
| + int GetIDAt(size_t i) const; |
| + |
| + const base::FileHandleMappingVector& descriptors() { return descriptors_; } |
| + |
| + size_t size() const { return descriptors_.size(); } |
| -struct FileDescriptorInfo { |
| - FileDescriptorInfo(int id, const base::FileDescriptor& file_descriptor) |
| - : id(id), |
| - fd(file_descriptor) { |
| - } |
| + private: |
| + void AddToMapping(int id, base::PlatformFile fd); |
| - int id; |
| - base::FileDescriptor fd; |
| + base::FileHandleMappingVector descriptors_; |
| + ScopedVector<base::ScopedFD> owned_descriptors_; |
| }; |
| } |