Commit 3d7b09dd authored by Hidehiko Abe's avatar Hidehiko Abe Committed by Commit Bot

Lacros: Defer log renewal to lacros-chrome.

Now we have at most one lacros-chrome tree at a time.
Defer the log file renewal to the lacros-chrome.

Bug: None
Test: Launch lacros-chrome locally, and log file is renewed.
Change-Id: I3fad92681fd7600997b0924f49924c237caa6d96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2280804
Commit-Queue: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#787678}
parent b1548e5d
......@@ -12,13 +12,11 @@
#include "base/command_line.h"
#include "base/environment.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/process/launch.h"
#include "base/process/process_handle.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
......@@ -147,18 +145,7 @@ void LacrosManager::Start() {
DCHECK_EQ(state_, State::STOPPED);
DCHECK(!lacros_process_.IsValid());
state_ = State::STARTING;
// Only delete the old log file if lacros is not running. If it's already
// running, then the subsequent call to base::LaunchProcess opens a new
// window, and we do not want to delete the existing log file.
// TODO(erikchen/hidehiko): Currently, launching a second instance of chrome
// deletes the existing log file, even though the new instance quickly exits.
scoped_refptr<base::SequencedTaskRunner> task_runner =
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
task_runner->PostTaskAndReply(
FROM_HERE, base::BindOnce(base::GetDeleteFileCallback(), LacrosLogPath()),
base::BindOnce(&LacrosManager::StartForeground,
weak_factory_.GetWeakPtr(), false));
StartForeground(false);
}
void LacrosManager::StartForeground(bool already_running) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment