Use the platform API hash instead of build revision for checking libcef compatibility (issue #914).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1161 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2013-03-25 22:15:33 +00:00
parent e185bcb54d
commit 21b6c4e280
7 changed files with 23 additions and 23 deletions

View File

@ -58,7 +58,7 @@ class CefApp;
// secondary process it will block until the process should exit and then return // secondary process it will block until the process should exit and then return
// the process exit code. The |application| parameter may be empty. // the process exit code. The |application| parameter may be empty.
/// ///
/*--cef(revision_check,optional_param=application)--*/ /*--cef(api_hash_check,optional_param=application)--*/
int CefExecuteProcess(const CefMainArgs& args, CefRefPtr<CefApp> application); int CefExecuteProcess(const CefMainArgs& args, CefRefPtr<CefApp> application);
/// ///
@ -66,7 +66,7 @@ int CefExecuteProcess(const CefMainArgs& args, CefRefPtr<CefApp> application);
// the CEF browser process. The |application| parameter may be empty. A return // the CEF browser process. The |application| parameter may be empty. A return
// value of true indicates that it succeeded and false indicates that it failed. // value of true indicates that it succeeded and false indicates that it failed.
/// ///
/*--cef(revision_check,optional_param=application)--*/ /*--cef(api_hash_check,optional_param=application)--*/
bool CefInitialize(const CefMainArgs& args, const CefSettings& settings, bool CefInitialize(const CefMainArgs& args, const CefSettings& settings,
CefRefPtr<CefApp> application); CefRefPtr<CefApp> application);

View File

@ -61,14 +61,14 @@ class CefCommandLine : public virtual CefBase {
/// ///
// Create a new CefCommandLine instance. // Create a new CefCommandLine instance.
/// ///
/*--cef(revision_check)--*/ /*--cef(api_hash_check)--*/
static CefRefPtr<CefCommandLine> CreateCommandLine(); static CefRefPtr<CefCommandLine> CreateCommandLine();
/// ///
// Returns the singleton global CefCommandLine object. The returned object // Returns the singleton global CefCommandLine object. The returned object
// will be read-only. // will be read-only.
/// ///
/*--cef(revision_check)--*/ /*--cef(api_hash_check)--*/
static CefRefPtr<CefCommandLine> GetGlobalCommandLine(); static CefRefPtr<CefCommandLine> GetGlobalCommandLine();
/// ///

View File

@ -18,9 +18,9 @@
// STATIC METHODS - Body may be edited by hand. // STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine() { CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine() {
int build_revision = cef_build_revision(); const char* api_hash = cef_api_hash(0);
if (build_revision != CEF_REVISION) { if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
// The libcef build revision does not match the CEF API revision. // The libcef API hash does not match the current header API hash.
DCHECK(false); DCHECK(false);
return NULL; return NULL;
} }
@ -35,9 +35,9 @@ CefRefPtr<CefCommandLine> CefCommandLine::CreateCommandLine() {
} }
CefRefPtr<CefCommandLine> CefCommandLine::GetGlobalCommandLine() { CefRefPtr<CefCommandLine> CefCommandLine::GetGlobalCommandLine() {
int build_revision = cef_build_revision(); const char* api_hash = cef_api_hash(0);
if (build_revision != CEF_REVISION) { if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
// The libcef build revision does not match the CEF API revision. // The libcef API hash does not match the current header API hash.
DCHECK(false); DCHECK(false);
return NULL; return NULL;
} }

View File

@ -112,9 +112,9 @@
CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args, CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application) { CefRefPtr<CefApp> application) {
int build_revision = cef_build_revision(); const char* api_hash = cef_api_hash(0);
if (build_revision != CEF_REVISION) { if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
// The libcef build revision does not match the CEF API revision. // The libcef API hash does not match the current header API hash.
DCHECK(false); DCHECK(false);
return 0; return 0;
} }
@ -134,9 +134,9 @@ CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args,
CEF_GLOBAL bool CefInitialize(const CefMainArgs& args, CEF_GLOBAL bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings, CefRefPtr<CefApp> application) { const CefSettings& settings, CefRefPtr<CefApp> application) {
int build_revision = cef_build_revision(); const char* api_hash = cef_api_hash(0);
if (build_revision != CEF_REVISION) { if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {
// The libcef build revision does not match the CEF API revision. // The libcef API hash does not match the current header API hash.
DCHECK(false); DCHECK(false);
return false; return false;
} }

View File

@ -270,7 +270,7 @@ def format_translation_includes(body):
""" """
result = '' result = ''
if body.find('cef_build_revision()') > 0: if body.find('cef_api_hash(') > 0:
result += '#include "include/cef_version.h"\n' result += '#include "include/cef_version.h"\n'
# identify what CppToC classes are being used # identify what CppToC classes are being used

View File

@ -60,11 +60,11 @@ def make_ctocpp_function_impl_new(clsname, name, func):
if len(retval_default) > 0: if len(retval_default) > 0:
retval_default = ' '+retval_default; retval_default = ' '+retval_default;
# add revision check # add API hash check
if func.has_attrib('revision_check'): if func.has_attrib('api_hash_check'):
result += '\n int build_revision = cef_build_revision();'\ result += '\n const char* api_hash = cef_api_hash(0);'\
'\n if (build_revision != CEF_REVISION) {'\ '\n if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {'\
'\n // The libcef build revision does not match the CEF API revision.'\ '\n // The libcef API hash does not match the current header API hash.'\
'\n DCHECK(false);'\ '\n DCHECK(false);'\
'\n return'+retval_default+';'\ '\n return'+retval_default+';'\
'\n }\n' '\n }\n'

View File

@ -86,7 +86,7 @@ Supported method/function attributes:
count_func=[param:func] (Required for non-const non-string std::vector count_func=[param:func] (Required for non-const non-string std::vector
types) Specify the C++ function that returns the types) Specify the C++ function that returns the
count of elements for a vector parameter. count of elements for a vector parameter.
revision_check (Optional) If set a revision check will be added api_hash_check (Optional) If set an API hash check will be added
to the CToCpp version of the method/function. to the CToCpp version of the method/function.
Supported class attributes: Supported class attributes: