Bug 1713116 - Replace "mediakeys-request" literal with MediaKeys::kMediaKeysRequestTopic in C++ code. r=alwu

Differential Revision: https://phabricator.services.mozilla.com/D116106
This commit is contained in:
Bryce Seager van Dyk 2021-05-27 17:48:06 +00:00
parent 6ed5d54a6e
commit a38a1616b0
4 changed files with 12 additions and 4 deletions

View File

@ -1161,7 +1161,8 @@ void MediaKeySystemAccess::NotifyObservers(nsPIDOMWindowInner* aWindow,
NS_ConvertUTF16toUTF8(json).get());
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
obs->NotifyObservers(aWindow, "mediakeys-request", json.get());
obs->NotifyObservers(aWindow, MediaKeys::kMediaKeysRequestTopic,
json.get());
}
}

View File

@ -767,7 +767,6 @@ void MediaKeys::CheckIsElementCapturePossible() {
jw.End();
}
constexpr const char* kMediaKeysRequestTopic = "mediakeys-request";
MOZ_DIAGNOSTIC_ASSERT(!mCaptureCheckRequestJson.IsEmpty());
observerService->NotifyObservers(mParent.get(), kMediaKeysRequestTopic,
mCaptureCheckRequestJson.get());

View File

@ -165,6 +165,10 @@ class MediaKeys final : public nsIObserver,
promise->MaybeResolve(aResult);
}
// The topic used for requests related to mediakeys -- observe this to be
// notified of such requests.
constexpr static const char* kMediaKeysRequestTopic = "mediakeys-request";
private:
// Instantiate CDMProxy instance.
// It could be MediaDrmCDMProxy (Widevine on Fennec) or ChromiumCDMProxy (the

View File

@ -41,6 +41,10 @@
#include "prio.h"
#include "runnable_utils.h"
#ifdef DEBUG
# include "mozilla/dom/MediaKeys.h" // MediaKeys::kMediaKeysRequestTopic
#endif
using mozilla::ipc::Transport;
namespace mozilla::gmp {
@ -103,8 +107,8 @@ nsresult GeckoMediaPluginServiceParent::Init() {
obsService->AddObserver(this, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID, false));
#ifdef DEBUG
MOZ_ALWAYS_SUCCEEDS(
obsService->AddObserver(this, "mediakeys-request", false));
MOZ_ALWAYS_SUCCEEDS(obsService->AddObserver(
this, dom::MediaKeys::kMediaKeysRequestTopic, false));
#endif
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);