Bug 1710324 - nsNativeThemeGTK shouldn't need to be an nsIObserver. r=stransky

This is just cleanup. We have better ways to run code on shutdown (the pointer
to the theme object gets cleared on shutdown anyways).

Depends on D114697

Differential Revision: https://phabricator.services.mozilla.com/D114698
This commit is contained in:
Emilio Cobos Álvarez 2021-05-11 13:57:18 +00:00
Родитель 4d41ec19c2
Коммит fea89732e3
2 изменённых файлов: 4 добавлений и 26 удалений

Просмотреть файл

@ -63,8 +63,7 @@ using namespace mozilla::gfx;
using namespace mozilla::widget;
using mozilla::dom::HTMLInputElement;
NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeGTK, nsNativeTheme, nsITheme,
nsIObserver)
NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeGTK, nsNativeTheme, nsITheme)
static int gLastGdkError;
@ -109,27 +108,11 @@ nsNativeThemeGTK::nsNativeThemeGTK() {
return;
}
// We have to call moz_gtk_shutdown before the event loop stops running.
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();
obsServ->AddObserver(this, "xpcom-shutdown", false);
ThemeChanged();
}
nsNativeThemeGTK::~nsNativeThemeGTK() = default;
NS_IMETHODIMP
nsNativeThemeGTK::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
if (!nsCRT::strcmp(aTopic, "xpcom-shutdown")) {
moz_gtk_shutdown();
} else {
MOZ_ASSERT_UNREACHABLE("unexpected topic");
return NS_ERROR_UNEXPECTED;
}
return NS_OK;
nsNativeThemeGTK::~nsNativeThemeGTK() {
moz_gtk_shutdown();
}
void nsNativeThemeGTK::RefreshWidgetWindow(nsIFrame* aFrame) {

Просмотреть файл

@ -9,21 +9,16 @@
#include "nsITheme.h"
#include "nsCOMPtr.h"
#include "nsAtom.h"
#include "nsIObserver.h"
#include "nsNativeTheme.h"
#include "nsStyleConsts.h"
#include <gtk/gtk.h>
#include "gtkdrawing.h"
class nsNativeThemeGTK final : private nsNativeTheme,
public nsITheme,
public nsIObserver {
class nsNativeThemeGTK final : private nsNativeTheme, public nsITheme {
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIOBSERVER
// The nsITheme interface.
NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
StyleAppearance aAppearance,