diff --git a/include/base/cef_build.h b/include/base/cef_build.h index 594c6ff0a..01b08ffc2 100644 --- a/include/base/cef_build.h +++ b/include/base/cef_build.h @@ -132,22 +132,6 @@ #error Please add support for your compiler in cef_build.h #endif -// Annotate a virtual method indicating it must be overriding a virtual -// method in the parent class. -// Use like: -// virtual void foo() OVERRIDE; -#ifndef OVERRIDE -#if defined(__clang__) || defined(COMPILER_MSVC) -#define OVERRIDE override -#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 -// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. -#define OVERRIDE override -#else -#define OVERRIDE -#endif -#endif // OVERRIDE - // Annotate a function indicating the caller must examine the return value. // Use like: // int foo() WARN_UNUSED_RESULT; @@ -183,4 +167,23 @@ #endif // !BUILDING_CEF_SHARED +// Annotate a virtual method indicating it must be overriding a virtual method +// in the parent class. +// Use like: +// void foo() OVERRIDE; +// NOTE: This define should only be used in classes exposed to the client since +// C++11 support may not be enabled in client applications. CEF internal classes +// should use the `override` keyword directly. +#ifndef OVERRIDE +#if defined(__clang__) || defined(COMPILER_MSVC) +#define OVERRIDE override +#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 +// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. +#define OVERRIDE override +#else +#define OVERRIDE +#endif +#endif // OVERRIDE + #endif // CEF_INCLUDE_BASE_CEF_BUILD_H_ diff --git a/include/cef_base.h b/include/cef_base.h index c237b9e8d..c9213588a 100644 --- a/include/cef_base.h +++ b/include/cef_base.h @@ -113,17 +113,17 @@ class CefRefCount { /// #define IMPLEMENT_REFCOUNTING(ClassName) \ public: \ - void AddRef() const { \ + void AddRef() const OVERRIDE { \ ref_count_.AddRef(); \ } \ - bool Release() const { \ + bool Release() const OVERRIDE { \ if (ref_count_.Release()) { \ delete static_cast(this); \ return true; \ } \ return false; \ } \ - bool HasOneRef() const { \ + bool HasOneRef() const OVERRIDE { \ return ref_count_.HasOneRef(); \ } \ private: \ diff --git a/include/cef_runnable.h b/include/cef_runnable.h index d0a89b7e5..9b3955402 100644 --- a/include/cef_runnable.h +++ b/include/cef_runnable.h @@ -148,7 +148,7 @@ class CefRunnableMethod : public CefTask { traits_.ReleaseCallee(obj); } - virtual void Execute() { + void Execute() OVERRIDE { if (obj_) DispatchToMethod(obj_, meth_, params_); } @@ -240,7 +240,7 @@ class CefRunnableFunction : public CefTask { ~CefRunnableFunction() { } - virtual void Execute() { + void Execute() OVERRIDE { if (function_) DispatchToFunction(function_, params_); }