| Index: content/child/background_sync/background_sync_provider_thread_proxy.cc
|
| diff --git a/content/child/background_sync/background_sync_provider_thread_proxy.cc b/content/child/background_sync/background_sync_provider_thread_proxy.cc
|
| index 90584bfc8380a6d31a2280ddd33303e83e52439a..97466b23bf18dc84ee0787d8d4c817ea9fda156a 100644
|
| --- a/content/child/background_sync/background_sync_provider_thread_proxy.cc
|
| +++ b/content/child/background_sync/background_sync_provider_thread_proxy.cc
|
| @@ -62,6 +62,7 @@ LazyInstance<ThreadLocalPointer<BackgroundSyncProviderThreadProxy>>::Leaky
|
|
|
| } // anonymous namespace
|
|
|
| +// static
|
| BackgroundSyncProviderThreadProxy*
|
| BackgroundSyncProviderThreadProxy::GetThreadInstance(
|
| base::SingleThreadTaskRunner* main_thread_task_runner,
|
| @@ -69,10 +70,15 @@ BackgroundSyncProviderThreadProxy::GetThreadInstance(
|
| if (g_sync_provider_tls.Pointer()->Get())
|
| return g_sync_provider_tls.Pointer()->Get();
|
|
|
| + if (!WorkerTaskRunner::Instance()->CurrentWorkerId()) {
|
| + // This could happen if GetThreadInstance is called very late (say by a
|
| + // garbage collected SyncRegistration).
|
| + return nullptr;
|
| + }
|
| +
|
| BackgroundSyncProviderThreadProxy* instance =
|
| new BackgroundSyncProviderThreadProxy(main_thread_task_runner,
|
| sync_provider);
|
| - DCHECK(WorkerTaskRunner::Instance()->CurrentWorkerId());
|
| WorkerTaskRunner::Instance()->AddStopObserver(instance);
|
| return instance;
|
| }
|
|
|