chromium/components/services/paint_preview_compositor/paint_preview_compositor_collection_impl.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/services/paint_preview_compositor/paint_preview_compositor_collection_impl.h"

#include <utility>

#include "base/features.h"
#include "base/memory/discardable_memory.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/system/sys_info.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "components/crash/core/common/crash_key.h"
#include "content/public/utility/utility_thread.h"
#include "skia/ext/font_utils.h"
#include "third_party/skia/include/core/SkFontMgr.h"
#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/include/ports/SkFontConfigInterface.h"

#if BUILDFLAG(IS_WIN)
#include "content/public/child/dwrite_font_proxy_init_win.h"
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
#include "components/services/font/public/cpp/font_loader.h"
#endif

namespace paint_preview {

namespace {
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
// A parameter to exclude or not exclude PaintPreviewCompositor from
// PartialLowModeOnMidRangeDevices. This is used to see how
// PaintPreviewCompositor affects
// Startup.Android.Cold.TimeToFirstVisibleContent.
const base::FeatureParam<bool> kPartialLowEndModeExcludePaintPreviewCompositor{
    &base::features::kPartialLowEndModeOnMidRangeDevices,
    "exclude-paint-preview-compositor", false};
#endif  // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)

// Record whether the compositor is in shutdown. Discardable memory allocations
// manifest as OOMs during shutdown due to failure to send IPC messages. By
// recording whether the process is shutting down it is possible to determine if
// the OOM is actionable or just a consequence of the process no longer having
// IPC access.
crash_reporter::CrashKeyString<32> g_in_shutdown_key(
    "paint-preview-compositor-in-shutdown");
}  // namespace

PaintPreviewCompositorCollectionImpl::PaintPreviewCompositorCollectionImpl(
    mojo::PendingReceiver<mojom::PaintPreviewCompositorCollection> receiver,
    bool initialize_environment,
    scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
    :{}

PaintPreviewCompositorCollectionImpl::~PaintPreviewCompositorCollectionImpl() {}

void PaintPreviewCompositorCollectionImpl::SetDiscardableSharedMemoryManager(
    mojo::PendingRemote<
        discardable_memory::mojom::DiscardableSharedMemoryManager> manager) {}

void PaintPreviewCompositorCollectionImpl::CreateCompositor(
    mojo::PendingReceiver<mojom::PaintPreviewCompositor> receiver,
    PaintPreviewCompositorCollectionImpl::CreateCompositorCallback callback) {}

void PaintPreviewCompositorCollectionImpl::OnMemoryPressure(
    base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {}

void PaintPreviewCompositorCollectionImpl::ListCompositors(
    ListCompositorsCallback callback) {}

void PaintPreviewCompositorCollectionImpl::OnDisconnect(
    const base::UnguessableToken& id) {}

}  // namespace paint_preview