michael@0: /* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "LoadManager.h" michael@0: #include "LoadManagerFactory.h" michael@0: #include "MainThreadUtils.h" michael@0: michael@0: #include "mozilla/Preferences.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: LoadManager* LoadManagerBuild(void) michael@0: { michael@0: MOZ_ASSERT(NS_IsMainThread()); michael@0: michael@0: #if defined(ANDROID) || defined(LINUX) michael@0: int loadMeasurementInterval = michael@0: mozilla::Preferences::GetInt("media.navigator.load_adapt.measure_interval", 1000); michael@0: int averagingSeconds = michael@0: mozilla::Preferences::GetInt("media.navigator.load_adapt.avg_seconds", 3); michael@0: float highLoadThreshold = michael@0: mozilla::Preferences::GetFloat("media.navigator.load_adapt.high_load", 0.90); michael@0: float lowLoadThreshold = michael@0: mozilla::Preferences::GetFloat("media.navigator.load_adapt.low_load", 0.40); michael@0: michael@0: return new LoadManager(loadMeasurementInterval, michael@0: averagingSeconds, michael@0: highLoadThreshold, michael@0: lowLoadThreshold); michael@0: #else michael@0: // LoadManager not implemented on this platform. michael@0: return nullptr; michael@0: #endif michael@0: } michael@0: michael@0: void LoadManagerDestroy(mozilla::LoadManager* aLoadManager) michael@0: { michael@0: delete aLoadManager; michael@0: } michael@0: michael@0: }; // namespace