blob: 6471941cbd7057f6b0449734c3112d310c7a3d02 [file] [log] [blame]
// Copyright 2020 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef COBALT_CONFIGURATION_CONFIGURATION_H_
#define COBALT_CONFIGURATION_CONFIGURATION_H_
#include "base/macros.h"
#include "starboard/extension/configuration.h"
namespace base {
template <typename T>
struct DefaultSingletonTraits;
}
namespace cobalt {
namespace configuration {
// The Configuration changes certain Cobalt features as specified by the
// platform. This class picks up values set in the
// CobaltConfigurationExtensionApi if it is implemented by the platform and
// will otherwise use default configurations.
class Configuration {
public:
// The Configuration is a singleton initialized on the first call of
// GetInstance(). Calls to this function will return a pointer to the same
// instance as was previously initialized.
static Configuration* GetInstance();
const char* CobaltUserOnExitStrategy();
bool CobaltRenderDirtyRegionOnly();
int CobaltEglSwapInterval();
const char* CobaltFallbackSplashScreenUrl();
int CobaltSkiaCacheSizeInBytes();
bool CobaltEnableQuic();
int CobaltOffscreenTargetCacheSizeInBytes();
int CobaltEncodedImageCacheSizeInBytes();
int CobaltImageCacheSizeInBytes();
int CobaltLocalTypefaceCacheSizeInBytes();
int CobaltRemoteTypefaceCacheSizeInBytes();
int CobaltMeshCacheSizeInBytes();
int CobaltSoftwareSurfaceCacheSizeInBytes();
float CobaltImageCacheCapacityMultiplierWhenPlayingVideo();
int CobaltSkiaGlyphAtlasWidth();
int CobaltSkiaGlyphAtlasHeight();
int CobaltReduceCpuMemoryBy();
int CobaltReduceGpuMemoryBy();
bool CobaltGcZeal();
const char* CobaltRasterizerType();
bool CobaltEnableJit();
const char* CobaltFallbackSplashScreenTopics();
bool CobaltCanStoreCompiledJavascript();
private:
Configuration();
friend struct base::DefaultSingletonTraits<Configuration>;
const CobaltExtensionConfigurationApi* configuration_api_;
static Configuration* configuration_;
DISALLOW_COPY_AND_ASSIGN(Configuration);
};
} // namespace configuration
} // namespace cobalt
#endif // COBALT_CONFIGURATION_CONFIGURATION_H_