// Copyright 2019 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/default_context.h" #include #include "base/fuchsia/file_utils.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 namespace fuchsia { sys::ComponentContext* ComponentContextForCurrentProcess() { return ProcessComponentContextPtr()->get(); } } // namespace fuchsia std::unique_ptr ReplaceComponentContextForCurrentProcessForTest( std::unique_ptr context) { std::swap(*ProcessComponentContextPtr(), context); return context; } } // namespace base