From e8ce13950e6afc97ea69a36f5f234a7409269086 Mon Sep 17 00:00:00 2001 From: hscham Date: Fri, 17 Apr 2020 15:20:53 +0900 Subject: [PATCH] libchrome: r680000 forward compatibility patch part 2 This CL includes: - Rename base::LaunchOptions {,clear_}environ{=>ment}. Change-Id: I07b9b84d153e942368021be7fb89f0dd07ffebb1 --- base/process/launch.h | 6 +++--- base/process/launch_posix.cc | 8 ++++---- base/process/process_util_unittest.cc | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/base/process/launch.h b/base/process/launch.h index 7a2def2..84d176e 100644 --- a/base/process/launch.h +++ b/base/process/launch.h @@ -160,11 +160,11 @@ struct BASE_EXPORT LaunchOptions { // Set/unset environment variables. These are applied on top of the parent // process environment. Empty (the default) means to inherit the same // environment. See AlterEnvironment(). - EnvironmentMap environ; + EnvironmentMap environment; // Clear the environment for the new process before processing changes from - // |environ|. - bool clear_environ = false; + // |environment|. + bool clear_environment = false; // Remap file descriptors according to the mapping of src_fd->dest_fd to // propagate FDs into the child process. diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc index ec58488..c61db41 100644 --- a/base/process/launch_posix.cc +++ b/base/process/launch_posix.cc @@ -324,10 +324,10 @@ Process LaunchProcess(const std::vector& argv, std::unique_ptr new_environ; char* const empty_environ = nullptr; char* const* old_environ = GetEnvironment(); - if (options.clear_environ) + if (options.clear_environment) old_environ = &empty_environ; - if (!options.environ.empty()) - new_environ = AlterEnvironment(old_environ, options.environ); + if (!options.environment.empty()) + new_environ = AlterEnvironment(old_environ, options.environment); sigset_t full_sigset; sigfillset(&full_sigset); @@ -466,7 +466,7 @@ Process LaunchProcess(const std::vector& argv, fd_shuffle2.push_back(InjectionArc(value.first, value.second, false)); } - if (!options.environ.empty() || options.clear_environ) + if (!options.environment.empty() || options.clear_environment) SetEnvironment(new_environ.get()); // fd_shuffle1 is mutated by this call because it cannot malloc. diff --git a/base/process/process_util_unittest.cc b/base/process/process_util_unittest.cc index 4e788b7..a541e48 100644 --- a/base/process/process_util_unittest.cc +++ b/base/process/process_util_unittest.cc @@ -1162,8 +1162,8 @@ std::string TestLaunchProcess(const std::vector& args, LaunchOptions options; options.wait = true; - options.environ = env_changes; - options.clear_environ = clear_environ; + options.environment = env_changes; + options.clear_environment = clear_environ; options.fds_to_remap.emplace_back(fds[1], 1); #if defined(OS_LINUX) options.clone_flags = clone_flags; -- 2.26.1.301.g55bc3eb7cb9-goog diff --git a/base/test/scoped_task_environment.h b/base/test/scoped_task_environment.h index f9523b3138ec..a2cc7f73d8f2 100644 --- a/base/test/scoped_task_environment.h +++ b/base/test/scoped_task_environment.h @@ -81,6 +81,10 @@ class ScopedTaskEnvironment { IO, }; + // To introduce TimeSource::MOCK_TIME behaves same as + // MainThreadType::MOCK_TIME. + using TimeSource = MainThreadType; + enum class ExecutionMode { // Tasks are queued and only executed when RunUntilIdle() is explicitly // called.