content_decryption_module_export.h (1364B)
1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_EXPORT_H_ 6 #define CDM_CONTENT_DECRYPTION_MODULE_EXPORT_H_ 7 8 // Define CDM_API so that functionality implemented by the CDM module 9 // can be exported to consumers. 10 #if defined(_WIN32) 11 12 #if defined(CDM_IMPLEMENTATION) 13 #define CDM_API __declspec(dllexport) 14 #else 15 #define CDM_API __declspec(dllimport) 16 #endif // defined(CDM_IMPLEMENTATION) 17 18 #else // defined(_WIN32) 19 #define CDM_API __attribute__((visibility("default"))) 20 #endif // defined(_WIN32) 21 22 // Define CDM_CLASS_API to export class types. We have to add visibility 23 // attributes to make sure virtual tables in CDM consumer and CDM implementation 24 // are the same. Generally, it was always a good idea, as there're no guarantees 25 // about that for the internal symbols, but it has only become a practical issue 26 // after introduction of LTO devirtualization. See more details on 27 // https://crbug.com/609564#c35 28 #if defined(_WIN32) 29 #if defined(__clang__) 30 #define CDM_CLASS_API [[clang::lto_visibility_public]] 31 #else 32 #define CDM_CLASS_API 33 #endif 34 #else // defined(_WIN32) 35 #define CDM_CLASS_API __attribute__((visibility("default"))) 36 #endif // defined(_WIN32) 37 38 #endif // CDM_CONTENT_DECRYPTION_MODULE_EXPORT_H_