Bug 1381720 - Reset symbol visibility when including content_decryption_module.h. r?glandium draft
authorChris Pearce <cpearce@mozilla.com>
Wed, 19 Jul 2017 10:37:14 +1200
changeset 612082 c087b288ac7c30c94548bca737a9d58eba76a6bc
parent 610291 dc91151c5ffe94f59346b9f4cbab587e6c0701a3
child 638304 3b41b9ea3b6a30104994f17d14e6dfc62e7eeb22
push id69378
push userbmo:cpearce@mozilla.com
push dateThu, 20 Jul 2017 09:19:29 +0000
reviewersglandium
bugs1381720
milestone56.0a1
Bug 1381720 - Reset symbol visibility when including content_decryption_module.h. r?glandium content_decryption_module.h is imported from the Chromium project, which does not set its symbol visibiity to hidden by default. But we do. So if we don't wrap content_decryption_module.h with defines that reset our default symbol visibility for the duration of the inlcude, we end up with build errors such as: In file included from /home/worker/workspace/build/src/dom/media/gmp/ChromiumCDMAdapter.cpp:7: /home/worker/workspace/build/src/obj-firefox/dist/include/content_decryption_module.h:921:7: error: visibility does not match previous declaration class CDM_CLASS_API Host_8 { ^ /home/worker/workspace/build/src/obj-firefox/dist/include/content_decryption_module.h:32:38: note: expanded from macro 'CDM_CLASS_API' #define CDM_CLASS_API __attribute__((visibility("default"))) ^ /home/worker/workspace/build/src/config/gcc_hidden.h:6:13: note: previous attribute is here #pragma GCC visibility push(hidden) ^ MozReview-Commit-ID: EynFPRSy0vB
dom/media/gmp/ChromiumCDMAdapter.cpp
dom/media/gmp/ChromiumCDMChild.h
dom/media/gmp/ChromiumCDMParent.cpp
dom/media/gmp/moz.build
dom/media/gmp/widevine-adapter/WidevineAdapter.cpp
dom/media/gmp/widevine-adapter/WidevineDecryptor.h
dom/media/gmp/widevine-adapter/WidevineDummyDecoder.h
dom/media/gmp/widevine-adapter/WidevineFileIO.h
dom/media/gmp/widevine-adapter/WidevineUtils.h
dom/media/gmp/widevine-adapter/WidevineVideoDecoder.h
dom/media/gmp/widevine-adapter/WidevineVideoFrame.h
dom/media/gmp/widevine-adapter/content_decryption_module_wrapper.h
dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
media/gmp-clearkey/0.1/ClearKeyCDM.h
media/gmp-clearkey/0.1/ClearKeyDecryptionManager.h
media/gmp-clearkey/0.1/ClearKeyPersistence.h
media/gmp-clearkey/0.1/ClearKeySession.h
media/gmp-clearkey/0.1/ClearKeySessionManager.cpp
media/gmp-clearkey/0.1/ClearKeySessionManager.h
media/gmp-clearkey/0.1/ClearKeyStorage.cpp
media/gmp-clearkey/0.1/ClearKeyUtils.cpp
media/gmp-clearkey/0.1/ClearKeyUtils.h
media/gmp-clearkey/0.1/VideoDecoder.h
media/gmp-clearkey/0.1/gmp-clearkey.cpp
--- a/dom/media/gmp/ChromiumCDMAdapter.cpp
+++ b/dom/media/gmp/ChromiumCDMAdapter.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChromiumCDMAdapter.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "VideoUtils.h"
 #include "gmp-api/gmp-entrypoints.h"
 #include "gmp-api/gmp-decryption.h"
 #include "gmp-api/gmp-video-codec.h"
 #include "gmp-api/gmp-platform.h"
 #include "WidevineUtils.h"
 #include "GMPLog.h"
 
