#include "extensions/browser/api/offscreen/lifetime_enforcer_factories.h"
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/types/cxx23_to_underlying.h"
#include "extensions/browser/api/offscreen/audio_lifetime_enforcer.h"
#include "extensions/browser/api/offscreen/offscreen_document_lifetime_enforcer.h"
#include "extensions/common/api/offscreen.h"
namespace extensions {
namespace {
LifetimeEnforcerFactories::TestingOverride* g_testing_override = …;
class EmptyLifetimeEnforcer : public OffscreenDocumentLifetimeEnforcer { … };
std::unique_ptr<OffscreenDocumentLifetimeEnforcer> CreateEmptyEnforcer(
OffscreenDocumentHost* offscreen_document,
OffscreenDocumentLifetimeEnforcer::TerminationCallback termination_callback,
OffscreenDocumentLifetimeEnforcer::NotifyInactiveCallback
notify_inactive_callback) { … }
std::unique_ptr<OffscreenDocumentLifetimeEnforcer> CreateAudioLifetimeEnforcer(
OffscreenDocumentHost* offscreen_document,
OffscreenDocumentLifetimeEnforcer::TerminationCallback termination_callback,
OffscreenDocumentLifetimeEnforcer::NotifyInactiveCallback
notify_inactive_callback) { … }
LifetimeEnforcerFactories& GetFactoriesInstance() { … }
FactoryMethodPtr;
struct ReasonAndFactoryMethodPair { … };
constexpr ReasonAndFactoryMethodPair kReasonAndFactoryMethodPairs[] = …;
static_assert …;
}
LifetimeEnforcerFactories::LifetimeEnforcerFactories() { … }
LifetimeEnforcerFactories::~LifetimeEnforcerFactories() = default;
std::unique_ptr<OffscreenDocumentLifetimeEnforcer>
LifetimeEnforcerFactories::GetLifetimeEnforcer(
api::offscreen::Reason reason,
OffscreenDocumentHost* offscreen_document,
OffscreenDocumentLifetimeEnforcer::TerminationCallback termination_callback,
OffscreenDocumentLifetimeEnforcer::NotifyInactiveCallback
notify_inactive_callback) { … }
LifetimeEnforcerFactories::TestingOverride::TestingOverride() { … }
LifetimeEnforcerFactories::TestingOverride::~TestingOverride() { … }
void LifetimeEnforcerFactories::InitializeFactories() { … }
}