Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to CEF 3.3202.1692.g18a939d #10

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 3 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Table of contents:

Tested configurations:
- Windows:
- Binary: `cef_binary_3.3029.1608.g27a32db_windows32.tar.bz2`
- Binary: `cef_binary_3.3202.1692.g18a939d_windows32.tar.bz2`
- Compilers: mingw-gcc 5.3.0 and TDM-gcc 5.1.0 on Windows 7 64-bit
- Linux:
- Binary: `cef_binary_3.3029.1608.g27a32db_linux64.tar.bz2`
- Binary: `cef_binary_3.3202.1692.g18a939d_linux64.tar.bz2`
- Compiler: Linux: gcc 4.8.2 on Ubuntu 14.04 64-bit


Expand All @@ -50,7 +50,7 @@ Tested configurations:

## Updating CEF version

If you download a CEF version newer than `3.3029.1608` then
If you download a CEF version newer than `3.3202.1692` then
apart from copying binaries to cefcapi/Release/ directory
you will also have to update the include/ directory with CEF
header files.
Expand All @@ -60,40 +60,6 @@ and "cef_version_linux.h" - these header files were copied
from CEF binary distributions for appropriate platforms and
their original file names were "cef_version.h".

Additionally on Windows if using gcc compiler then apply the
[Patch for gcc compiler on Windows](#patch-for-gcc-compiler-on-windows).


## Patch for gcc compiler on Windows

It was required to modify [cef_export.h](include/internal/cef_export.h)
to make it work with GCC compiler on Windows. The calling
convention for callbacks needs to be __stdcall.

Related issues:
- Issue [#6](../../issues/6)
- Upstream [Issue 1209](https://bitbucket.org/chromiumembedded/cef/issues/1209)

Here is the patch:

```text
diff --git a/include/internal/cef_export.h b/include/internal/cef_export.h
index 2813253b..e78be029 100644
--- a/include/internal/cef_export.h
+++ b/include/internal/cef_export.h
@@ -48,7 +48,11 @@
#elif defined(COMPILER_GCC)

#define CEF_EXPORT __attribute__ ((visibility("default")))
+#ifdef OS_WIN
+#define CEF_CALLBACK __stdcall
+#else
#define CEF_CALLBACK
+#endif

#endif // COMPILER_GCC
```

## Support development

If you would like to support general cefcapi development efforts
Expand Down
65 changes: 52 additions & 13 deletions include/base/cef_atomic_ref_count.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,49 @@
#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_
#pragma once

#if defined(BASE_ATOMIC_REF_COUNT_H_)
// Do nothing if the Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/atomic_ref_count.h"

// Used when declaring a base::AtomicRefCount value. This is an object type with
// Chromium headers.
#define ATOMIC_DECLARATION (0)

// Maintaining compatibility with AtompicRefCount* functions that were removed
// from Chromium in http://crrev.com/ee96d561.
namespace base {

// Increment a reference count by 1.
inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) {
const_cast<AtomicRefCount*>(ptr)->Increment();
}

// Decrement a reference count by 1 and return whether the result is non-zero.
// Insert barriers to ensure that state written before the reference count
// became zero will be visible to a thread that has just made the count zero.
inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) {
return const_cast<AtomicRefCount*>(ptr)->Decrement();
}

// Return whether the reference count is one. If the reference count is used
// in the conventional way, a refrerence count of 1 implies that the current
// thread owns the reference and no other thread shares it. This call performs
// the test for a reference count of one, and performs the memory barrier
// needed for the owning thread to act on the object, knowing that it has
// exclusive access to the object.
inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) {
return const_cast<AtomicRefCount*>(ptr)->IsOne();
}

// Return whether the reference count is zero. With conventional object
// referencing counting, the object will be destroyed, so the reference count
// should never be zero. Hence this is generally used for a debug check.
inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) {
return const_cast<AtomicRefCount*>(ptr)->IsZero();
}

} // namespace base

#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
Expand All @@ -56,14 +91,18 @@

// Annotations are not currently supported.
#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */
#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */
#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */

// Used when declaring a base::AtomicRefCount value. This is an integer/ptr type
// with CEF headers.
#define ATOMIC_DECLARATION = 0

