Bug 1592797 - Fix MediaKeys linker error exposed with different optimization flags r=edgar
authorAndrew Creskey <acreskey@mozilla.com>
Thu, 14 Nov 2019 14:06:12 +0000
changeset 501979 5ee8c7c51c04274fe88aa28cf7b3e3008d7a6da8
parent 501978 1ca7e5b24181b20b3a63c3b11227ba46afabdb94
child 501980 e28e46ca4a17fc887d2f206b13bca33d205112d7
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedgar
bugs1592797
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1592797 - Fix MediaKeys linker error exposed with different optimization flags r=edgar Seeing this linker error when building with optimization flags -O2 and others: .../mozilla-central/dom/media/eme/mediadrm/MediaDrmCDMProxy.cpp:297: error: undefined reference to 'void mozilla::dom::MediaKeys::ResolvePromiseWithResult<bool>(unsigned int, bool const&)' This patch moves the template definition from dom/media/eme/MediaKeys.cpp to dom/media/eme/MediaKeys.h Differential Revision: https://phabricator.services.mozilla.com/D51188
dom/media/eme/MediaKeys.cpp
dom/media/eme/MediaKeys.h
--- a/dom/media/eme/MediaKeys.cpp
+++ b/dom/media/eme/MediaKeys.cpp
@@ -564,26 +564,16 @@ already_AddRefed<MediaKeySession> MediaK
 
 void MediaKeys::OnSessionLoaded(PromiseId aId, bool aSuccess) {
   EME_LOG("MediaKeys[%p]::OnSessionLoaded() resolve promise id=%" PRIu32, this,
           aId);
 
   ResolvePromiseWithResult(aId, aSuccess);
 }
 
-template <typename T>
-void MediaKeys::ResolvePromiseWithResult(PromiseId aId, const T& aResult) {
-  RefPtr<DetailedPromise> promise(RetrievePromise(aId));
-  if (!promise) {
-    return;
-  }
-
-  promise->MaybeResolve(aResult);
-}
-
 void MediaKeys::OnSessionClosed(MediaKeySession* aSession) {
   nsAutoString id;
   aSession->GetSessionId(id);
   mKeySessions.Remove(id);
 }
 
 already_AddRefed<MediaKeySession> MediaKeys::GetSession(
     const nsAString& aSessionId) {
--- a/dom/media/eme/MediaKeys.h
+++ b/dom/media/eme/MediaKeys.h
@@ -144,17 +144,23 @@ class MediaKeys final : public nsIDocume
   // JavaScript: MediaKeys.GetStatusForPolicy()
   already_AddRefed<Promise> GetStatusForPolicy(const MediaKeysPolicy& aPolicy,
                                                ErrorResult& aR);
   // Called by CDMProxy when CDM successfully GetStatusForPolicy.
   void ResolvePromiseWithKeyStatus(PromiseId aId,
                                    dom::MediaKeyStatus aMediaKeyStatus);
 
   template <typename T>
-  void ResolvePromiseWithResult(PromiseId aId, const T& aResult);
+  void ResolvePromiseWithResult(PromiseId aId, const T& aResult) {
+    RefPtr<DetailedPromise> promise(RetrievePromise(aId));
+    if (!promise) {
+      return;
+    }
+    promise->MaybeResolve(aResult);
+  }
 
  private:
   // Instantiate CDMProxy instance.
   // It could be MediaDrmCDMProxy (Widevine on Fennec) or ChromiumCDMProxy (the
   // rest).
   already_AddRefed<CDMProxy> CreateCDMProxy(nsISerialEventTarget* aMainThread);
 
   // Removes promise from mPromises, and returns it.