
...so we can use FileDescriptorStore with fds that don't refer to regular files. Right now ChildProcessLauncherFileData's files_to_preload is the only way to pass a file via FileDescriptorStore without editing child_process_launcher internals, so make it hold a variant<FilePath, int> instead of just a FilePath. NOTE: At this point on Linux there are 3 ways to "name" file descriptors passed to a child process: 1. Normal file descriptor table 2. base::GlobalDescriptors (integer keys map to fd numbers) 3. base::FileDescriptorStore (string keys map to base::GlobalDescriptors keys). #1 can be modified with ChildProcessLauncherFileData::additional_remapped_fds, #2 can be modified with ContentBrowserClient::GetAdditionalMappedFilesForChildProcess(), and #3 can be modified with ChildProcessLauncherFileData::files_to_preload. Bug: 692619 Change-Id: I1cc678887cb44830f74614ffbeb027791aeb6505 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4141862 Commit-Queue: Matthew Denton <mpdenton@chromium.org> Reviewed-by: Bo Liu <boliu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1091118}
29 lines
896 B
C++
29 lines
896 B
C++
// Copyright 2019 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef CONTENT_BROWSER_V8_SNAPSHOT_FILES_H_
|
|
#define CONTENT_BROWSER_V8_SNAPSHOT_FILES_H_
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include "base/files/file_path.h"
|
|
#include "base/files/scoped_file.h"
|
|
#include "third_party/abseil-cpp/absl/types/variant.h"
|
|
|
|
namespace content {
|
|
|
|
// Returns a mapping of V8 snapshot files to be preloaded for child processes
|
|
// that use V8. Note that this is defined on all platforms even though it may
|
|
// be empty or unused on some.
|
|
//
|
|
// This mapping can be used in `content::ChildProcessLauncherFileData` when
|
|
// constructing a ChildProcessLauncher.
|
|
std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>>
|
|
GetV8SnapshotFilesToPreload();
|
|
|
|
} // namespace content
|
|
|
|
#endif // CONTENT_BROWSER_V8_SNAPSHOT_FILES_H_
|