Commit b6efc006 authored by Tal Pressman's avatar Tal Pressman Committed by Commit Bot

Migrate BackgroundFetchBridge to use GC mojo wrappers.

Bug: 1049056
Change-Id: I45bfba484c6d8c99190568a5965a33e996c37bbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078520Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Tal Pressman <talp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746679}
parent 7d883e25
......@@ -37,10 +37,16 @@ const char BackgroundFetchBridge::kSupplementName[] = "BackgroundFetchBridge";
BackgroundFetchBridge::BackgroundFetchBridge(
ServiceWorkerRegistration& registration)
: Supplement<ServiceWorkerRegistration>(registration) {}
: Supplement<ServiceWorkerRegistration>(registration),
background_fetch_service_(registration.GetExecutionContext()) {}
BackgroundFetchBridge::~BackgroundFetchBridge() = default;
void BackgroundFetchBridge::Trace(Visitor* visitor) {
visitor->Trace(background_fetch_service_);
Supplement::Trace(visitor);
}
void BackgroundFetchBridge::GetIconDisplaySize(
GetIconDisplaySizeCallback callback) {
GetService()->GetIconDisplaySize(std::move(callback));
......@@ -92,7 +98,7 @@ void BackgroundFetchBridge::GetDeveloperIds(GetDeveloperIdsCallback callback) {
}
mojom::blink::BackgroundFetchService* BackgroundFetchBridge::GetService() {
if (!background_fetch_service_) {
if (!background_fetch_service_.is_bound()) {
auto receiver = background_fetch_service_.BindNewPipeAndPassReceiver(
GetSupplementable()->GetExecutionContext()->GetTaskRunner(
TaskType::kBackgroundFetch));
......
......@@ -8,10 +8,10 @@
#include <memory>
#include "base/macros.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom-blink.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/supplementable.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
......@@ -44,6 +44,7 @@ class BackgroundFetchBridge final
explicit BackgroundFetchBridge(ServiceWorkerRegistration& registration);
virtual ~BackgroundFetchBridge();
void Trace(Visitor* visitor) override;
// Creates a new Background Fetch registration identified by |developer_id|
// for the sequence of |requests|. The |callback| will be invoked when the
......@@ -80,7 +81,8 @@ class BackgroundFetchBridge final
mojom::blink::BackgroundFetchError error,
mojom::blink::BackgroundFetchRegistrationPtr registration_ptr);
mojo::Remote<mojom::blink::BackgroundFetchService> background_fetch_service_;
HeapMojoRemote<mojom::blink::BackgroundFetchService>
background_fetch_service_;
DISALLOW_COPY_AND_ASSIGN(BackgroundFetchBridge);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment