WillEvaluateServiceWorkerOnWorkerThread with worker token

This argument has been added to the end of the arglist, and to the use
in brave's codebase, it just gets passed along.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/b495c98dc50ae6a601527ff3f957c6c8397232e1

commit b495c98dc50ae6a601527ff3f957c6c8397232e1
Author: Justin Lulejian <jlulejian@chromium.org>
Date:   Wed Aug 14 15:48:05 2024 +0000

    [ServiceWorker] Populate service worker start token to WorkerId.

    Before this change the //extensions layer had no access to the
    blink::ServiceWorkerToken. This token tracks a worker from start until
    stop, which is very important for. Of note, this token is different than
    the `activation_token` in extensions::ServiceWorkerTaskQueue. That token
    tracks extension activation and deactivation, but is stable across
    worker start/stops.

    This supports two things:
    1) Refactoring extensions::WorkerId to track worker start/stop by the
      worker token instead of by the combination of render process id +
      thread id (which is fragile)
    2) crrev.com/c/5585866 since now the WorkerId will have a token to
      compare for removal of stopped workers from //extensions tracking

    Low-Coverage-Reason: TRIVIAL_CHANGE content_renderer_client.h only has trivial argument passing changes.
    Bug: 40936639
This commit is contained in:
Claudio DeSouza
2024-09-10 14:42:41 -04:00
committed by mkarolin
parent f038067103
commit f3a9cb6d5c
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -238,13 +238,14 @@ void BraveContentRendererClient::WillEvaluateServiceWorkerOnWorkerThread(
v8::Local<v8::Context> v8_context,
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) {
const GURL& script_url,
const blink::ServiceWorkerToken& service_worker_token) {
brave_search_service_worker_holder_.WillEvaluateServiceWorkerOnWorkerThread(
context_proxy, v8_context, service_worker_version_id,
service_worker_scope, script_url);
ChromeContentRendererClient::WillEvaluateServiceWorkerOnWorkerThread(
context_proxy, v8_context, service_worker_version_id,
service_worker_scope, script_url);
service_worker_scope, script_url, service_worker_token);
}
void BraveContentRendererClient::WillDestroyServiceWorkerContextOnWorkerThread(
+2 -1
View File
@@ -40,7 +40,8 @@ class BraveContentRendererClient : public ChromeContentRendererClient {
v8::Local<v8::Context> v8_context,
int64_t service_worker_version_id,
const GURL& service_worker_scope,
const GURL& script_url) override;
const GURL& script_url,
const blink::ServiceWorkerToken& service_worker_token) override;
void WillDestroyServiceWorkerContextOnWorkerThread(
v8::Local<v8::Context> v8_context,
int64_t service_worker_version_id,