Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Issue 1956123002: Fix visibility for CDM API types and functions. (Closed)

Created:
4 years, 7 months ago by krasin
Modified:
4 years, 7 months ago
Reviewers:
Nico, xhwang, ddorwin, pcc1
CC:
cdm-api-reviews_chromium.org, feature-media-reviews_chromium.org, jrummell
Base URL:
https://chromium.googlesource.com/chromium/cdm.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Fix visibility for CDM API types and functions. This change does three different things: 1. Renames CDM_EXPORT macro to CDM_API. While not strictly necessary, _EXPORT macros in Chrome are used for controlling visibility in the components builds. See https://chromium.googlesource.com/chromium/src/+/b387864d3341fca140a7bb837e959834d35b0591 for more details. 2. On POSIX, CDM_API will set visibility("default") for both the exporter and importer code. Otherwise, the linker is free to make optimizations which will break the code, see https://bugs.chromium.org/p/chromium/issues/detail?id=609564#c36 3. Mark interface classes with CDM_API to avoid being hit by devirtualization, see https://bugs.chromium.org/p/chromium/issues/detail?id=609564#c35 and other comments in that bug. This CL should fix UBSan Vptr buildbot, which has become recently more rigorous (after a roll of the new Clang). BUG=609564, 609175 R=pcc@chromium.org, xhwang@chromium.org Committed: https://chromium.googlesource.com/chromium/cdm/+/0f9542b7d8e81eb8aa6255438b2c1907ecc3d782

Patch Set 1 #

Total comments: 2

Patch Set 2 : add note #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -25 lines) Patch
M content_decryption_module.h View 1 13 chunks +20 lines, -25 lines 0 comments Download

Messages

Total messages: 22 (4 generated)
krasin
Peter, Nico, please, review this CL before the cdm/api owners, as the complexity of the ...
4 years, 7 months ago (2016-05-06 23:25:53 UTC) #2
krasin
Also, please, ignore the trybot. Trybots don't work for the media/cdm/api repo. Locally, I verified ...
4 years, 7 months ago (2016-05-06 23:26:51 UTC) #3
krasin
Peter, friendly ping.
4 years, 7 months ago (2016-05-09 22:54:36 UTC) #4
pcc1
lgtm if owners are ok with it. https://codereview.chromium.org/1956123002/diff/1/content_decryption_module.h File content_decryption_module.h (left): https://codereview.chromium.org/1956123002/diff/1/content_decryption_module.h#oldcode18 content_decryption_module.h:18: // can ...
4 years, 7 months ago (2016-05-09 23:01:15 UTC) #5
krasin
Hi David, this CL fixes inconsistent visibility declarations on Linux, which could lead to miscompilations, ...
4 years, 7 months ago (2016-05-10 01:04:07 UTC) #7
krasin
https://codereview.chromium.org/1956123002/diff/1/content_decryption_module.h File content_decryption_module.h (left): https://codereview.chromium.org/1956123002/diff/1/content_decryption_module.h#oldcode18 content_decryption_module.h:18: // can be exported to consumers. On 2016/05/09 23:01:15, ...
4 years, 7 months ago (2016-05-10 01:09:20 UTC) #8
ddorwin
xhwang might remember more of the background on this.
4 years, 7 months ago (2016-05-10 01:16:22 UTC) #10
xhwang
On 2016/05/10 01:16:22, ddorwin wrote: > xhwang might remember more of the background on this. ...
4 years, 7 months ago (2016-05-10 05:19:31 UTC) #11
krasin
Thank you, Xiaohan!
4 years, 7 months ago (2016-05-10 05:38:12 UTC) #12
krasin
Committed patchset #2 (id:20001) manually as 0f9542b7d8e81eb8aa6255438b2c1907ecc3d782 (presubmit successful).
4 years, 7 months ago (2016-05-10 05:38:59 UTC) #14
krasin
FYI: while trying to roll the deps, I realized that this change is not correct ...
4 years, 7 months ago (2016-05-10 18:42:31 UTC) #15
ddorwin
On 2016/05/10 18:42:31, krasin wrote: > FYI: while trying to roll the deps, I realized ...
4 years, 7 months ago (2016-05-10 18:49:53 UTC) #16
krasin
> Yes, that is fine assuming you plan to fix it soon. Sure. That's a ...
4 years, 7 months ago (2016-05-10 18:57:29 UTC) #17
Nico
Previously, only C functions got exported. Now, we export C++ classes. Do we really want ...
4 years, 7 months ago (2016-05-10 21:06:52 UTC) #18
krasin
On 2016/05/10 21:06:52, Nico wrote: > Previously, only C functions got exported. Now, we export ...
4 years, 7 months ago (2016-05-10 21:20:15 UTC) #19
Nico
On 2016/05/10 21:20:15, krasin wrote: > On 2016/05/10 21:06:52, Nico wrote: > > Previously, only ...
4 years, 7 months ago (2016-05-10 21:23:06 UTC) #20
xhwang
On 2016/05/10 21:23:06, Nico wrote: > On 2016/05/10 21:20:15, krasin wrote: > > On 2016/05/10 ...
4 years, 7 months ago (2016-05-11 06:06:56 UTC) #21
xhwang
4 years, 7 months ago (2016-05-11 06:07:25 UTC) #22
Message was sent while issue was closed.
On 2016/05/11 06:06:56, xhwang wrote:
> On 2016/05/10 21:23:06, Nico wrote:
> > On 2016/05/10 21:20:15, krasin wrote:
> > > On 2016/05/10 21:06:52, Nico wrote:
> > > > Previously, only C functions got exported. Now, we export C++ classes.
Do
> we
> > > > really want to use C++ across a dll boundary?
> > > 
> > > The code already does that. See https://crbug.com/609564#c35
> > 
> > Right, but maybe we want to fix that instead of exporting these classes (a
> > question for the CDM folks).
> 
> I am really no expert in this area. But when we created this interface, my
> understanding was that the exported functions have to be C functions, but the
C
> functions can create C++ objects, whose methods can be called by another
> library. One pitfall is that the new and delete of the C++ objects must live
in
> the same library. That's we have Destroy() call on the CDM interface.
> 
> I think this is one of the reference I was reading:
> 
> http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html
> 
> With that, is it actually necessary to export the C++ classes? Was my
assumption
> wrong? I don't really understand how devirtualization works :(

Maybe we should move this discussion to the bug, where ddorwin has other
questions :)

Powered by Google App Engine
This is Rietveld 408576698