OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/service_worker/service_worker_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); | 346 DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); |
347 DCHECK(!proxy_); | 347 DCHECK(!proxy_); |
348 g_worker_client_tls.Pointer()->Set(this); | 348 g_worker_client_tls.Pointer()->Set(this); |
349 proxy_ = proxy; | 349 proxy_ = proxy; |
350 | 350 |
351 // Initialize pending callback maps. This needs to be freed on the | 351 // Initialize pending callback maps. This needs to be freed on the |
352 // same thread before the worker context goes away in | 352 // same thread before the worker context goes away in |
353 // willDestroyWorkerContext. | 353 // willDestroyWorkerContext. |
354 context_.reset(new WorkerContextData(this)); | 354 context_.reset(new WorkerContextData(this)); |
355 | 355 |
356 ServiceWorkerRegistrationObjectInfo registration_info; | |
357 ServiceWorkerVersionAttributes version_attrs; | |
358 provider_context_->GetRegistrationInfoAndVersionAttributes(®istration_info, | |
michaeln
2015/08/28 02:53:11
there's an early return in GetRegistrationInfoAndV
jkarlin
2015/09/02 23:51:41
Done.
jkarlin
2015/09/03 14:21:01
Hmm, the DCHECK_NE is failing for IN_PROC_BROWSER_
| |
359 &version_attrs); | |
360 | |
356 // Register Mojo services. | 361 // Register Mojo services. |
357 context_->service_registry.ServiceRegistry::AddService( | 362 context_->service_registry.ServiceRegistry::AddService( |
358 base::Bind(&ServicePortDispatcherImpl::Create, | 363 base::Bind(&ServicePortDispatcherImpl::Create, |
359 context_->proxy_weak_factory.GetWeakPtr())); | 364 context_->proxy_weak_factory.GetWeakPtr())); |
360 context_->service_registry.ServiceRegistry::AddService( | 365 context_->service_registry.ServiceRegistry::AddService(base::Bind( |
361 base::Bind(&BackgroundSyncClientImpl::Create)); | 366 &BackgroundSyncClientImpl::Create, registration_info.registration_id)); |
362 | 367 |
363 SetRegistrationInServiceWorkerGlobalScope(); | 368 SetRegistrationInServiceWorkerGlobalScope(); |
364 | 369 |
365 Send(new EmbeddedWorkerHostMsg_WorkerScriptLoaded( | 370 Send(new EmbeddedWorkerHostMsg_WorkerScriptLoaded( |
366 embedded_worker_id_, | 371 embedded_worker_id_, |
367 WorkerTaskRunner::Instance()->CurrentWorkerId(), | 372 WorkerTaskRunner::Instance()->CurrentWorkerId(), |
368 provider_context_->provider_id())); | 373 provider_context_->provider_id())); |
369 | 374 |
370 TRACE_EVENT_ASYNC_STEP_INTO0( | 375 TRACE_EVENT_ASYNC_STEP_INTO0( |
371 "ServiceWorker", | 376 "ServiceWorker", |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
966 } | 971 } |
967 | 972 |
968 base::WeakPtr<ServiceWorkerContextClient> | 973 base::WeakPtr<ServiceWorkerContextClient> |
969 ServiceWorkerContextClient::GetWeakPtr() { | 974 ServiceWorkerContextClient::GetWeakPtr() { |
970 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 975 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
971 DCHECK(context_); | 976 DCHECK(context_); |
972 return context_->weak_factory.GetWeakPtr(); | 977 return context_->weak_factory.GetWeakPtr(); |
973 } | 978 } |
974 | 979 |
975 } // namespace content | 980 } // namespace content |
OLD | NEW |