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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 const BoolCallback& callback) const { | 597 const BoolCallback& callback) const { |
598 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 598 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
599 if (!context_core_) { | 599 if (!context_core_) { |
600 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 600 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
601 base::Bind(callback, false)); | 601 base::Bind(callback, false)); |
602 return; | 602 return; |
603 } | 603 } |
604 context_core_->HasMainFrameProviderHost(origin, callback); | 604 context_core_->HasMainFrameProviderHost(origin, callback); |
605 } | 605 } |
606 | 606 |
| 607 std::unique_ptr<std::vector<std::pair<int, int>>> |
| 608 ServiceWorkerContextWrapper::GetProviderHostIds(const GURL& origin) const { |
| 609 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 610 |
| 611 std::unique_ptr<std::vector<std::pair<int, int>>> provider_host_ids( |
| 612 new std::vector<std::pair<int, int>>()); |
| 613 |
| 614 for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it = |
| 615 context_core_->GetClientProviderHostIterator(origin); |
| 616 !it->IsAtEnd(); it->Advance()) { |
| 617 ServiceWorkerProviderHost* provider_host = it->GetProviderHost(); |
| 618 provider_host_ids->push_back( |
| 619 std::make_pair(provider_host->process_id(), provider_host->frame_id())); |
| 620 } |
| 621 |
| 622 return provider_host_ids; |
| 623 } |
| 624 |
607 void ServiceWorkerContextWrapper::FindReadyRegistrationForDocument( | 625 void ServiceWorkerContextWrapper::FindReadyRegistrationForDocument( |
608 const GURL& document_url, | 626 const GURL& document_url, |
609 const FindRegistrationCallback& callback) { | 627 const FindRegistrationCallback& callback) { |
610 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 628 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
611 if (!context_core_) { | 629 if (!context_core_) { |
612 // FindRegistrationForDocument() can run the callback synchronously. | 630 // FindRegistrationForDocument() can run the callback synchronously. |
613 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); | 631 callback.Run(SERVICE_WORKER_ERROR_ABORT, nullptr); |
614 return; | 632 return; |
615 } | 633 } |
616 context_core_->storage()->FindRegistrationForDocument( | 634 context_core_->storage()->FindRegistrationForDocument( |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 service_worker_provider_id, | 1023 service_worker_provider_id, |
1006 std::move(client_ptr_info)); | 1024 std::move(client_ptr_info)); |
1007 } | 1025 } |
1008 | 1026 |
1009 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { | 1027 ServiceWorkerContextCore* ServiceWorkerContextWrapper::context() { |
1010 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1028 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1011 return context_core_.get(); | 1029 return context_core_.get(); |
1012 } | 1030 } |
1013 | 1031 |
1014 } // namespace content | 1032 } // namespace content |
OLD | NEW |