Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
file_in_namespace_buffer.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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.
4#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FILE_IN_NAMESPACE_BUFFER_H_
5#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FILE_IN_NAMESPACE_BUFFER_H_
6
7#include <cstddef>
8
10
11namespace flutter_runner {
12
13/// A mapping to a buffer for a file that has been loaded into a namespace.
14class FileInNamespaceBuffer final : public fml::Mapping {
15 public:
16 /// Loads the file at |path| into the namespace |namespace_fd|, creating
17 /// a mapping to the loaded buffer.
18 ///
19 /// The file will be loaded with the readable permission. If |executable| is
20 /// true, the file will also be loaded with the executable permission.
21 FileInNamespaceBuffer(int namespace_fd, const char* path, bool executable);
23
24 // |fml::Mapping|
25 const uint8_t* GetMapping() const override;
26
27 // |fml::Mapping|
28 size_t GetSize() const override;
29
30 // |fml::Mapping|
31 bool IsDontNeedSafe() const override;
32
33 private:
34 /// The address that was mapped to the buffer.
35 void* address_;
36
37 /// The size of the buffer.
38 size_t size_;
39
41};
42
43/// Loads a file from |file_path| into the namespace |namespace_fd|, returning
44/// the mapping for that file.
45///
46/// The file will be loaded with the readable permission. If |executable| is
47/// true, the file will be also be loaded with the executable permission.
48std::unique_ptr<fml::Mapping> LoadFile(int namespace_fd,
49 const char* path,
50 bool executable);
51
52/// Opens the file at |path| and creates a file mapping for the file.
53///
54/// The file will be opened with the readable permission. If |executable| is
55/// true, the file will also be opened with the executable permission.
56std::unique_ptr<fml::FileMapping> MakeFileMapping(const char* path,
57 bool executable);
58
59} // namespace flutter_runner
60
61#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FILE_IN_NAMESPACE_BUFFER_H_
A mapping to a buffer for a file that has been loaded into a namespace.
const uint8_t * GetMapping() const override
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
std::unique_ptr< fml::FileMapping > MakeFileMapping(const char *path, bool executable)
std::unique_ptr< fml::Mapping > LoadFile(int namespace_fd, const char *path, bool executable)