Commit a9d20f06 authored by Johann's avatar Johann Committed by Commit Bot

heap mojo: migrate cookie_store_manager backend_

Use HeapMojo wrappers so that Oilpan will GC the objects.

BUG=chromium:1049056

Change-Id: I4d63383514d691cb40afe7e42fa5e57c8fe57589
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2226096Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Commit-Queue: Johann Koenig <johannkoenig@google.com>
Cr-Commit-Position: refs/heads/master@{#773993}
parent 0b93110f
......@@ -105,16 +105,15 @@ KURL DefaultCookieURL(ServiceWorkerRegistration* registration) {
CookieStoreManager::CookieStoreManager(
ServiceWorkerRegistration* registration,
mojo::Remote<mojom::blink::CookieStore> backend)
HeapMojoRemote<mojom::blink::CookieStore,
HeapMojoWrapperMode::kWithoutContextObserver> backend)
: registration_(registration),
backend_(std::move(backend)),
default_cookie_url_(DefaultCookieURL(registration)) {
DCHECK(registration_);
DCHECK(backend_);
DCHECK(backend_.is_bound());
}
CookieStoreManager::~CookieStoreManager() = default;
ScriptPromise CookieStoreManager::subscribe(
ScriptState* script_state,
const HeapVector<Member<CookieStoreGetOptions>>& subscriptions,
......@@ -186,6 +185,7 @@ ScriptPromise CookieStoreManager::getSubscriptions(
void CookieStoreManager::Trace(Visitor* visitor) const {
visitor->Trace(registration_);
visitor->Trace(backend_);
ScriptWrappable::Trace(visitor);
}
......
......@@ -5,12 +5,13 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_COOKIE_STORE_COOKIE_STORE_MANAGER_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_COOKIE_STORE_COOKIE_STORE_MANAGER_H_
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/cookie_store/cookie_store.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.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/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
......@@ -25,11 +26,10 @@ class CookieStoreManager final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
CookieStoreManager(ServiceWorkerRegistration* registration,
mojo::Remote<mojom::blink::CookieStore> backend);
// Needed because of the
// mojo::Remote<network::mojom::blink::CookieStore>
~CookieStoreManager() override;
CookieStoreManager(
ServiceWorkerRegistration* registration,
HeapMojoRemote<mojom::blink::CookieStore,
HeapMojoWrapperMode::kWithoutContextObserver> backend);
ScriptPromise subscribe(
ScriptState* script_state,
......@@ -62,7 +62,9 @@ class CookieStoreManager final : public ScriptWrappable {
Member<ServiceWorkerRegistration> registration_;
// Wraps a Mojo pipe for managing service worker cookie change subscriptions.
mojo::Remote<mojom::blink::CookieStore> backend_;
HeapMojoRemote<mojom::blink::CookieStore,
HeapMojoWrapperMode::kWithoutContextObserver>
backend_;
// Default for cookie_url in CookieStoreGetOptions.
//
......
......@@ -7,6 +7,8 @@
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/modules/cookie_store/cookie_store_manager.h"
#include "third_party/blink/renderer/modules/service_worker/service_worker_registration.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_wrapper_mode.h"
namespace blink {
......@@ -52,7 +54,9 @@ class ServiceWorkerRegistrationCookiesImpl final
return nullptr;
}
mojo::Remote<mojom::blink::CookieStore> backend;
HeapMojoRemote<mojom::blink::CookieStore,
HeapMojoWrapperMode::kWithoutContextObserver>
backend(execution_context);
// TODO(pwnall): Replace TaskType::kInternalDefault with the task queue in
// the Cookie Store spec, once that spec is finalized.
execution_context->GetBrowserInterfaceBroker().GetInterface(
......
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