Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / content / public / browser / file_descriptor_info.h
blob76c546e40b2934271daaac301a4155c0277577bb
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_H_
6 #define CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_
8 #include "base/files/file.h"
9 #include "base/process/launch.h"
11 namespace content {
13 // FileDescriptorInfo is a collection of file descriptors which is
14 // needed to launch a process. You should tell FileDescriptorInfo
15 // which FD should be closed and which shouldn't so that it can take care
16 // of the lifetime of FDs.
18 // See base/process/launcher.h for more details about launching a
19 // process.
20 class FileDescriptorInfo {
21 public:
22 virtual ~FileDescriptorInfo() {}
24 // Add an FD associated with an ID, without delegating the ownerhip
25 // of ID.
26 virtual void Share(int id, base::PlatformFile fd) = 0;
28 // Add an FD associated with an ID, passing the FD ownership to
29 // FileDescriptorInfo.
30 virtual void Transfer(int id, base::ScopedFD fd) = 0;
32 // A vecotr backed map of registered ID-FD pairs.
33 virtual const base::FileHandleMappingVector& GetMapping() const = 0;
35 // A GetMapping() variant what adjusts the ID value by |delta|.
36 // Some environments need this trick.
37 virtual base::FileHandleMappingVector GetMappingWithIDAdjustment(
38 int delta) const = 0;
40 // API for iterating registered ID-FD pairs.
41 virtual base::PlatformFile GetFDAt(size_t i) const = 0;
42 virtual int GetIDAt(size_t i) const = 0;
43 virtual size_t GetMappingSize() const = 0;
45 // True if |this| has an ownership of |file|.
46 virtual bool OwnsFD(base::PlatformFile file) const = 0;
47 // Assuming |OwnsFD(file)|, release the ownership.
48 virtual base::ScopedFD ReleaseFD(base::PlatformFile file) = 0;
53 #endif // CONTENT_PUBLIC_BROWSER_FILE_DESCRIPTOR_INFO_H_