namespace base {

typedef subtle::Atomic32 AtomicRefCount;

// Increment a reference count by "increment", which must exceed 0.
inline void AtomicRefCountIncN(volatile AtomicRefCount *ptr,
inline void AtomicRefCountIncN(volatile AtomicRefCount* ptr,
AtomicRefCount increment) {
subtle::NoBarrier_AtomicIncrement(ptr, increment);
}
Expand All @@ -72,7 +111,7 @@ inline void AtomicRefCountIncN(volatile AtomicRefCount *ptr,
// and return whether the result is non-zero.
// Insert barriers to ensure that state written before the reference count
// became zero will be visible to a thread that has just made the count zero.
inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr,
inline bool AtomicRefCountDecN(volatile AtomicRefCount* ptr,
AtomicRefCount decrement) {
ANNOTATE_HAPPENS_BEFORE(ptr);
bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0);
Expand All @@ -83,14 +122,14 @@ inline bool AtomicRefCountDecN(volatile AtomicRefCount *ptr,
}

// Increment a reference count by 1.
inline void AtomicRefCountInc(volatile AtomicRefCount *ptr) {
inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) {
base::AtomicRefCountIncN(ptr, 1);
}

// Decrement a reference count by 1 and return whether the result is non-zero.
// Insert barriers to ensure that state written before the reference count
// became zero will be visible to a thread that has just made the count zero.
inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) {
inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) {
return base::AtomicRefCountDecN(ptr, 1);
}

Expand All @@ -100,7 +139,7 @@ inline bool AtomicRefCountDec(volatile AtomicRefCount *ptr) {
// the test for a reference count of one, and performs the memory barrier
// needed for the owning thread to act on the object, knowing that it has
// exclusive access to the object.
inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) {
bool res = (subtle::Acquire_Load(ptr) == 1);
if (res) {
ANNOTATE_HAPPENS_AFTER(ptr);
Expand All @@ -111,7 +150,7 @@ inline bool AtomicRefCountIsOne(volatile AtomicRefCount *ptr) {
// Return whether the reference count is zero. With conventional object
// referencing counting, the object will be destroyed, so the reference count
// should never be zero. Hence this is generally used for a debug check.
inline bool AtomicRefCountIsZero(volatile AtomicRefCount *ptr) {
inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) {
bool res = (subtle::Acquire_Load(ptr) == 0);
if (res) {
ANNOTATE_HAPPENS_AFTER(ptr);
Expand Down
3 changes: 1 addition & 2 deletions include/base/cef_atomicops.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value);
// *ptr with the increment applied. This routine implies no memory barriers.
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);

Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
Atomic32 increment);
Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment);

// These following lower-level operations are typically useful only to people
// implementing higher-level synchronization operations like spinlocks,
Expand Down
20 changes: 10 additions & 10 deletions include/base/cef_basictypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_
#pragma once

#include <limits.h> // For UINT_MAX
#include <stddef.h> // For size_t
#include <limits.h> // For UINT_MAX
#include <stddef.h> // For size_t

#include "include/base/cef_build.h"

Expand All @@ -43,34 +43,34 @@
// On Mac OS X, |long long| is used for 64-bit types for compatibility with
// <inttypes.h> format macros even in the LP64 model.
#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
typedef long int64; // NOLINT(runtime/int)
typedef unsigned long uint64; // NOLINT(runtime/int)
typedef long int64;
typedef unsigned long uint64;
#else
typedef long long int64; // NOLINT(runtime/int)
typedef unsigned long long uint64; // NOLINT(runtime/int)
typedef long long int64;
typedef unsigned long long uint64;
#endif

// TODO: Remove these type guards. These are to avoid conflicts with
// obsolete/protypes.h in the Gecko SDK.
#ifndef _INT32
#define _INT32
typedef int int32;
typedef int int32;
#endif

// TODO: Remove these type guards. These are to avoid conflicts with
// obsolete/protypes.h in the Gecko SDK.
#ifndef _UINT32
#define _UINT32
typedef unsigned int uint32;
typedef unsigned int uint32;
#endif

// UTF-16 character type.
// This should be kept synchronized with base/strings/string16.h
#ifndef char16
#if defined(WCHAR_T_IS_UTF16)
typedef wchar_t char16;
typedef wchar_t char16;
#elif defined(WCHAR_T_IS_UTF32)
typedef unsigned short char16;
typedef unsigned short char16;
#endif
#endif

Expand Down
Loading