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