Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: content/renderer/service_worker/service_worker_context_client.cc

Issue 1149383004: [3/5 chromium] Shows the clients which are controlled by ServiceWorker in DevTools. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 538 }
539 539
540 blink::WebServiceWorkerNetworkProvider* 540 blink::WebServiceWorkerNetworkProvider*
541 ServiceWorkerContextClient::createServiceWorkerNetworkProvider( 541 ServiceWorkerContextClient::createServiceWorkerNetworkProvider(
542 blink::WebDataSource* data_source) { 542 blink::WebDataSource* data_source) {
543 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); 543 DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
544 544
545 // Create a content::ServiceWorkerNetworkProvider for this data source so 545 // Create a content::ServiceWorkerNetworkProvider for this data source so
546 // we can observe its requests. 546 // we can observe its requests.
547 scoped_ptr<ServiceWorkerNetworkProvider> provider( 547 scoped_ptr<ServiceWorkerNetworkProvider> provider(
548 new ServiceWorkerNetworkProvider( 548 new ServiceWorkerNetworkProvider(MSG_ROUTING_NONE, MSG_ROUTING_NONE));
549 MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_CONTROLLER));
550 provider_context_ = provider->context(); 549 provider_context_ = provider->context();
551 550
552 // Tell the network provider about which version to load. 551 // Tell the network provider about which version to load.
553 provider->SetServiceWorkerVersionId(service_worker_version_id_); 552 provider->SetServiceWorkerVersionId(service_worker_version_id_);
554 553
555 // The provider is kept around for the lifetime of the DataSource 554 // The provider is kept around for the lifetime of the DataSource
556 // and ownership is transferred to the DataSource. 555 // and ownership is transferred to the DataSource.
557 DataSourceExtraData* extra_data = new DataSourceExtraData(); 556 DataSourceExtraData* extra_data = new DataSourceExtraData();
558 data_source->setExtraData(extra_data); 557 data_source->setExtraData(extra_data);
559 ServiceWorkerNetworkProvider::AttachToDocumentState( 558 ServiceWorkerNetworkProvider::AttachToDocumentState(
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 } 975 }
977 976
978 base::WeakPtr<ServiceWorkerContextClient> 977 base::WeakPtr<ServiceWorkerContextClient>
979 ServiceWorkerContextClient::GetWeakPtr() { 978 ServiceWorkerContextClient::GetWeakPtr() {
980 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 979 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
981 DCHECK(context_); 980 DCHECK(context_);
982 return context_->weak_factory.GetWeakPtr(); 981 return context_->weak_factory.GetWeakPtr();
983 } 982 }
984 983
985 } // namespace content 984 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698