From 21b6c4e2808a989c3bf4e7e2aa6556e97552a6d2 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 25 Mar 2013 22:15:33 +0000 Subject: [PATCH] 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 --- include/cef_app.h | 4 ++-- include/cef_command_line.h | 4 ++-- libcef_dll/ctocpp/command_line_ctocpp.cc | 12 ++++++------ libcef_dll/wrapper/libcef_dll_wrapper.cc | 12 ++++++------ tools/cef_parser.py | 2 +- tools/make_ctocpp_impl.py | 10 +++++----- tools/translator.README.txt | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/cef_app.h b/include/cef_app.h index 9d1aa321..8cdae4f3 100644 --- a/include/cef_app.h +++ b/include/cef_app.h @@ -58,7 +58,7 @@ class CefApp; // secondary process it will block until the process should exit and then return // 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 application); /// @@ -66,7 +66,7 @@ int CefExecuteProcess(const CefMainArgs& args, CefRefPtr application); // 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. /// -/*--cef(revision_check,optional_param=application)--*/ +/*--cef(api_hash_check,optional_param=application)--*/ bool CefInitialize(const CefMainArgs& args, const CefSettings& settings, CefRefPtr application); diff --git a/include/cef_command_line.h b/include/cef_command_line.h index 35810664..96241cf4 100644 --- a/include/cef_command_line.h +++ b/include/cef_command_line.h @@ -61,14 +61,14 @@ class CefCommandLine : public virtual CefBase { /// // Create a new CefCommandLine instance. /// - /*--cef(revision_check)--*/ + /*--cef(api_hash_check)--*/ static CefRefPtr CreateCommandLine(); /// // Returns the singleton global CefCommandLine object. The returned object // will be read-only. /// - /*--cef(revision_check)--*/ + /*--cef(api_hash_check)--*/ static CefRefPtr GetGlobalCommandLine(); /// diff --git a/libcef_dll/ctocpp/command_line_ctocpp.cc b/libcef_dll/ctocpp/command_line_ctocpp.cc index 8ab94a0c..88a92e2b 100644 --- a/libcef_dll/ctocpp/command_line_ctocpp.cc +++ b/libcef_dll/ctocpp/command_line_ctocpp.cc @@ -18,9 +18,9 @@ // STATIC METHODS - Body may be edited by hand. CefRefPtr CefCommandLine::CreateCommandLine() { - int build_revision = cef_build_revision(); - if (build_revision != CEF_REVISION) { - // The libcef build revision does not match the CEF API revision. + const char* api_hash = cef_api_hash(0); + if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) { + // The libcef API hash does not match the current header API hash. DCHECK(false); return NULL; } @@ -35,9 +35,9 @@ CefRefPtr CefCommandLine::CreateCommandLine() { } CefRefPtr CefCommandLine::GetGlobalCommandLine() { - int build_revision = cef_build_revision(); - if (build_revision != CEF_REVISION) { - // The libcef build revision does not match the CEF API revision. + const char* api_hash = cef_api_hash(0); + if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) { + // The libcef API hash does not match the current header API hash. DCHECK(false); return NULL; } diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index 967b8418..d0de104c 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -112,9 +112,9 @@ CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args, CefRefPtr application) { - int build_revision = cef_build_revision(); - if (build_revision != CEF_REVISION) { - // The libcef build revision does not match the CEF API revision. + const char* api_hash = cef_api_hash(0); + if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) { + // The libcef API hash does not match the current header API hash. DCHECK(false); return 0; } @@ -134,9 +134,9 @@ CEF_GLOBAL int CefExecuteProcess(const CefMainArgs& args, CEF_GLOBAL bool CefInitialize(const CefMainArgs& args, const CefSettings& settings, CefRefPtr application) { - int build_revision = cef_build_revision(); - if (build_revision != CEF_REVISION) { - // The libcef build revision does not match the CEF API revision. + const char* api_hash = cef_api_hash(0); + if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) { + // The libcef API hash does not match the current header API hash. DCHECK(false); return false; } diff --git a/tools/cef_parser.py b/tools/cef_parser.py index 148c6462..a6a275e9 100644 --- a/tools/cef_parser.py +++ b/tools/cef_parser.py @@ -270,7 +270,7 @@ def format_translation_includes(body): """ result = '' - if body.find('cef_build_revision()') > 0: + if body.find('cef_api_hash(') > 0: result += '#include "include/cef_version.h"\n' # identify what CppToC classes are being used diff --git a/tools/make_ctocpp_impl.py b/tools/make_ctocpp_impl.py index 0ef21e4b..dab3c9f1 100644 --- a/tools/make_ctocpp_impl.py +++ b/tools/make_ctocpp_impl.py @@ -60,11 +60,11 @@ def make_ctocpp_function_impl_new(clsname, name, func): if len(retval_default) > 0: retval_default = ' '+retval_default; - # add revision check - if func.has_attrib('revision_check'): - result += '\n int build_revision = cef_build_revision();'\ - '\n if (build_revision != CEF_REVISION) {'\ - '\n // The libcef build revision does not match the CEF API revision.'\ + # add API hash check + if func.has_attrib('api_hash_check'): + result += '\n const char* api_hash = cef_api_hash(0);'\ + '\n if (strcmp(api_hash, CEF_API_HASH_PLATFORM)) {'\ + '\n // The libcef API hash does not match the current header API hash.'\ '\n DCHECK(false);'\ '\n return'+retval_default+';'\ '\n }\n' diff --git a/tools/translator.README.txt b/tools/translator.README.txt index 586133b6..2be478f3 100644 --- a/tools/translator.README.txt +++ b/tools/translator.README.txt @@ -86,7 +86,7 @@ Supported method/function attributes: count_func=[param:func] (Required for non-const non-string std::vector types) Specify the C++ function that returns the 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. Supported class attributes: