Commit 12c65088 authored by James Cook's avatar James Cook Committed by Commit Bot

Convert AppWindowRegistry::Observer to CheckedObserver

This will give us better protection against use-after-free. I don't
think there are any performance concerns about this observer -- it is
rarely added and removed.

Bug: none
Change-Id: Ia1aa911e219dbddde0e40b564a73ca66e34ace5c
Reviewed-on: https://chromium-review.googlesource.com/c/1316647Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605343}
parent b5ccedd6
......@@ -9,10 +9,9 @@
#include <set>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/devtools_agent_host_observer.h"
......@@ -33,7 +32,7 @@ class AppWindow;
class AppWindowRegistry : public KeyedService,
public content::DevToolsAgentHostObserver {
public:
class Observer {
class Observer : public base::CheckedObserver {
public:
// Called just after an app window was added.
virtual void OnAppWindowAdded(AppWindow* app_window);
......@@ -51,7 +50,7 @@ class AppWindowRegistry : public KeyedService,
virtual void OnAppWindowActivated(AppWindow* app_window);
protected:
virtual ~Observer();
~Observer() override;
};
typedef std::list<AppWindow*> AppWindowList;
......@@ -155,7 +154,7 @@ class AppWindowRegistry : public KeyedService,
content::BrowserContext* context_;
AppWindowList app_windows_;
InspectedWindowSet inspected_windows_;
base::ObserverList<Observer>::Unchecked observers_;
base::ObserverList<Observer> observers_;
};
} // namespace extensions
......
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