blink: Let OneShotBackgroundSyncService be obtained via
ExecutionContent-scoped BIB Migrated OneShotBackgroundSyncService interface; let it be obtained via an ExecutionContent-scoped BrowserInterfaceBroker instead of a Process-wide one. Then it can be controllable when prerendering a page. Also fixed an error in webtest comments to make it be in accordance with the error message. Change-Id: I94ccdc65586b895f52f02972971338926e3b63a0 Bug: 1126758 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2395995 Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Commit-Queue: Lingqi Chi <lingqi@chromium.org> Cr-Commit-Position: refs/heads/master@{#807317}
This commit is contained in:
content
browser
public
third_party/blink
@ -74,6 +74,7 @@
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/mojom/appcache/appcache.mojom.h"
|
||||
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
|
||||
#include "third_party/blink/public/mojom/background_sync/background_sync.mojom.h"
|
||||
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
|
||||
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
|
||||
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom.h"
|
||||
@ -679,6 +680,10 @@ void PopulateFrameBinders(RenderFrameHostImpl* host, mojo::BinderMap* map) {
|
||||
base::Unretained(host)));
|
||||
#endif
|
||||
|
||||
map->Add<blink::mojom::OneShotBackgroundSyncService>(
|
||||
base::BindRepeating(&RenderProcessHost::CreateOneShotSyncService,
|
||||
base::Unretained(host->GetProcess())));
|
||||
|
||||
map->Add<media::mojom::VideoDecodePerfHistory>(
|
||||
base::BindRepeating(&RenderProcessHost::BindVideoDecodePerfHistory,
|
||||
base::Unretained(host->GetProcess())));
|
||||
@ -1023,6 +1028,9 @@ void PopulateServiceWorkerBinders(ServiceWorkerHost* host,
|
||||
// render process host binders
|
||||
map->Add<media::mojom::VideoDecodePerfHistory>(BindServiceWorkerReceiver(
|
||||
&RenderProcessHostImpl::BindVideoDecodePerfHistory, host));
|
||||
map->Add<blink::mojom::OneShotBackgroundSyncService>(
|
||||
BindServiceWorkerReceiver(
|
||||
&RenderProcessHostImpl::CreateOneShotSyncService, host));
|
||||
}
|
||||
|
||||
void PopulateBinderMapWithContext(
|
||||
|
@ -2311,10 +2311,6 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
|
||||
base::BindRepeating(&RenderProcessHostImpl::BindCompositingModeReporter,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
|
||||
AddUIThreadInterface(
|
||||
registry.get(),
|
||||
base::BindRepeating(&RenderProcessHostImpl::CreateOneShotSyncService,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
AddUIThreadInterface(
|
||||
registry.get(),
|
||||
base::BindRepeating(&RenderProcessHostImpl::CreatePeriodicSyncService,
|
||||
@ -2665,6 +2661,7 @@ void RenderProcessHostImpl::BindAecDumpManager(
|
||||
void RenderProcessHostImpl::CreateOneShotSyncService(
|
||||
mojo::PendingReceiver<blink::mojom::OneShotBackgroundSyncService>
|
||||
receiver) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
storage_partition_impl_->GetBackgroundSyncContext()->CreateOneShotSyncService(
|
||||
std::move(receiver));
|
||||
}
|
||||
|
@ -584,6 +584,13 @@ class CONTENT_EXPORT RenderProcessHostImpl
|
||||
mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver)
|
||||
override;
|
||||
|
||||
// Binds |receiver| to a OneShotBackgroundSyncService instance owned by the
|
||||
// StoragePartition associated with the render process host, and is used by
|
||||
// frames and service workers via BrowserInterfaceBroker.
|
||||
void CreateOneShotSyncService(
|
||||
mojo::PendingReceiver<blink::mojom::OneShotBackgroundSyncService>
|
||||
receiver) override;
|
||||
|
||||
// Binds |receiver| to a QuotaManagerHost instance indirectly owned by the
|
||||
// StoragePartition associated with the render process host. Used by frames
|
||||
// and workers via BrowserInterfaceBroker.
|
||||
@ -780,9 +787,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
|
||||
mojo::PendingReceiver<blink::mojom::WebDatabaseHost> receiver);
|
||||
void BindAecDumpManager(
|
||||
mojo::PendingReceiver<blink::mojom::AecDumpManager> receiver);
|
||||
void CreateOneShotSyncService(
|
||||
mojo::PendingReceiver<blink::mojom::OneShotBackgroundSyncService>
|
||||
receiver);
|
||||
void CreatePeriodicSyncService(
|
||||
mojo::PendingReceiver<blink::mojom::PeriodicBackgroundSyncService>
|
||||
receiver);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "services/network/public/mojom/restricted_cookie_manager.mojom-forward.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
|
||||
#include "third_party/blink/public/mojom/appcache/appcache.mojom.h"
|
||||
#include "third_party/blink/public/mojom/background_sync/background_sync.mojom.h"
|
||||
#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-forward.h"
|
||||
#include "third_party/blink/public/mojom/filesystem/file_system.mojom-forward.h"
|
||||
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-forward.h"
|
||||
@ -503,6 +504,9 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
|
||||
receiver) = 0;
|
||||
virtual void BindVideoDecodePerfHistory(
|
||||
mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver) = 0;
|
||||
virtual void CreateOneShotSyncService(
|
||||
mojo::PendingReceiver<blink::mojom::OneShotBackgroundSyncService>
|
||||
receiver) = 0;
|
||||
virtual void BindQuotaManagerHost(
|
||||
int render_frame_id,
|
||||
const url::Origin& origin,
|
||||
|
@ -199,6 +199,9 @@ class MockRenderProcessHost : public RenderProcessHost {
|
||||
int render_frame_id,
|
||||
const url::Origin& origin,
|
||||
mojo::PendingReceiver<blink::mojom::LockManager> receiver) override {}
|
||||
void CreateOneShotSyncService(
|
||||
mojo::PendingReceiver<blink::mojom::OneShotBackgroundSyncService>
|
||||
receiver) override {}
|
||||
void CreatePermissionService(
|
||||
const url::Origin& origin,
|
||||
mojo::PendingReceiver<blink::mojom::PermissionService> receiver)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "third_party/blink/renderer/modules/background_sync/sync_manager.h"
|
||||
|
||||
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
|
||||
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
|
||||
#include "third_party/blink/public/platform/platform.h"
|
||||
#include "third_party/blink/renderer/bindings/core/v8/callback_promise_adapter.h"
|
||||
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
|
||||
@ -25,7 +25,7 @@ SyncManager::SyncManager(ServiceWorkerRegistration* registration,
|
||||
: registration_(registration),
|
||||
background_sync_service_(registration->GetExecutionContext()) {
|
||||
DCHECK(registration);
|
||||
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
||||
registration->GetExecutionContext()->GetBrowserInterfaceBroker().GetInterface(
|
||||
background_sync_service_.BindNewPipeAndPassReceiver(task_runner));
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ promise_test(function(t) {
|
||||
const scope = '/resources/scope/background_sync/' + iframe_scope;
|
||||
var sync_manager;
|
||||
|
||||
// This test verifies that registration of one-shots fails from an iframe.
|
||||
// This test verifies that one-shot syncs can be registered from an iframe.
|
||||
return PermissionsHelper.setPermission('background-sync', 'granted')
|
||||
.then(function() {
|
||||
return service_worker_unregister_and_register(t, url, scope);
|
||||
|
Reference in New Issue
Block a user