Introduce CEF API version (proposal)

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

Introduce CEF API version (proposal)

Postby fddima » Tue Mar 05, 2013 1:30 pm

Hi.

Currently CEF exposes cef_build_revision method, which provide actual revision from it was built.
I use this to make check that my application (in my case it is cefglue library), check's what loaded libcef.dll exactly matched for which cefglue was built.
But in practice i'm sometimes get more CEF binaries which have compatible API's but my library won't load updated libcef, 'cause build revision mismatch.
Of course i can introduce 'whitelist' but it is looks as hard to track them and requires update cefglue library, when it is doesn't actually required.

I.e. what i'm want:

Make cef_api_revision() method which will return hash for API - i.e. it will be stable over different cef builds, when API doesn't changed.

I think that it will be about enought to make this hash from all header files (cef/include and cef/include/internal) - for me i'm interested to get one API hash for any platform (so it must cover any structs). May be also have sense provide same in platform dependent way (i.e. mainly excluding cef_types_XXX) from hash calculation. Also when hash calculated it must remove any comments (but cef tags can be leaved i think), and make it line-ending insensitive (calculating hash with LF must be same as calculation hash on windows with CR LF).

Personally i can introduce this feature for my xilium cef builds (i'm do them in any case), but if this feature can be useful for anyone (Marshal? what you think) - then i'm can implement this feature which can be integrated without additional toolset (mono for example :) ).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Introduce CEF API version (proposal)

Postby magreenblatt » Tue Mar 05, 2013 1:36 pm

I think this is a cool idea if we can make it work consistently (ie, find a good way to include all structures and ignore comments, whitespace, etc as you suggest). It would likely need to be written in python to work with CEF's current tooling setup.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Introduce CEF API version (proposal)

Postby fddima » Tue Mar 05, 2013 1:53 pm

magreenblatt wrote:I think this is a cool idea if we can make it work consistently (ie, find a good way to include all structures and ignore comments, whitespace, etc as you suggest). It would likely need to be written in python to work with CEF's current tooling setup.

Thanks. No problem with python, - i will investigate this feat more closely.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Introduce CEF API version (proposal)

Postby fddima » Wed Mar 06, 2013 3:12 pm

Hi.
I'm publish initial version of script at https://bitbucket.org/fddima/cef-api-hash . If you don't have hg client installed, you can download zip file from overview page (right pane).
It is not completed, but looks as ready to continue discussion.

Just run cef_api_hash.py and it will create debug directory with processed files (to look with own eyes on them, to see what will be included to hash calculation).
Later same output concatenates and little processed (trim strings, replacing sequences of inner spaces).

Currently i'm aiming to calculate hash for C API, but using cpp headers (while they are used in any way to build C API structs).
So it is not ideally right way, but in general looks not bad for cpp headers, internal headers still requires some work.

I think that many files from internal can be just ignored, 'cause not all of them affect on C API.

Hash algorithm i'm choose SHA1 (same as mercurial, same as git), and looks like first 10 chars will be enough for us.

So any comments, proposals...
I think we must try to precise look to this mechanism, to avoid hash mismatches by following changes in calculation code.

I'm still thinking about to calculate one universal hash (platfrom independent), and platform-dependent hash...
I mean: one stable hash across for all platforms (i.e. including all specifics), and hash which will be stable for concrete platform.
First useful for library like cefglue, but second also can be useful, to avoid effects from other platforms. I.e. when only platform dependent types changed - for one platfrom - for other platfrom api remains same, even in never builds. Uff... my crying english.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Introduce CEF API version (proposal)

Postby magreenblatt » Wed Mar 06, 2013 4:53 pm

I agree that only considering the C API headers is a good approach. I think we can just process all of the header files for the C structures that we'll consider (for example typedef, enum and CEF_EXPORT functions). Personally, I'm OK with either a global hash that includes all platform-specific files or a separate hash for each platform. We should include the hashes in cef_version.h (call your script from make_version_header.py).
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Introduce CEF API version (proposal)

Postby fddima » Tue Mar 12, 2013 5:30 pm

magreenblatt wrote:I agree that only considering the C API headers is a good approach. I think we can just process all of the header files for the C structures that we'll consider (for example typedef, enum and CEF_EXPORT functions). Personally, I'm OK with either a global hash that includes all platform-specific files or a separate hash for each platform. We should include the hashes in cef_version.h (call your script from make_version_header.py).


I'm improve generator. Now it generate per-platform hashes, and one unified hash. In general it still very simple, but looks not so bad, as for begin.

In any case, to continue work - i need know how it will be live in CEF API.

I mean, that i can return hex string of hash (ASCIIZ like 322d0d79c1c699530f2f0cb0d4719520d7982285 ), with method like:
Code: Select all
const char* cef_api_revision(int unified); // returns const string, i.e. it is can't be modified, not needed to be free

I'm think that for this purpose we must do not use any other part of cef api (cef_string_t).
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Introduce CEF API version (proposal)

Postby magreenblatt » Tue Mar 12, 2013 5:39 pm

fddima wrote:In any case, to continue work - i need know how it will be live in CEF API.

I mean, that i can return hex string of hash (ASCIIZ like 322d0d79c1c699530f2f0cb0d4719520d7982285 ), with method like:
Code: Select all
const char* cef_api_revision(int unified); // returns const string, i.e. it is can't be modified, not needed to be free

I'm think that for this purpose we must do not use any other part of cef api (cef_string_t).

This sounds fine to me.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Introduce CEF API version (proposal)

Postby fddima » Thu Mar 14, 2013 3:02 pm

magreenblatt wrote:This sounds fine to me.

Okay. What i need put to cef_version.h?
I.e. something like (just for sample, pseudo language):
Code: Select all
#if defined(OS_WIN)
#define CEF_API_REVISION "win_rev"
#elif defined(OS_LINUX)
#define CEF_API_REVISION "linux_rev"
...
#endif

or provide defines for each platform and choose one of define in method implementation?
Or generate exactly one:
Code: Select all
#define CEF_API_REVISION "platfrom_rev"

but in this case - how i can get platfrom from generating script (i.e. from make_version_header)?
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Introduce CEF API version (proposal)

Postby magreenblatt » Thu Mar 14, 2013 7:52 pm

I don't think we need the defines for multiple platforms available at the same time, so we can define them exclusively as you describe. We could have for example both CEF_API_HASH_PLATFORM which represents the win, osx or linux hash, and CEF_API_HASH_UNIVERSAL which represents the combined hash (could just be a hash of win+osx+linux hashes). You can test the platform in python as shown at https://code.google.com/p/chromiumembed ... rib.py#185
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Introduce CEF API version (proposal)

Postby fddima » Fri Mar 15, 2013 3:31 am

magreenblatt wrote:I don't think we need the defines for multiple platforms available at the same time, so we can define them exclusively as you describe. We could have for example both CEF_API_HASH_PLATFORM which represents the win, osx or linux hash, and CEF_API_HASH_UNIVERSAL which represents the combined hash (could just be a hash of win+osx+linux hashes). You can test the platform in python as shown at https://code.google.com/p/chromiumembed ... rib.py#185

Exactly what i needed. Thanks!
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Next

Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 11 guests