--- a/dom/media/gmp/ChromiumCDMChild.h
+++ b/dom/media/gmp/ChromiumCDMChild.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ChromiumCDMChild_h_
 #define ChromiumCDMChild_h_
 
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "mozilla/gmp/PChromiumCDMChild.h"
 #include "SimpleMap.h"
 #include "WidevineVideoFrame.h"
 
 namespace mozilla {
 namespace gmp {
 
 class GMPContentChild;
--- a/dom/media/gmp/ChromiumCDMParent.cpp
+++ b/dom/media/gmp/ChromiumCDMParent.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChromiumCDMParent.h"
 
 #include "ChromiumCDMProxy.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "GMPContentChild.h"
 #include "GMPContentParent.h"
 #include "GMPLog.h"
 #include "GMPUtils.h"
 #include "MediaPrefs.h"
 #include "mozilla/dom/MediaKeyMessageEventBinding.h"
 #include "mozilla/gmp/GMPTypes.h"
 #include "mozilla/Telemetry.h"
--- a/dom/media/gmp/moz.build
+++ b/dom/media/gmp/moz.build
@@ -64,16 +64,17 @@ EXPORTS += [
     'GMPVideoEncoderParent.h',
     'GMPVideoEncoderProxy.h',
     'GMPVideoHost.h',
     'GMPVideoi420FrameImpl.h',
     'GMPVideoPlaneImpl.h',
     'widevine-adapter/content_decryption_module.h',
     'widevine-adapter/content_decryption_module_export.h',
     'widevine-adapter/content_decryption_module_ext.h',
+    'widevine-adapter/content_decryption_module_wrapper.h',
 ]
 
 UNIFIED_SOURCES += [
     'ChromiumCDMAdapter.cpp',
     'ChromiumCDMChild.cpp',
     'ChromiumCDMParent.cpp',
     'ChromiumCDMProxy.cpp',
     'DecryptJob.cpp',
--- a/dom/media/gmp/widevine-adapter/WidevineAdapter.cpp
+++ b/dom/media/gmp/widevine-adapter/WidevineAdapter.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WidevineAdapter.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "VideoUtils.h"
 #include "WidevineDecryptor.h"
 #include "WidevineDummyDecoder.h"
 #include "WidevineUtils.h"
 #include "WidevineVideoDecoder.h"
 #include "gmp-api/gmp-entrypoints.h"
 #include "gmp-api/gmp-decryption.h"
 #include "gmp-api/gmp-video-codec.h"
--- a/dom/media/gmp/widevine-adapter/WidevineDecryptor.h
+++ b/dom/media/gmp/widevine-adapter/WidevineDecryptor.h
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WidevineDecryptor_h_
 #define WidevineDecryptor_h_
 
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "gmp-api/gmp-decryption.h"
 #include "mozilla/RefPtr.h"
 #include "WidevineUtils.h"
 #include <map>
 
 namespace mozilla {
 
 class WidevineDecryptor : public GMPDecryptor
--- a/dom/media/gmp/widevine-adapter/WidevineDummyDecoder.h
+++ b/dom/media/gmp/widevine-adapter/WidevineDummyDecoder.h
@@ -1,13 +1,13 @@
 #ifndef WidevineDummyDecoder_h_
 #define WidevineDummyDecoder_h_
 
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "gmp-api/gmp-video-decode.h"
 #include "gmp-api/gmp-video-host.h"
 #include "WidevineDecryptor.h"
 #include "WidevineVideoFrame.h"
 
 
 namespace mozilla {
 
--- a/dom/media/gmp/widevine-adapter/WidevineFileIO.h
+++ b/dom/media/gmp/widevine-adapter/WidevineFileIO.h
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WidevineFileIO_h_
 #define WidevineFileIO_h_
 
 #include <stddef.h>
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "gmp-api/gmp-storage.h"
 #include <string>
 
 namespace mozilla {
 
 class WidevineFileIO : public cdm::FileIO
                      , public GMPRecordClient
 {
--- a/dom/media/gmp/widevine-adapter/WidevineUtils.h
+++ b/dom/media/gmp/widevine-adapter/WidevineUtils.h
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WidevineUtils_h_
 #define WidevineUtils_h_
 
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "gmp-api/gmp-decryption.h"
 #include "gmp-api/gmp-platform.h"
 #include "nsISupportsImpl.h"
 #include "nsTArray.h"
 #include "mozilla/Logging.h"
 
 namespace mozilla {
 
--- a/dom/media/gmp/widevine-adapter/WidevineVideoDecoder.h
+++ b/dom/media/gmp/widevine-adapter/WidevineVideoDecoder.h
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WidevineVideoDecoder_h_
 #define WidevineVideoDecoder_h_
 
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "gmp-api/gmp-video-decode.h"
 #include "gmp-api/gmp-video-host.h"
 #include "MediaData.h"
 #include "nsISupportsImpl.h"
 #include "nsTArray.h"
 #include "WidevineDecryptor.h"
 #include "WidevineVideoFrame.h"
 #include <map>
--- a/dom/media/gmp/widevine-adapter/WidevineVideoFrame.h
+++ b/dom/media/gmp/widevine-adapter/WidevineVideoFrame.h
@@ -2,17 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef WidevineVideoFrame_h_
 #define WidevineVideoFrame_h_
 
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "mozilla/Attributes.h"
 #include <vector>
 
 namespace mozilla {
 
 class WidevineVideoFrame : public cdm::VideoFrame {
 public:
   WidevineVideoFrame();
new file mode 100644
--- /dev/null
+++ b/dom/media/gmp/widevine-adapter/content_decryption_module_wrapper.h
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+
+#ifndef content_decryption_module_wrapper_h
+#define content_decryption_module_wrapper_h
+
+// content_decryption_module.h is taken from the Chromium project,
+// which unlike us doesn't have a default symbol visibility of
+// hidden; we set it in gcc_hidden.h. So if we don't reset the
+// symbol visibility when we include content_decryption_module.h
+// we'll get visibility conflicts.
+
+#ifdef __GNUC__
+#pragma GCC visibility push(default)
+#endif
+
+#include "content_decryption_module.h"
+
+#ifdef __GNUC__
+#pragma GCC visibility pop
+#endif
+
+#endif // content_decryption_module_wrapper_h
--- a/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/eme/ChromiumCDMVideoDecoder.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ChromiumCDMVideoDecoder.h"
 #include "ChromiumCDMProxy.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "GMPService.h"
 #include "GMPVideoDecoder.h"
 #include "MP4Decoder.h"
 #include "VPXDecoder.h"
 
 namespace mozilla {
 
 ChromiumCDMVideoDecoder::ChromiumCDMVideoDecoder(
--- a/media/gmp-clearkey/0.1/ClearKeyCDM.h
+++ b/media/gmp-clearkey/0.1/ClearKeyCDM.h
@@ -1,17 +1,17 @@
 #ifndef ClearKeyCDM_h_
 #define ClearKeyCDM_h_
 
 #include "ClearKeySessionManager.h"
 
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 
 #ifdef ENABLE_WMF
 #include "WMFUtils.h"
 #include "VideoDecoder.h"
 #endif
 
 class ClearKeyCDM : public cdm::ContentDecryptionModule_8
 {
@@ -90,9 +90,9 @@ public:
   void
     OnQueryOutputProtectionStatus(cdm::QueryResult aResult,
                                   uint32_t aLinkMask,
                                   uint32_t aOutputProtectionMask) override;
 
   void Destroy() override;
 };
 
-#endif
\ No newline at end of file
+#endif
--- a/media/gmp-clearkey/0.1/ClearKeyDecryptionManager.h
+++ b/media/gmp-clearkey/0.1/ClearKeyDecryptionManager.h
@@ -16,17 +16,17 @@
 
 #ifndef __ClearKeyDecryptionManager_h__
 #define __ClearKeyDecryptionManager_h__
 
 #include "ClearKeyUtils.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "RefCounted.h"
 
 #include <map>
 
 class ClearKeyDecryptor;
 
 class CryptoMetaData
 {
--- a/media/gmp-clearkey/0.1/ClearKeyPersistence.h
+++ b/media/gmp-clearkey/0.1/ClearKeyPersistence.h
@@ -15,17 +15,17 @@
  */
 
 #ifndef __ClearKeyPersistence_h__
 #define __ClearKeyPersistence_h__
 
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "RefCounted.h"
 
 #include <functional>
 #include <set>
 #include <string>
 #include <vector>
 
 
--- a/media/gmp-clearkey/0.1/ClearKeySession.h
+++ b/media/gmp-clearkey/0.1/ClearKeySession.h
@@ -16,17 +16,17 @@
 
 #ifndef __ClearKeySession_h__
 #define __ClearKeySession_h__
 
 #include "ClearKeyUtils.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 
 #include <string>
 #include <vector>
 
 class ClearKeySession
 {
 public:
   explicit ClearKeySession(const std::string& aSessionId,
--- a/media/gmp-clearkey/0.1/ClearKeySessionManager.cpp
+++ b/media/gmp-clearkey/0.1/ClearKeySessionManager.cpp
@@ -17,17 +17,17 @@
 #include "ClearKeyDecryptionManager.h"
 #include "ClearKeySessionManager.h"
 #include "ClearKeyUtils.h"
 #include "ClearKeyStorage.h"
 #include "ClearKeyPersistence.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "psshparser/PsshParser.h"
 
 #include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 
 using namespace std;
--- a/media/gmp-clearkey/0.1/ClearKeySessionManager.h
+++ b/media/gmp-clearkey/0.1/ClearKeySessionManager.h
@@ -19,17 +19,17 @@
 
 #include "ClearKeyDecryptionManager.h"
 #include "ClearKeyPersistence.h"
 #include "ClearKeySession.h"
 #include "ClearKeyUtils.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "RefCounted.h"
 
 #include <functional>
 #include <map>
 #include <queue>
 #include <set>
 #include <string>
 
--- a/media/gmp-clearkey/0.1/ClearKeyStorage.cpp
+++ b/media/gmp-clearkey/0.1/ClearKeyStorage.cpp
@@ -16,17 +16,17 @@
 
 #include "ClearKeyStorage.h"
 
 #include "ClearKeyUtils.h"
 
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 
 #include <assert.h>
 #include "ArrayUtils.h"
 #include <vector>
 
 using namespace cdm;
 using namespace std;
 
--- a/media/gmp-clearkey/0.1/ClearKeyUtils.cpp
+++ b/media/gmp-clearkey/0.1/ClearKeyUtils.cpp
@@ -29,17 +29,17 @@
 #include <vector>
 
 #include "ArrayUtils.h"
 #include "BigEndian.h"
 #include "ClearKeyBase64.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "openaes/oaes_lib.h"
 #include "psshparser/PsshParser.h"
 
 using namespace cdm;
 using namespace std;
 
 void
 CK_Log(const char* aFmt, ...)
--- a/media/gmp-clearkey/0.1/ClearKeyUtils.h
+++ b/media/gmp-clearkey/0.1/ClearKeyUtils.h
@@ -20,17 +20,17 @@
 #include <stdint.h>
 #include <string>
 #include <vector>
 #include <assert.h>
 
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 
 #if 0
 void CK_Log(const char* aFmt, ...);
 #define CK_LOGE(...) CK_Log(__VA_ARGS__)
 #define CK_LOGD(...) CK_Log(__VA_ARGS__)
 #define CK_LOGW(...) CK_Log(__VA_ARGS__)
 #define CK_LOGARRAY(APREPEND, ADATA, ADATA_SIZE) CK_LogArray(APREPEND, \
   ADATA, \
--- a/media/gmp-clearkey/0.1/VideoDecoder.h
+++ b/media/gmp-clearkey/0.1/VideoDecoder.h
@@ -19,17 +19,17 @@
 
 #include <atomic>
 #include <queue>
 #include <thread>
 
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 #include "WMFH264Decoder.h"
 
 class VideoDecoder : public RefCounted
 {
 public:
   explicit VideoDecoder(cdm::Host_8 *aHost);
 
   cdm::Status InitDecode(const cdm::VideoDecoderConfig& aConfig);
--- a/media/gmp-clearkey/0.1/gmp-clearkey.cpp
+++ b/media/gmp-clearkey/0.1/gmp-clearkey.cpp
@@ -18,17 +18,17 @@
 #include <stdio.h>
 #include <string.h>
 
 #include "ClearKeyCDM.h"
 #include "ClearKeySessionManager.h"
 // This include is required in order for content_decryption_module to work
 // on Unix systems.
 #include "stddef.h"
-#include "content_decryption_module.h"
+#include "content_decryption_module_wrapper.h"
 
 #ifdef ENABLE_WMF
 #include "WMFUtils.h"
 #endif // ENABLE_WMF
 
 extern "C" {
 
 CDM_API