#include "content/browser/background_sync/background_sync_context_impl.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_traits.h"
#include "build/build_config.h"
#include "content/browser/background_sync/background_sync_launcher.h"
#include "content/browser/background_sync/background_sync_manager.h"
#include "content/browser/background_sync/one_shot_background_sync_service_impl.h"
#include "content/browser/background_sync/periodic_background_sync_service_impl.h"
#include "content/browser/devtools/devtools_background_services_context_impl.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/blink/public/mojom/background_sync/background_sync.mojom.h"
#include "url/origin.h"
namespace content {
BackgroundSyncContextImpl::BackgroundSyncContextImpl()
: … { … }
BackgroundSyncContextImpl::~BackgroundSyncContextImpl() { … }
#if BUILDFLAG(IS_ANDROID)
void BackgroundSyncContext::FireBackgroundSyncEventsAcrossPartitions(
BrowserContext* browser_context,
blink::mojom::BackgroundSyncType sync_type,
const base::android::JavaParamRef<jobject>& j_runnable) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(browser_context);
BackgroundSyncLauncher::FireBackgroundSyncEvents(browser_context, sync_type,
j_runnable);
}
#endif
void BackgroundSyncContextImpl::Init(
const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context,
DevToolsBackgroundServicesContextImpl& devtools_context) { … }
void BackgroundSyncContextImpl::Shutdown() { … }
void BackgroundSyncContextImpl::CreateOneShotSyncService(
const url::Origin& origin,
RenderProcessHost* render_process_host,
mojo::PendingReceiver<blink::mojom::OneShotBackgroundSyncService>
receiver) { … }
void BackgroundSyncContextImpl::CreatePeriodicSyncService(
const url::Origin& origin,
RenderProcessHost* render_process_host,
mojo::PendingReceiver<blink::mojom::PeriodicBackgroundSyncService>
receiver) { … }
void BackgroundSyncContextImpl::OneShotSyncServiceHadConnectionError(
OneShotBackgroundSyncServiceImpl* service) { … }
void BackgroundSyncContextImpl::PeriodicSyncServiceHadConnectionError(
PeriodicBackgroundSyncServiceImpl* service) { … }
BackgroundSyncManager* BackgroundSyncContextImpl::background_sync_manager()
const { … }
void BackgroundSyncContextImpl::set_background_sync_manager_for_testing(
std::unique_ptr<BackgroundSyncManager> manager) { … }
void BackgroundSyncContextImpl::set_wakeup_delta_for_testing(
blink::mojom::BackgroundSyncType sync_type,
base::TimeDelta wakeup_delta) { … }
base::TimeDelta BackgroundSyncContextImpl::GetSoonestWakeupDelta(
blink::mojom::BackgroundSyncType sync_type,
base::Time last_browser_wakeup_for_periodic_sync) { … }
void BackgroundSyncContextImpl::RevivePeriodicBackgroundSyncRegistrations(
url::Origin origin) { … }
void BackgroundSyncContextImpl::UnregisterPeriodicSyncForOrigin(
url::Origin origin) { … }
void BackgroundSyncContextImpl::FireBackgroundSyncEvents(
blink::mojom::BackgroundSyncType sync_type,
base::OnceClosure done_closure) { … }
void BackgroundSyncContextImpl::CreateBackgroundSyncManager(
scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
DevToolsBackgroundServicesContextImpl& devtools_context) { … }
}