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_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_
6 #define CONTENT_PUBLIC_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"
15 class FileDescriptorInfoImpl
: public FileDescriptorInfo
{
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
;
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_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_IMPL_H_