Commit 5db0455b authored by Johann's avatar Johann Committed by Commit Bot

heap mojo: migrate sync manager

Use HeapMojoRemote wrapper so that Oilpan will GC the object.

Bug: chromium:1049056
Change-Id: If487b9dd2ff48464691c300198efe6134d7aeba4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2143023
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarMugdha Lakhani <nator@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758459}
parent 94450aa9
......@@ -22,7 +22,9 @@ namespace blink {
SyncManager::SyncManager(ServiceWorkerRegistration* registration,
scoped_refptr<base::SequencedTaskRunner> task_runner)
: registration_(registration), task_runner_(std::move(task_runner)) {
: registration_(registration),
task_runner_(std::move(task_runner)),
background_sync_service_(registration->GetExecutionContext()) {
DCHECK(registration);
}
......@@ -63,7 +65,8 @@ ScriptPromise SyncManager::getTags(ScriptState* script_state) {
return promise;
}
const mojo::Remote<mojom::blink::OneShotBackgroundSyncService>&
const HeapMojoRemote<mojom::blink::OneShotBackgroundSyncService,
HeapMojoWrapperMode::kWithoutContextObserver>&
SyncManager::GetBackgroundSyncServiceRemote() {
if (!background_sync_service_.is_bound()) {
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
......@@ -152,6 +155,7 @@ void SyncManager::GetRegistrationsCallback(
void SyncManager::Trace(Visitor* visitor) {
visitor->Trace(registration_);
visitor->Trace(background_sync_service_);
ScriptWrappable::Trace(visitor);
}
......
......@@ -5,10 +5,11 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_BACKGROUND_SYNC_SYNC_MANAGER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_BACKGROUND_SYNC_SYNC_MANAGER_H_
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/background_sync/background_sync.mojom-blink.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.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/mojo/heap_mojo_wrapper_mode.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
......@@ -40,7 +41,8 @@ class SyncManager final : public ScriptWrappable {
// mojo::Remote<mojom::blink::OneShotBackgroundSyncService>. A connection with
// the browser's OneShotBackgroundSyncService is created the first time this
// method is called.
const mojo::Remote<mojom::blink::OneShotBackgroundSyncService>&
const HeapMojoRemote<mojom::blink::OneShotBackgroundSyncService,
HeapMojoWrapperMode::kWithoutContextObserver>&
GetBackgroundSyncServiceRemote();
// Callbacks
......@@ -54,7 +56,8 @@ class SyncManager final : public ScriptWrappable {
Member<ServiceWorkerRegistration> registration_;
scoped_refptr<base::SequencedTaskRunner> task_runner_;
mojo::Remote<mojom::blink::OneShotBackgroundSyncService>
HeapMojoRemote<mojom::blink::OneShotBackgroundSyncService,
HeapMojoWrapperMode::kWithoutContextObserver>
background_sync_service_;
};
......
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