Roll DEPS for PDFium to 19ae17578f99621100a26dac3e2c7c3dbf7c7cd1
[chromium-blink-merge.git] / content / browser / file_descriptor_info_impl.h
blob40db959324458ec5597835ec58b8262c99ba8d41
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_
6 #define CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "content/common/content_export.h"
11 #include "content/public/browser/file_descriptor_info.h"
13 namespace content {
15 class FileDescriptorInfoImpl : public FileDescriptorInfo {
16 public:
17 CONTENT_EXPORT static scoped_ptr<FileDescriptorInfo> Create();
19 ~FileDescriptorInfoImpl() override;
20 void Share(int id, base::PlatformFile fd) override;
21 void Transfer(int id, base::ScopedFD fd) override;
22 const base::FileHandleMappingVector& GetMapping() const override;
23 base::FileHandleMappingVector GetMappingWithIDAdjustment(
24 int delta) const override;
25 base::PlatformFile GetFDAt(size_t i) const override;
26 int GetIDAt(size_t i) const override;
27 size_t GetMappingSize() const override;
28 bool OwnsFD(base::PlatformFile file) const override;
29 base::ScopedFD ReleaseFD(base::PlatformFile file) override;
31 private:
32 FileDescriptorInfoImpl();
34 void AddToMapping(int id, base::PlatformFile fd);
35 bool HasID(int id) const;
36 base::FileHandleMappingVector mapping_;
37 ScopedVector<base::ScopedFD> owned_descriptors_;
41 #endif // CONTENT_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_