Commit 8ccefb4d authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

Retire ScopedObserver in /components/web_cache.

ScopedObserver is being deprecated in favor of two new classes:
- base::ScopedObservation for observers that only ever observe
  a single source.
- base::ScopedMultiSourceObservation for observers that do or may
  observe more than a single source.

This CL was uploaded by git cl split.

R=sky@chromium.org

Bug: 1145565
Change-Id: I917d2102c2a9d3276355bf395db2a88749effdfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532662
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828189}
parent d4afa630
......@@ -157,7 +157,7 @@ void WebCacheManager::ClearCacheOnNavigation() {
void WebCacheManager::OnRenderProcessHostCreated(
content::RenderProcessHost* process_host) {
Add(process_host->GetID());
rph_observers_.Add(process_host);
rph_observations_.AddObservation(process_host);
}
void WebCacheManager::RenderProcessExited(
......@@ -168,7 +168,7 @@ void WebCacheManager::RenderProcessExited(
void WebCacheManager::RenderProcessHostDestroyed(
content::RenderProcessHost* process_host) {
rph_observers_.Remove(process_host);
rph_observations_.RemoveObservation(process_host);
Remove(process_host->GetID());
}
......
......@@ -19,7 +19,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/no_destructor.h"
#include "base/scoped_observer.h"
#include "base/scoped_multi_source_observation.h"
#include "base/time/time.h"
#include "components/web_cache/public/mojom/web_cache.mojom.h"
#include "content/public/browser/render_process_host.h"
......@@ -247,8 +247,9 @@ class WebCacheManager : public content::RenderProcessHostCreationObserver,
// mojo::Remote<mojom::WebCache>.
WebCacheServicesMap web_cache_services_;
ScopedObserver<content::RenderProcessHost, content::RenderProcessHostObserver>
rph_observers_{this};
base::ScopedMultiSourceObservation<content::RenderProcessHost,
content::RenderProcessHostObserver>
rph_observations_{this};
base::WeakPtrFactory<WebCacheManager> weak_factory_{this};
......
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