Commit b2ff20e8 authored by Sharon Yang's avatar Sharon Yang Committed by Commit Bot

[fuchsia] Clean up ComponentContextForCurrentProcess

Rename ComponentContextForCurrentProcess to ComponentContextForProcess.
Move function to process_context from default_context.
Remove default_context files.
Remove unused includes.

Test: CQ
Bug: 1090364
Change-Id: I11d591cc87be7170513016713e77a816fc8e8fc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2242163
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780270}
parent 1f8ec211
......@@ -1531,8 +1531,6 @@ jumbo_component("base") {
"files/file_posix.cc",
"files/file_util_posix.cc",
"files/memory_mapped_file_posix.cc",
"fuchsia/default_context.cc",
"fuchsia/default_context.h",
"fuchsia/default_job.cc",
"fuchsia/default_job.h",
"fuchsia/file_utils.cc",
......
......@@ -17,7 +17,8 @@ namespace base {
namespace fuchsia {
// TODO(https://crbug.com/1090364): Move this to process_context.h.
// TODO(https://crbug.com/1090364): Remove this file when external dependencies
// have been migrated to process_context.
// Returns default sys::ComponentContext for the current process.
BASE_EXPORT sys::ComponentContext* ComponentContextForCurrentProcess();
......
......@@ -9,8 +9,8 @@
#include <string>
#include <vector>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/strings/string_piece.h"
using ::fuchsia::intl::Profile;
......@@ -19,7 +19,7 @@ namespace base {
namespace fuchsia {
IntlProfileWatcher::IntlProfileWatcher(ProfileChangeCallback on_profile_changed)
: IntlProfileWatcher(ComponentContextForCurrentProcess()
: IntlProfileWatcher(ComponentContextForProcess()
->svc()
->Connect<::fuchsia::intl::PropertyProvider>(),
on_profile_changed) {}
......@@ -66,7 +66,7 @@ std::string IntlProfileWatcher::GetPrimaryTimeZoneIdFromProfile(
// static
std::string IntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization() {
::fuchsia::intl::PropertyProviderSyncPtr provider;
ComponentContextForCurrentProcess()->svc()->Connect(provider.NewRequest());
ComponentContextForProcess()->svc()->Connect(provider.NewRequest());
return GetPrimaryTimeZoneIdFromPropertyProvider(std::move(provider));
}
......
......@@ -4,17 +4,38 @@
#include "base/fuchsia/process_context.h"
#include <lib/sys/cpp/component_context.h>
#include <lib/sys/inspect/cpp/component.h>
#include <utility>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/no_destructor.h"
namespace base {
namespace {
std::unique_ptr<sys::ComponentContext>* ProcessComponentContextPtr() {
static base::NoDestructor<std::unique_ptr<sys::ComponentContext>> value(
std::make_unique<sys::ComponentContext>(
sys::ServiceDirectory::CreateFromNamespace()));
return value.get();
}
} // namespace
sys::ComponentInspector* ComponentInspectorForProcess() {
static base::NoDestructor<sys::ComponentInspector> value(
fuchsia::ComponentContextForCurrentProcess());
ComponentContextForProcess());
return value.get();
}
sys::ComponentContext* ComponentContextForProcess() {
return ProcessComponentContextPtr()->get();
}
std::unique_ptr<sys::ComponentContext> ReplaceComponentContextForProcessForTest(
std::unique_ptr<sys::ComponentContext> context) {
std::swap(*ProcessComponentContextPtr(), context);
return context;
}
} // namespace base
......@@ -5,9 +5,12 @@
#ifndef BASE_FUCHSIA_PROCESS_CONTEXT_H_
#define BASE_FUCHSIA_PROCESS_CONTEXT_H_
#include <memory>
#include "base/base_export.h"
namespace sys {
class ComponentContext;
class ComponentInspector;
} // namespace sys
......@@ -16,6 +19,17 @@ namespace base {
// Returns sys::ComponentInspector for the current process.
BASE_EXPORT sys::ComponentInspector* ComponentInspectorForProcess();
// Returns default sys::ComponentContext for the current process.
BASE_EXPORT sys::ComponentContext* ComponentContextForProcess();
// Replaces the default sys::ComponentContext for the current process, and
// returns the previously-active one.
// Use the base::TestComponentContextForProcess rather than calling this
// directly.
BASE_EXPORT std::unique_ptr<sys::ComponentContext>
ReplaceComponentContextForProcessForTest(
std::unique_ptr<sys::ComponentContext> context);
} // namespace base
#endif // BASE_FUCHSIA_PROCESS_CONTEXT_H_
......@@ -15,7 +15,6 @@
#include "base/base_export.h"
#include "base/callback.h"
#include "base/fuchsia/default_context.h"
#include "base/macros.h"
namespace sys {
......
......@@ -10,9 +10,9 @@
#include <lib/sys/cpp/component_context.h>
#include "base/files/file_enumerator.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/filtered_service_directory.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/run_loop.h"
namespace base {
......@@ -26,7 +26,7 @@ TestComponentContextForProcess::TestComponentContextForProcess(
// Set up |incoming_services_| to use the ServiceDirectory from the current
// default ComponentContext to fetch services from.
context_services_ = std::make_unique<fuchsia::FilteredServiceDirectory>(
base::fuchsia::ComponentContextForCurrentProcess()->svc().get());
base::ComponentContextForProcess()->svc().get());
// Push all services from /svc to the test context if requested.
if (initial_state == InitialState::kCloneAll) {
......@@ -47,7 +47,7 @@ TestComponentContextForProcess::TestComponentContextForProcess(
// directory of |context_services_| published by the test, and with a request
// for the process' root outgoing directory.
fidl::InterfaceHandle<::fuchsia::io::Directory> published_root_directory;
old_context_ = ReplaceComponentContextForCurrentProcessForTest(
old_context_ = ReplaceComponentContextForProcessForTest(
std::make_unique<sys::ComponentContext>(
std::move(incoming_services),
published_root_directory.NewRequest().TakeChannel()));
......@@ -64,7 +64,7 @@ TestComponentContextForProcess::TestComponentContextForProcess(
}
TestComponentContextForProcess::~TestComponentContextForProcess() {
ReplaceComponentContextForCurrentProcessForTest(std::move(old_context_));
ReplaceComponentContextForProcessForTest(std::move(old_context_));
}
sys::OutgoingDirectory* TestComponentContextForProcess::additional_services() {
......
......@@ -24,9 +24,8 @@ class FilteredServiceDirectory;
} // namespace fuchsia
// Replaces the process-global sys::ComponentContext (as returned by the
// base::fuchsia::ComponentContextForCurrentProcess() function) with an empty
// instance which the calling test can configure, and restores the original
// when deleted.
// base::ComponentContextForProcess() function) with an empty instance which the
// calling test can configure, and restores the original when deleted.
//
// The test ComponentContext runs on the test main thread, which means that:
// - Tests using TestComponentContextForProcess must instantiate a
......
......@@ -7,8 +7,8 @@
#include <fuchsia/intl/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/testfidl/cpp/fidl.h"
#include "base/run_loop.h"
......@@ -26,7 +26,7 @@ class TestComponentContextForProcessTest
bool HasTestInterface() {
return VerifyTestInterface(
fuchsia::ComponentContextForCurrentProcess()
ComponentContextForProcess()
->svc()
->Connect<fuchsia::testfidl::TestInterface>());
}
......@@ -85,8 +85,7 @@ TEST_F(TestComponentContextForProcessTest, InjectTestInterface) {
TEST_F(TestComponentContextForProcessTest, PublishTestInterface) {
// Publish TestInterface to the process' outgoing-directory.
base::fuchsia::ScopedServiceBinding<fuchsia::testfidl::TestInterface>
service_binding(
fuchsia::ComponentContextForCurrentProcess()->outgoing().get(), this);
service_binding(ComponentContextForProcess()->outgoing().get(), this);
// Attempt to use the TestInterface from the outgoing-directory.
EXPECT_TRUE(HasPublishedTestInterface());
......@@ -100,7 +99,7 @@ TEST_F(TestComponentContextForProcessTest, ProvideSystemService) {
// Attempt to use the PropertyProvider via the process ComponentContext.
RunLoop wait_loop;
auto property_provider = fuchsia::ComponentContextForCurrentProcess()
auto property_provider = ComponentContextForProcess()
->svc()
->Connect<::fuchsia::intl::PropertyProvider>();
property_provider.set_error_handler(
......
......@@ -53,8 +53,8 @@
#include <zircon/syscalls/exception.h>
#include <zircon/types.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#endif // OS_FUCHSIA
namespace logging {
......@@ -776,10 +776,9 @@ TEST_F(LoggingTest, FuchsiaSystemLogging) {
std::unique_ptr<fuchsia::logger::LogFilterOptions> options =
std::make_unique<fuchsia::logger::LogFilterOptions>();
options->tags = {"base_unittests__exec"};
fuchsia::logger::LogPtr logger =
base::fuchsia::ComponentContextForCurrentProcess()
->svc()
->Connect<fuchsia::logger::Log>();
fuchsia::logger::LogPtr logger = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::logger::Log>();
listener.set_on_dump_logs_done(dump_logs);
logger->DumpLogsSafe(binding.NewBinding(), std::move(options));
});
......
......@@ -6,8 +6,8 @@
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/util/memory_pressure/memory_pressure_voter.h"
namespace util {
......@@ -40,7 +40,7 @@ SystemMemoryPressureEvaluatorFuchsia::SystemMemoryPressureEvaluatorFuchsia(
});
DVLOG(1) << "Registering for memory pressure updates.";
auto provider = base::fuchsia::ComponentContextForCurrentProcess()
auto provider = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::memorypressure::Provider>();
provider->RegisterWatcher(binding_.NewBinding());
......
......@@ -4,7 +4,7 @@
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/no_destructor.h"
#include "chromecast/crash/fuchsia/cast_crash_storage_impl_fuchsia.h"
......@@ -12,7 +12,7 @@ namespace chromecast {
CastCrashStorage* CastCrashStorage::GetInstance() {
static base::NoDestructor<CastCrashStorageImplFuchsia> storage(
base::fuchsia::ComponentContextForCurrentProcess()->svc().get());
base::ComponentContextForProcess()->svc().get());
return storage.get();
}
......
......@@ -9,7 +9,7 @@
#include <zircon/syscalls.h>
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/logging.h"
#include "base/memory/writable_shared_memory_region.h"
#include "base/time/time.h"
......@@ -55,7 +55,7 @@ bool MixerOutputStreamFuchsia::Start(int requested_sample_rate, int channels) {
// Connect |audio_renderer_|.
fuchsia::media::AudioPtr audio_server =
base::fuchsia::ComponentContextForCurrentProcess()
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::Audio>();
audio_server->CreateAudioRenderer(audio_renderer_.NewRequest());
......
......@@ -8,8 +8,8 @@
#include <lib/sys/cpp/service_directory.h>
#include <zircon/types.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/no_destructor.h"
#include "chromecast/public/reboot_shlib.h"
#include "chromecast/system/reboot/reboot_util.h"
......@@ -44,8 +44,7 @@ void InitializeRebootShlib(const std::vector<std::string>& argv,
// static
void RebootShlib::Initialize(const std::vector<std::string>& argv) {
InitializeRebootShlib(
argv, base::fuchsia::ComponentContextForCurrentProcess()->svc().get());
InitializeRebootShlib(argv, base::ComponentContextForProcess()->svc().get());
}
// static
......
......@@ -7,7 +7,6 @@
#include <lib/sys/cpp/component_context.h>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
namespace cr_fuchsia {
......
......@@ -15,7 +15,6 @@
#include "base/bind.h"
#include "base/containers/flat_map.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/service_provider_impl.h"
#include "base/macros.h"
......
......@@ -10,7 +10,6 @@
#include <lib/sys/cpp/component_context.h>
#include "base/containers/flat_map.h"
#include "base/fuchsia/default_context.h"
#include "base/macros.h"
#include "base/strings/string_piece.h"
......
......@@ -12,8 +12,8 @@
#include <zircon/processargs.h>
#include <utility>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/strings/strcat.h"
#include "fuchsia/base/release_channel.h"
......@@ -43,8 +43,7 @@ fidl::InterfaceHandle<fuchsia::io::Directory> StartWebEngineForTests(
web_engine_services_dir.NewRequest().TakeChannel();
fuchsia::sys::LauncherPtr launcher;
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
launcher.NewRequest());
base::ComponentContextForProcess()->svc()->Connect(launcher.NewRequest());
launcher->CreateComponent(std::move(launch_info),
std::move(component_controller_request));
......
......@@ -11,8 +11,8 @@
#include <utility>
#include <vector>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/logging.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
......@@ -34,7 +34,7 @@ void LegacyMetricsClient::Start(base::TimeDelta report_interval) {
DCHECK(!metrics_recorder_) << "Start() called more than once.";
report_interval_ = report_interval;
metrics_recorder_ = base::fuchsia::ComponentContextForCurrentProcess()
metrics_recorder_ = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::legacymetrics::MetricsRecorder>();
metrics_recorder_.set_error_handler(fit::bind_member(
......
......@@ -4,13 +4,11 @@
#include <fuchsia/accessibility/semantics/cpp/fidl.h>
#include <fuchsia/accessibility/semantics/cpp/fidl_test_base.h>
#include <lib/sys/cpp/component_context.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h>
#include <zircon/types.h>
#include "base/auto_reset.h"
#include "base/check.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/notreached.h"
#include "base/test/bind_test_util.h"
......
......@@ -10,8 +10,8 @@
#include <limits>
#include "base/bind_helpers.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/json/json_writer.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/strcat.h"
......@@ -588,7 +588,7 @@ void FrameImpl::CreateViewWithViewRef(
InitWindowTreeHost(std::move(view_token), std::move(view_ref_pair));
fuchsia::accessibility::semantics::SemanticsManagerPtr semantics_manager =
base::fuchsia::ComponentContextForCurrentProcess()
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::accessibility::semantics::SemanticsManager>();
accessibility_bridge_ = std::make_unique<AccessibilityBridge>(
......
......@@ -8,7 +8,7 @@
#include <lib/sys/cpp/component_context.h>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/frame_service_base.h"
#include "content/public/browser/provision_fetcher_factory.h"
......@@ -79,7 +79,7 @@ void MediaResourceProviderImpl::CreateCdm(
void MediaResourceProviderImpl::CreateAudioConsumer(
fidl::InterfaceRequest<fuchsia::media::AudioConsumer> request) {
auto factory = base::fuchsia::ComponentContextForCurrentProcess()
auto factory = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::SessionAudioConsumerFactory>();
factory->CreateAudioConsumer(
......@@ -100,7 +100,7 @@ void MediaResourceProviderImpl::CreateAudioCapturer(
return;
}
auto factory = base::fuchsia::ComponentContextForCurrentProcess()
auto factory = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::Audio>();
factory->CreateAudioCapturer(std::move(request), /*loopback=*/false);
......@@ -114,7 +114,7 @@ class WidevineHandler : public media::FuchsiaCdmManager::KeySystemHandler {
void CreateCdm(
fidl::InterfaceRequest<fuchsia::media::drm::ContentDecryptionModule>
request) override {
auto widevine = base::fuchsia::ComponentContextForCurrentProcess()
auto widevine = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::drm::Widevine>();
widevine->CreateContentDecryptionModule(std::move(request));
......@@ -123,7 +123,7 @@ class WidevineHandler : public media::FuchsiaCdmManager::KeySystemHandler {
fuchsia::media::drm::ProvisionerPtr CreateProvisioner() override {
fuchsia::media::drm::ProvisionerPtr provisioner;
auto widevine = base::fuchsia::ComponentContextForCurrentProcess()
auto widevine = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::drm::Widevine>();
widevine->CreateProvisioner(provisioner.NewRequest());
......@@ -140,7 +140,7 @@ class PlayreadyHandler : public media::FuchsiaCdmManager::KeySystemHandler {
void CreateCdm(
fidl::InterfaceRequest<fuchsia::media::drm::ContentDecryptionModule>
request) override {
auto playready = base::fuchsia::ComponentContextForCurrentProcess()
auto playready = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::drm::PlayReady>();
playready->CreateContentDecryptionModule(std::move(request));
......
......@@ -9,7 +9,6 @@
#include <lib/sys/cpp/outgoing_directory.h>
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/logging.h"
......@@ -39,7 +38,7 @@ void RegisterFeedbackAnnotations() {
component_data.set_namespace_("web-engine");
component_data.mutable_annotations()->push_back(
{"version", version_info::GetVersionNumber()});
base::fuchsia::ComponentContextForCurrentProcess()
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::feedback::ComponentDataRegister>()
->Upsert(std::move(component_data), []() {});
......@@ -64,7 +63,7 @@ int ContextProviderMain() {
// Publish the ContextProvider and Debug services.
sys::OutgoingDirectory* const directory =
base::fuchsia::ComponentContextForCurrentProcess()->outgoing().get();
base::ComponentContextForProcess()->outgoing().get();
base::fuchsia::ScopedServiceBinding<fuchsia::web::ContextProvider> binding(
directory, &context_provider);
base::fuchsia::ScopedServiceBinding<fuchsia::web::Debug> debug_binding(
......
......@@ -13,9 +13,9 @@
#include "base/base_paths_fuchsia.h"
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/message_loop/message_pump_type.h"
......@@ -82,7 +82,7 @@ GURL GetUrlFromArgs(const base::CommandLine::StringVector& args) {
fuchsia::web::ContextProviderPtr ConnectToContextProvider(
const base::CommandLine::StringVector& extra_command_line_arguments) {
sys::ComponentContext* const component_context =
base::fuchsia::ComponentContextForCurrentProcess();
base::ComponentContextForProcess();
// If there are no additional command-line arguments then use the
// system instance of the ContextProvider.
......@@ -257,7 +257,7 @@ int main(int argc, char** argv) {
// Present a fullscreen view of |frame|.
auto view_tokens = scenic::ViewTokenPair::New();
frame->CreateView(std::move(view_tokens.view_token));
auto presenter = base::fuchsia::ComponentContextForCurrentProcess()
auto presenter = base::ComponentContextForProcess()
->svc()
->Connect<::fuchsia::ui::policy::Presenter>();
presenter->PresentOrReplaceView(std::move(view_tokens.view_holder_token),
......
......@@ -10,7 +10,6 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/file_utils.h"
#include "base/macros.h"
#include "base/test/task_environment.h"
......
......@@ -11,10 +11,10 @@
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/filtered_service_directory.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/macros.h"
#include "base/path_service.h"
......@@ -105,7 +105,7 @@ class WebEngineIntegrationTest : public testing::Test {
ContextParamsWithFilteredServiceDirectory() {
filtered_service_directory_ =
std::make_unique<base::fuchsia::FilteredServiceDirectory>(
base::fuchsia::ComponentContextForCurrentProcess()->svc().get());
base::ComponentContextForProcess()->svc().get());
fidl::InterfaceHandle<fuchsia::io::Directory> svc_dir;
filtered_service_directory_->ConnectClient(svc_dir.NewRequest());
......
......@@ -7,7 +7,7 @@
#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
......@@ -25,7 +25,7 @@ int main(int argc, char** argv) {
// Bind the parent-supplied OutgoingDirectory-request to a directory and
// publish the HTTP service into it.
sys::OutgoingDirectory* outgoing_directory =
base::fuchsia::ComponentContextForCurrentProcess()->outgoing().get();
base::ComponentContextForProcess()->outgoing().get();
HttpServiceImpl http_service;
base::fuchsia::ScopedServiceBinding<::fuchsia::net::oldhttp::HttpService>
binding(outgoing_directory, &http_service);
......
......@@ -15,6 +15,7 @@
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/filtered_service_directory.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/logging.h"
#include "fuchsia/base/agent_manager.h"
#include "fuchsia/runners/cast/cast_streaming.h"
......@@ -70,15 +71,13 @@ bool IsPermissionGrantedInAppConfig(
CastRunner::CastRunner(bool is_headless)
: is_headless_(is_headless),
main_services_(std::make_unique<base::fuchsia::FilteredServiceDirectory>(
base::fuchsia::ComponentContextForCurrentProcess()->svc().get())),
base::ComponentContextForProcess()->svc().get())),
main_context_(std::make_unique<WebContentRunner>(
base::BindRepeating(&CastRunner::GetMainContextParams,
base::Unretained(this)))),
isolated_services_(
std::make_unique<base::fuchsia::FilteredServiceDirectory>(
base::fuchsia::ComponentContextForCurrentProcess()
->svc()
.get())) {
base::ComponentContextForProcess()->svc().get())) {
// Specify the services to connect via the Runner process' service directory.
for (const char* name : kServices) {
main_services_->AddService(name);
......@@ -330,8 +329,7 @@ void CastRunner::OnAudioServiceRequest(
// Otherwise use the Runner's fuchsia.media.Audio service. fuchsia.media.Audio
// may be used by frames without MICROPHONE permission to create AudioRenderer
// instance.
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
std::move(request));
base::ComponentContextForProcess()->svc()->Connect(std::move(request));
}
void CastRunner::OnCameraServiceRequest(
......
......@@ -5,7 +5,6 @@
#include <lib/sys/cpp/component_context.h>
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/message_loop/message_pump_type.h"
......@@ -48,12 +47,9 @@ int main(int argc, char** argv) {
CastRunner runner(IsHeadless());
base::fuchsia::ScopedServiceBinding<fuchsia::sys::Runner> binding(
base::fuchsia::ComponentContextForCurrentProcess()->outgoing().get(),
&runner);
base::ComponentContextForProcess()->outgoing().get(), &runner);
base::fuchsia::ComponentContextForCurrentProcess()
->outgoing()
->ServeFromStartupInfo();
base::ComponentContextForProcess()->outgoing()->ServeFromStartupInfo();
// Publish version information for this component to Inspect.
cr_fuchsia::PublishVersionInfoToInspect(base::ComponentInspectorForProcess());
......
......@@ -13,7 +13,6 @@
#include <utility>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/logging.h"
#include "fuchsia/runners/common/web_content_runner.h"
......
......@@ -12,9 +12,9 @@
#include "base/bind.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/startup_context.h"
#include "base/logging.h"
......@@ -26,7 +26,7 @@ namespace {
fuchsia::web::ContextPtr CreateWebContext(
fuchsia::web::CreateContextParams context_params) {
auto context_provider = base::fuchsia::ComponentContextForCurrentProcess()
auto context_provider = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::web::ContextProvider>();
fuchsia::web::ContextPtr web_context;
......
......@@ -5,7 +5,6 @@
#include <lib/sys/cpp/component_context.h>
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
......@@ -62,12 +61,9 @@ int main(int argc, char** argv) {
WebContentRunner runner(std::move(get_context_params_callback));
base::fuchsia::ScopedServiceBinding<fuchsia::sys::Runner> binding(
base::fuchsia::ComponentContextForCurrentProcess()->outgoing().get(),
&runner);
base::ComponentContextForProcess()->outgoing().get(), &runner);
base::fuchsia::ComponentContextForCurrentProcess()
->outgoing()
->ServeFromStartupInfo();
base::ComponentContextForProcess()->outgoing()->ServeFromStartupInfo();
// Publish version information for this component to Inspect.
cr_fuchsia::PublishVersionInfoToInspect(base::ComponentInspectorForProcess());
......
......@@ -8,7 +8,7 @@
#include <lib/sys/cpp/component_context.h>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/service_provider_impl.h"
#include "base/test/task_environment.h"
......@@ -107,7 +107,7 @@ TEST_F(WebRunnerSmokeTest, MAYBE_RequestHtmlAndImage) {
fuchsia::sys::LaunchInfo launch_info = LaunchInfoWithServices();
launch_info.url = test_server_.GetURL("/test.html").spec();
auto launcher = base::fuchsia::ComponentContextForCurrentProcess()
auto launcher = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sys::Launcher>();
......@@ -128,7 +128,7 @@ TEST_F(WebRunnerSmokeTest, LifecycleTerminate) {
launch_info.url = test_server_.GetURL("/test.html").spec();
launch_info.directory_request = directory.NewRequest().TakeChannel();
auto launcher = base::fuchsia::ComponentContextForCurrentProcess()
auto launcher = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sys::Launcher>();
......@@ -157,7 +157,7 @@ TEST_F(WebRunnerSmokeTest, ComponentExitOnFrameClose) {
fuchsia::sys::LaunchInfo launch_info = LaunchInfoWithServices();
launch_info.url = test_server_.GetURL("/window_close.html").spec();
auto launcher = base::fuchsia::ComponentContextForCurrentProcess()
auto launcher = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sys::Launcher>();
......@@ -204,7 +204,7 @@ TEST_F(WebRunnerSmokeTest, RemoveSelfFromStoryOnFrameClose) {
launch_info.additional_services->names.emplace_back(
fuchsia::modular::ModuleContext::Name_);
auto launcher = base::fuchsia::ComponentContextForCurrentProcess()
auto launcher = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sys::Launcher>();
......
......@@ -8,7 +8,7 @@
#include <zircon/syscalls.h>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/logging.h"
#include "base/memory/writable_shared_memory_region.h"
#include "media/audio/fuchsia/audio_manager_fuchsia.h"
......@@ -39,7 +39,7 @@ bool AudioOutputStreamFuchsia::Open() {
// Connect |audio_renderer_| to the audio service.
fuchsia::media::AudioPtr audio_server =
base::fuchsia::ComponentContextForCurrentProcess()
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::media::Audio>();
audio_server->CreateAudioRenderer(audio_renderer_.NewRequest());
......
......@@ -7,8 +7,8 @@
#include <lib/sys/cpp/component_context.h>
#include "base/check_op.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
......@@ -186,7 +186,7 @@ void VideoCaptureDeviceFactoryFuchsia::Initialize() {
DCHECK(!device_watcher_);
DCHECK(devices_.empty());
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
base::ComponentContextForProcess()->svc()->Connect(
device_watcher_.NewRequest());
device_watcher_.set_error_handler(fit::bind_member(
......
......@@ -15,8 +15,8 @@
#include "base/bits.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
......@@ -420,7 +420,7 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
decoder_params.set_promise_separate_access_units_on_input(true);
decoder_params.set_require_hw(!enable_sw_decoding_);
auto decoder_factory = base::fuchsia::ComponentContextForCurrentProcess()
auto decoder_factory = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::mediacodec::CodecFactory>();
decoder_factory->CreateDecoder(std::move(decoder_params),
......
......@@ -11,8 +11,8 @@
#include "base/bind_helpers.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/test/task_environment.h"
#include "components/viz/test/test_context_support.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
......@@ -30,7 +30,7 @@ namespace {
class TestBufferCollection {
public:
explicit TestBufferCollection(zx::channel collection_token) {
sysmem_allocator_ = base::fuchsia::ComponentContextForCurrentProcess()
sysmem_allocator_ = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sysmem::Allocator>();
sysmem_allocator_.set_error_handler([](zx_status_t status) {
......
......@@ -7,7 +7,6 @@
#include <lib/sys/cpp/component_context.h>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/logging.h"
#include "base/sequenced_task_runner.h"
......
......@@ -7,7 +7,7 @@
#include <fuchsia/sysmem/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "base/memory/platform_shared_memory_region.h"
#include "base/memory/writable_shared_memory_region.h"
#include "base/message_loop/message_loop_current.h"
......@@ -290,7 +290,7 @@ void FakeCameraStream::SetBufferCollection(
SendBufferCollection();
// Initialize the new collection using |local_token|.
auto allocator = base::fuchsia::ComponentContextForCurrentProcess()
auto allocator = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sysmem::Allocator>();
......
......@@ -8,8 +8,8 @@
#include <algorithm>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "media/fuchsia/common/sysmem_buffer_reader.h"
#include "media/fuchsia/common/sysmem_buffer_writer.h"
......@@ -126,7 +126,7 @@ void SysmemBufferPool::OnError() {
}
BufferAllocator::BufferAllocator() {
allocator_ = base::fuchsia::ComponentContextForCurrentProcess()
allocator_ = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::sysmem::Allocator>();
......
......@@ -11,8 +11,8 @@
#include <vector>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/optional.h"
#include "base/run_loop.h"
#include "net/base/network_interfaces.h"
......@@ -22,11 +22,10 @@ namespace net {
NetworkChangeNotifierFuchsia::NetworkChangeNotifierFuchsia(
uint32_t required_features)
: NetworkChangeNotifierFuchsia(
base::fuchsia::ComponentContextForCurrentProcess()
->svc()
->Connect<fuchsia::netstack::Netstack>(),
required_features) {}
: NetworkChangeNotifierFuchsia(base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::netstack::Netstack>(),
required_features) {}
NetworkChangeNotifierFuchsia::NetworkChangeNotifierFuchsia(
fuchsia::netstack::NetstackPtr netstack,
......
......@@ -13,8 +13,8 @@
#include <utility>
#include "base/format_macros.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/strings/stringprintf.h"
#include "net/base/ip_endpoint.h"
#include "net/base/network_interfaces.h"
......@@ -107,8 +107,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
DCHECK(networks);
fuchsia::netstack::NetstackSyncPtr netstack;
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
netstack.NewRequest());
base::ComponentContextForProcess()->svc()->Connect(netstack.NewRequest());
// TODO(kmarshall): Use NetworkChangeNotifier's cached interface list.
std::vector<fuchsia::netstack::NetInterface> interfaces;
......
......@@ -28,10 +28,10 @@
#include "base/command_line.h"
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/default_job.h"
#include "base/fuchsia/filtered_service_directory.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/process/process.h"
......@@ -167,7 +167,7 @@ SandboxPolicyFuchsia::SandboxPolicyFuchsia(service_manager::SandboxType type) {
service_directory_task_runner_ = base::ThreadTaskRunnerHandle::Get();
service_directory_ =
std::make_unique<base::fuchsia::FilteredServiceDirectory>(
base::fuchsia::ComponentContextForCurrentProcess()->svc().get());
base::ComponentContextForProcess()->svc().get());
for (const char* service_name : kDefaultServices) {
service_directory_->AddService(service_name);
}
......
......@@ -7,7 +7,7 @@
#include <fuchsia/fonts/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "third_party/skia/include/core/SkFontMgr.h"
#include "third_party/skia/include/ports/SkFontMgr_fuchsia.h"
......@@ -15,8 +15,7 @@ namespace skia {
SK_API sk_sp<SkFontMgr> CreateDefaultSkFontMgr() {
fuchsia::fonts::ProviderSyncPtr provider;
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
provider.NewRequest());
base::ComponentContextForProcess()->svc()->Connect(provider.NewRequest());
return SkFontMgr_New_Fuchsia(std::move(provider));
}
......
......@@ -10,8 +10,8 @@
#include <lib/fidl/cpp/interface_handle.h>
#include <lib/sys/cpp/component_context.h>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/file_utils.h"
#include "base/fuchsia/process_context.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
......@@ -46,8 +46,7 @@ fuchsia::fonts::ProviderSyncPtr RunTestProviderWithTestFonts(
font_provider_services_dir.NewRequest().TakeChannel();
fuchsia::sys::LauncherSyncPtr launcher;
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
launcher.NewRequest());
base::ComponentContextForProcess()->svc()->Connect(launcher.NewRequest());
launcher->CreateComponent(std::move(launch_info),
controller_out->NewRequest());
......
......@@ -9,7 +9,7 @@
#include <memory>
#include <utility>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/process_context.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/keycodes/dom/dom_code.h"
......@@ -22,7 +22,7 @@ InputMethodFuchsia::InputMethodFuchsia(internal::InputMethodDelegate* delegate,
: InputMethodBase(delegate),
event_converter_(this),
ime_client_binding_(this),
ime_service_(base::fuchsia::ComponentContextForCurrentProcess()
ime_service_(base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::ui::input::ImeService>()),
virtual_keyboard_controller_(ime_service_.get()) {}
......
......@@ -10,6 +10,7 @@
#include "base/check.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/notreached.h"
namespace ui {
......@@ -18,7 +19,7 @@ InputMethodKeyboardControllerFuchsia::InputMethodKeyboardControllerFuchsia(
fuchsia::ui::input::ImeService* ime_service)
: ime_service_(ime_service),
ime_visibility_(
base::fuchsia::ComponentContextForCurrentProcess()
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::ui::input::ImeVisibilityService>()) {
DCHECK(ime_service_);
......
......@@ -9,8 +9,8 @@
#include <memory>
#include "base/bind.h"
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "third_party/angle/src/common/fuchsia_egl/fuchsia_egl.h"
......@@ -43,7 +43,7 @@ struct FuchsiaEGLWindowDeleter {
fuchsia::ui::scenic::ScenicPtr ConnectToScenic() {
fuchsia::ui::scenic::ScenicPtr scenic =
base::fuchsia::ComponentContextForCurrentProcess()
base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::ui::scenic::Scenic>();
scenic.set_error_handler([](zx_status_t status) {
......@@ -130,8 +130,7 @@ class GLOzoneEGLScenic : public GLOzoneEGL {
fuchsia::sysmem::AllocatorHandle ConnectSysmemAllocator() {
fuchsia::sysmem::AllocatorHandle allocator;
base::fuchsia::ComponentContextForCurrentProcess()->svc()->Connect(
allocator.NewRequest());
base::ComponentContextForProcess()->svc()->Connect(allocator.NewRequest());
return allocator;
}
......
......@@ -7,8 +7,8 @@
#include <lib/sys/cpp/component_context.h>
#include <memory>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "ui/ozone/platform/scenic/ozone_platform_scenic.h"
namespace ui {
......@@ -33,7 +33,7 @@ std::unique_ptr<PlatformScreen> ScenicWindowManager::CreateScreen() {
fuchsia::ui::scenic::Scenic* ScenicWindowManager::GetScenic() {
if (!scenic_) {
scenic_ = base::fuchsia::ComponentContextForCurrentProcess()
scenic_ = base::ComponentContextForProcess()
->svc()
->Connect<fuchsia::ui::scenic::Scenic>();
scenic_.set_error_handler(
......
......@@ -11,8 +11,8 @@
#include <utility>
#include "base/fuchsia/default_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
namespace ui {
namespace fuchsia {
......@@ -29,7 +29,7 @@ void InitializeViewTokenAndPresentView(
window_properties_out->view_ref_pair = scenic::ViewRefPair::New();
// Request Presenter to show the view full-screen.
auto presenter = base::fuchsia::ComponentContextForCurrentProcess()
auto presenter = base::ComponentContextForProcess()
->svc()
->Connect<::fuchsia::ui::policy::Presenter>();
......
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