blob: 74cee62d0b8334a6d943521f613230f5f33c55d2 [file] [log] [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/mojo_core_library_support.h"
#include "base/command_line.h"
#include "build/build_config.h"
#include "content/public/common/content_switches.h"
namespace content {
bool IsMojoCoreSharedLibraryEnabled() {
return GetMojoCoreSharedLibraryPath() != std::nullopt;
}
std::optional<base::FilePath> GetMojoCoreSharedLibraryPath() {
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kMojoCoreLibraryPath))
return std::nullopt;
return command_line.GetSwitchValuePath(switches::kMojoCoreLibraryPath);
#else
// Content does not yet properly support dynamic Mojo Core on platforms other
// than Linux and Chrome OS.
return std::nullopt;
#endif
}
} // namespace content