From 6d0e9ec9251f94de4ca0ac9842864e231fa6ada1 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 4 Oct 2016 16:38:52 -0400 Subject: [PATCH] Bug 1304722 - don't define nsCString constants in VideoUtils.h; r=mattwoodrow Doing this causes a separate copy of each string to be included in each compilation unit that includes VideoUtils.h, and since global nsLiteralCString objects require a static constructor, injects static constructors into all those compilation units as well. Moving the object definitions to a source file and leaving the declarations in the header makes everything work as expected. --- dom/media/VideoUtils.cpp | 4 ++++ dom/media/VideoUtils.h | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index ef7cdda857cf..57b7a94811df 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -29,6 +29,10 @@ namespace mozilla { +NS_NAMED_LITERAL_CSTRING(kEMEKeySystemClearkey, "org.w3.clearkey"); +NS_NAMED_LITERAL_CSTRING(kEMEKeySystemWidevine, "com.widevine.alpha"); +NS_NAMED_LITERAL_CSTRING(kEMEKeySystemPrimetime, "com.adobe.primetime"); + using layers::PlanarYCbCrImage; CheckedInt64 SaferMultDiv(int64_t aValue, uint32_t aMul, uint32_t aDiv) { diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index c9179d9d3e78..a297a6f54662 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -40,9 +40,9 @@ using mozilla::CheckedUint32; namespace mozilla { // EME Key System String. -static NS_NAMED_LITERAL_CSTRING(kEMEKeySystemClearkey, "org.w3.clearkey"); -static NS_NAMED_LITERAL_CSTRING(kEMEKeySystemWidevine, "com.widevine.alpha"); -static NS_NAMED_LITERAL_CSTRING(kEMEKeySystemPrimetime, "com.adobe.primetime"); +extern const nsLiteralCString kEMEKeySystemClearkey; +extern const nsLiteralCString kEMEKeySystemWidevine; +extern const nsLiteralCString kEMEKeySystemPrimetime; /** * ReentrantMonitorConditionallyEnter