// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/fuchsia/process_context.h" #include #include #include #include "base/fuchsia/process_context.h" #include "base/no_destructor.h" namespace base { namespace { std::unique_ptr* ProcessComponentContextPtr() { static base::NoDestructor> value( std::make_unique( sys::ServiceDirectory::CreateFromNamespace())); return value.get(); } } // namespace sys::ComponentInspector* ComponentInspectorForProcess() { static base::NoDestructor value( ComponentContextForProcess()); return value.get(); } sys::ComponentContext* ComponentContextForProcess() { return ProcessComponentContextPtr()->get(); } std::unique_ptr ReplaceComponentContextForProcessForTest( std::unique_ptr context) { std::swap(*ProcessComponentContextPtr(), context); return context; } } // namespace base