OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/service_worker/service_worker_context_wrapper.h" | 5 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 const BoolCallback& callback) const { | 562 const BoolCallback& callback) const { |
563 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 563 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
564 if (!context_core_) { | 564 if (!context_core_) { |
565 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 565 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
566 base::Bind(callback, false)); | 566 base::Bind(callback, false)); |
567 return; | 567 return; |
568 } | 568 } |
569 context_core_->HasMainFrameProviderHost(origin, callback); | 569 context_core_->HasMainFrameProviderHost(origin, callback); |
570 } | 570 } |
571 | 571 |
| 572 std::unique_ptr<std::vector<std::pair<int, int>>> |
| 573 ServiceWorkerContextWrapper::GetProviderHostIds(const GURL& origin) const { |
| 574 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 575 |
| 576 std::unique_ptr<std::vector<std::pair<int, int>>> render_frames( |
| 577 new std::vector<std::pair<int, int>>()); |
| 578 |
| 579 for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = |
| 580 context_core_->GetClientProviderHostIterator(origin); |
| 581 !it->IsAtEnd(); it->Advance()) { |
| 582 ServiceWorkerProviderHost* provider_host = it->GetProviderHost(); |
| 583 render_frames->push_back( |
| 584 std::make_pair(provider_host->process_id(), provider_host->frame_id())); |
| 585 } |
| 586 |
| 587 return render_frames; |
| 588 } |
| 589 |
572 void ServiceWorkerContextWrapper::FindReadyRegistrationForDocument( | 590 void ServiceWorkerContextWrapper::FindReadyRegistrationForDocument( |
573 const GURL& document_url, | 591 const GURL& document_url, |
574 const FindRegistrationCallback& callback) { | 592 const FindRegistrationCallback& callback) { |
575 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 593 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
576 if (!context_core_) { | 594 if (!context_core_) { |
577 // FindRegistrationForDocument() can run the callback synchronously. | 595 // FindRegistrationForDocument() can run the callback synchronously. |
578 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); | 596 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
579 return; | 597 return; |
580 } | 598 } |
581 context_core_->storage()->FindRegistrationForDocument( | 599 context_core_->storage()->FindRegistrationForDocument( |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 service_worker_provider_id, | 977 service_worker_provider_id, |
960 std::move(client_ptr_info)); | 978 std::move(client_ptr_info)); |
961 } | 979 } |
962 | 980 |
963 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 981 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
964 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 982 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
965 return context_core_.get(); | 983 return context_core_.get(); |
966 } | 984 } |
967 | 985 |
968 } // namespace content | 986 } // namespace content |
OLD | NEW |