| 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_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_ |
| 6 #define CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_ | 6 #define CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> |
| 9 |
| 8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/scoped_vector.h" | |
| 10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/file_descriptor_info.h" | 12 #include "content/public/browser/file_descriptor_info.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 class FileDescriptorInfoImpl : public FileDescriptorInfo { | 16 class FileDescriptorInfoImpl : public FileDescriptorInfo { |
| 16 public: | 17 public: |
| 17 CONTENT_EXPORT static scoped_ptr<FileDescriptorInfo> Create(); | 18 CONTENT_EXPORT static scoped_ptr<FileDescriptorInfo> Create(); |
| 18 | 19 |
| 19 ~FileDescriptorInfoImpl() override; | 20 ~FileDescriptorInfoImpl() override; |
| 20 void Share(int id, base::PlatformFile fd) override; | 21 void Share(int id, base::PlatformFile fd) override; |
| 21 void Transfer(int id, base::ScopedFD fd) override; | 22 void Transfer(int id, base::ScopedFD fd) override; |
| 22 const base::FileHandleMappingVector& GetMapping() const override; | 23 const base::FileHandleMappingVector& GetMapping() const override; |
| 23 base::FileHandleMappingVector GetMappingWithIDAdjustment( | 24 base::FileHandleMappingVector GetMappingWithIDAdjustment( |
| 24 int delta) const override; | 25 int delta) const override; |
| 25 base::PlatformFile GetFDAt(size_t i) const override; | 26 base::PlatformFile GetFDAt(size_t i) const override; |
| 26 int GetIDAt(size_t i) const override; | 27 int GetIDAt(size_t i) const override; |
| 27 size_t GetMappingSize() const override; | 28 size_t GetMappingSize() const override; |
| 28 bool OwnsFD(base::PlatformFile file) const override; | 29 bool OwnsFD(base::PlatformFile file) const override; |
| 29 base::ScopedFD ReleaseFD(base::PlatformFile file) override; | 30 base::ScopedFD ReleaseFD(base::PlatformFile file) override; |
| 30 | 31 |
| 31 private: | 32 private: |
| 32 FileDescriptorInfoImpl(); | 33 FileDescriptorInfoImpl(); |
| 33 | 34 |
| 34 void AddToMapping(int id, base::PlatformFile fd); | 35 void AddToMapping(int id, base::PlatformFile fd); |
| 35 bool HasID(int id) const; | 36 bool HasID(int id) const; |
| 36 base::FileHandleMappingVector mapping_; | 37 base::FileHandleMappingVector mapping_; |
| 37 ScopedVector<base::ScopedFD> owned_descriptors_; | 38 std::vector<base::ScopedFD> owned_descriptors_; |
| 38 }; | 39 }; |
| 39 } | 40 } |
| 40 | 41 |
| 41 #endif // CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_ | 42 #endif // CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_ |
| OLD | NEW |