mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e3b12aa905 | ||
|
99a2ab18d7 | ||
|
cb88687701 | ||
|
b6461275c5 | ||
|
db28106e3b | ||
|
5c7368ef04 | ||
|
4b02b2a912 | ||
|
7e26b63680 | ||
|
02b8366c2e | ||
|
760a2c4a9e | ||
|
0852ba6743 | ||
|
6949ecc7e6 | ||
|
68ed3f4047 | ||
|
adab98e7ce | ||
|
1a19a56541 | ||
|
24b5131bc8 | ||
|
0363068c41 | ||
|
8055abc92d | ||
|
ff061be9ae | ||
|
c1ff8b0438 | ||
|
b158ecb5d3 |
@@ -7,5 +7,6 @@
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': 'refs/tags/133.0.6943.0'
|
'chromium_checkout': 'refs/tags/133.0.6943.142',
|
||||||
|
'depot_tools_checkout': '9dc0551d52'
|
||||||
}
|
}
|
||||||
|
@@ -1,39 +1,34 @@
|
|||||||
{
|
{
|
||||||
"hashes": {
|
"hashes": {
|
||||||
"13300": {
|
"13300": {
|
||||||
"comment": "Added January 13, 2025.",
|
"comment": "Added February 21, 2025.",
|
||||||
"linux": "b622b5e8d42567bd96b6c530c3bf39b42d94c97a",
|
"linux": "2508f3f0b0e5dfa191036fa6c04f8dcfa18c94b9",
|
||||||
"mac": "10daecda70220382f54f8b1fc3b2d1df7da3088c",
|
"mac": "80c0b59ba9dd783aa71fae0aa5f7dad64620e8c9",
|
||||||
"universal": "a5c9449c676e3d151ac2d141bd3907dcd1fec3d4",
|
"windows": "45d39c3669ba75467e3e609f626c31506c0eae22"
|
||||||
"windows": "854c5a8fc37bb040ad0ad8e4680f62b07ec217c0"
|
|
||||||
},
|
},
|
||||||
"13301": {
|
"13301": {
|
||||||
"comment": "Added January 13, 2025.",
|
"comment": "Added February 21, 2025.",
|
||||||
"linux": "0ec77d8bc98964aaf2c4ac037dbbe47f59863902",
|
"linux": "aa073dd1c586812503ca293c718358460d8c2dd6",
|
||||||
"mac": "65b51b1dfde1ab0af99d98e1e8b6aadf5bc28707",
|
"mac": "fda40a5df44628cac50a589ff979c0746011591e",
|
||||||
"universal": "e343550e4371b76f59813dac2742a9d3206cb98f",
|
"windows": "7109702038d51512d35dd2ed77231f9100e38214"
|
||||||
"windows": "34b14819172ed39721a3fe298cf73dec7b6e7df2"
|
|
||||||
},
|
},
|
||||||
"13302": {
|
"13302": {
|
||||||
"comment": "Added January 13, 2025.",
|
"comment": "Added February 21, 2025.",
|
||||||
"linux": "e98affe8187daaa1ee02b01677208ff0a54af74c",
|
"linux": "d5597ebfa30081953425e897209a8387b9584205",
|
||||||
"mac": "45a0649980f85c53a6156627f0af6368ccfc5554",
|
"mac": "4aa24470ba3a4bd9c06bc0e4a201b896394a86b5",
|
||||||
"universal": "b8423655541f6f2a1a9b6f5252f03e59842dc31a",
|
"windows": "18799961f4461a9cbae2aed89ac04b73ab7c37f3"
|
||||||
"windows": "b04c40f0d79e2ea6f6a4d508843b9eaafb102c1e"
|
|
||||||
},
|
},
|
||||||
"13303": {
|
"13303": {
|
||||||
"comment": "Added January 13, 2025.",
|
"comment": "Added February 21, 2025.",
|
||||||
"linux": "1b2584e9f06dc0cb59ccceee89857fc164d4db52",
|
"linux": "f3a696ee30ce1e00490a58df017393c126c89709",
|
||||||
"mac": "82d74e5024ed80b43d49d7e83b0e8a3a42a0b319",
|
"mac": "f2cdce2b9a4b635c28b5b92c42c35625a937380c",
|
||||||
"universal": "a0905ba86f2c4964857f6c9c0706ab3e1050a8cd",
|
"windows": "20016fd6a9b87ef4c539cd1f42bf1ca09b6903ca"
|
||||||
"windows": "bc115a66808672931cf676ce31d58ded946f680e"
|
|
||||||
},
|
},
|
||||||
"13304": {
|
"13304": {
|
||||||
"comment": "Added January 13, 2025.",
|
"comment": "Added February 21, 2025.",
|
||||||
"linux": "199fe896c737a07dcf1506e0c86688363df7e8b6",
|
"linux": "f1ababb4ff51ecbf77c481cee3721ef0eca9c8ca",
|
||||||
"mac": "405810f1f8b146678867b6a91cbe8c4670febbbf",
|
"mac": "98964c37b8917d83da4b173e22905503d38ad08f",
|
||||||
"universal": "be55f7cf1813ae098d4f68b2a2c9ca85784fc3ee",
|
"windows": "19c014af0082aa901398e006381b6980e4f806e9"
|
||||||
"windows": "73bb28a92f4be742e3fc80057a80797e3bf23063"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"last": "13304",
|
"last": "13304",
|
||||||
|
@@ -271,6 +271,17 @@ macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
|
|||||||
)
|
)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Set LPAC ACLs required for Windows sandbox support.
|
||||||
|
# See https://github.com/chromiumembedded/cef/issues/3791#issuecomment-2664128961
|
||||||
|
macro(SET_LPAC_ACLS target)
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${target}
|
||||||
|
POST_BUILD
|
||||||
|
COMMAND "icacls" "${CEF_TARGET_OUT_DIR}" "/grant" "*S-1-15-2-2:(OI)(CI)(RX)"
|
||||||
|
COMMENT "Setting LPAC ACLs..."
|
||||||
|
)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
endif(OS_WINDOWS)
|
endif(OS_WINDOWS)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -77,19 +77,15 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _CEF_AH_PASTE(a, b, c) a##_##b##_##c
|
#define _CEF_AH_PASTE(a, b) a##_##b
|
||||||
#define _CEF_AH_EVAL(a, b, c) _CEF_AH_PASTE(a, b, c)
|
#define _CEF_AH_EVAL(a, b) _CEF_AH_PASTE(a, b)
|
||||||
#define _CEF_AH_DECLARE(version, suffix) \
|
#define _CEF_AH_DECLARE(version) _CEF_AH_EVAL(CEF_API_HASH, version)
|
||||||
_CEF_AH_EVAL(CEF_API_HASH, version, suffix)
|
|
||||||
|
|
||||||
// API hashes for the selected CEF_API_VERSION. API hashes are created for
|
// API hashes for the selected CEF_API_VERSION. API hashes are created for
|
||||||
// each version by analyzing CEF header files for C API type definitions. The
|
// each version by analyzing CEF header files for C API type definitions. The
|
||||||
// hash value will change when header files are modified in a way that may
|
// hash value will change when header files are modified in a way that may
|
||||||
// cause binary incompatibility with other builds. The universal hash value
|
// cause binary incompatibility with other builds.
|
||||||
// will change if any platform is affected whereas the platform hash values
|
#define CEF_API_HASH_PLATFORM _CEF_AH_DECLARE(CEF_API_VERSION)
|
||||||
// will change only if that particular platform is affected.
|
|
||||||
#define CEF_API_HASH_UNIVERSAL _CEF_AH_DECLARE(CEF_API_VERSION, UNIVERSAL)
|
|
||||||
#define CEF_API_HASH_PLATFORM _CEF_AH_DECLARE(CEF_API_VERSION, PLATFORM)
|
|
||||||
|
|
||||||
#if defined(BUILDING_CEF_SHARED)
|
#if defined(BUILDING_CEF_SHARED)
|
||||||
|
|
||||||
@@ -132,7 +128,7 @@ extern "C" {
|
|||||||
/// parameter describes which hash value will be returned:
|
/// parameter describes which hash value will be returned:
|
||||||
///
|
///
|
||||||
/// 0 - CEF_API_HASH_PLATFORM
|
/// 0 - CEF_API_HASH_PLATFORM
|
||||||
/// 1 - CEF_API_HASH_UNIVERSAL
|
/// 1 - CEF_API_HASH_UNIVERSAL (deprecated, same as CEF_API_HASH_PLATFORM)
|
||||||
/// 2 - CEF_COMMIT_HASH (from cef_version.h)
|
/// 2 - CEF_COMMIT_HASH (from cef_version.h)
|
||||||
///
|
///
|
||||||
CEF_EXPORT const char* cef_api_hash(int version, int entry);
|
CEF_EXPORT const char* cef_api_hash(int version, int entry);
|
||||||
|
@@ -31,8 +31,11 @@
|
|||||||
#define CEF_INCLUDE_CEF_BASE_H_
|
#define CEF_INCLUDE_CEF_BASE_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/base/cef_atomic_ref_count.h"
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "include/base/cef_atomic_ref_count.h"
|
||||||
#include "include/base/cef_macros.h"
|
#include "include/base/cef_macros.h"
|
||||||
|
|
||||||
// Bring in common C++ type definitions used by CEF consumers.
|
// Bring in common C++ type definitions used by CEF consumers.
|
||||||
|
@@ -31,7 +31,10 @@
|
|||||||
#define CEF_INCLUDE_CEF_SANDBOX_MAC_H_
|
#define CEF_INCLUDE_CEF_SANDBOX_MAC_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "include/internal/cef_export.h"
|
#include "include/internal/cef_export.h"
|
||||||
|
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
|
@@ -31,7 +31,9 @@
|
|||||||
#define CEF_INCLUDE_CEF_SANDBOX_WIN_H_
|
#define CEF_INCLUDE_CEF_SANDBOX_WIN_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
||||||
|
@@ -31,7 +31,9 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_APP_WIN_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_APP_WIN_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
||||||
|
@@ -32,7 +32,9 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(COMPILER_MSVC)
|
#if defined(COMPILER_MSVC)
|
||||||
|
|
||||||
|
@@ -31,12 +31,14 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined(OS_POSIX)
|
#elif defined(OS_POSIX)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "include/internal/cef_export.h"
|
#include "include/internal/cef_export.h"
|
||||||
|
|
||||||
|
@@ -35,8 +35,11 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "include/internal/cef_export.h"
|
#include "include/internal/cef_export.h"
|
||||||
|
|
||||||
|
@@ -993,9 +993,11 @@ typedef enum {
|
|||||||
// No error.
|
// No error.
|
||||||
ERR_NONE = 0,
|
ERR_NONE = 0,
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#define NET_ERROR(label, value) ERR_##label = value,
|
#define NET_ERROR(label, value) ERR_##label = value,
|
||||||
#include "include/base/internal/cef_net_error_list.h"
|
#include "include/base/internal/cef_net_error_list.h"
|
||||||
#undef NET_ERROR
|
#undef NET_ERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
} cef_errorcode_t;
|
} cef_errorcode_t;
|
||||||
|
|
||||||
|
@@ -31,15 +31,12 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
|
|
||||||
#if defined(CEF_X11)
|
|
||||||
typedef union _XEvent XEvent;
|
|
||||||
typedef struct _XDisplay XDisplay;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "include/internal/cef_export.h"
|
#include "include/internal/cef_export.h"
|
||||||
#include "include/internal/cef_string.h"
|
#include "include/internal/cef_string.h"
|
||||||
#include "include/internal/cef_types_color.h"
|
#include "include/internal/cef_types_color.h"
|
||||||
@@ -47,17 +44,6 @@ typedef struct _XDisplay XDisplay;
|
|||||||
#include "include/internal/cef_types_osr.h"
|
#include "include/internal/cef_types_osr.h"
|
||||||
#include "include/internal/cef_types_runtime.h"
|
#include "include/internal/cef_types_runtime.h"
|
||||||
|
|
||||||
// Handle types.
|
|
||||||
#if defined(CEF_X11)
|
|
||||||
#define cef_cursor_handle_t unsigned long
|
|
||||||
#define cef_event_handle_t XEvent*
|
|
||||||
#else
|
|
||||||
#define cef_cursor_handle_t void*
|
|
||||||
#define cef_event_handle_t void*
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define cef_window_handle_t unsigned long
|
|
||||||
|
|
||||||
#define kNullCursorHandle 0
|
#define kNullCursorHandle 0
|
||||||
#define kNullEventHandle NULL
|
#define kNullEventHandle NULL
|
||||||
#define kNullWindowHandle 0
|
#define kNullWindowHandle 0
|
||||||
@@ -66,6 +52,20 @@ typedef struct _XDisplay XDisplay;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CEF_X11)
|
||||||
|
typedef union _XEvent XEvent;
|
||||||
|
typedef struct _XDisplay XDisplay;
|
||||||
|
|
||||||
|
// Handle types.
|
||||||
|
typedef unsigned long cef_cursor_handle_t;
|
||||||
|
typedef XEvent* cef_event_handle_t;
|
||||||
|
#else
|
||||||
|
typedef void* cef_cursor_handle_t;
|
||||||
|
typedef void* cef_event_handle_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned long cef_window_handle_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Return the singleton X11 display shared with Chromium. The display is not
|
/// Return the singleton X11 display shared with Chromium. The display is not
|
||||||
/// thread-safe and must only be accessed on the browser process UI thread.
|
/// thread-safe and must only be accessed on the browser process UI thread.
|
||||||
|
@@ -31,7 +31,9 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
#include "include/internal/cef_string.h"
|
#include "include/internal/cef_string.h"
|
||||||
@@ -40,16 +42,6 @@
|
|||||||
#include "include/internal/cef_types_osr.h"
|
#include "include/internal/cef_types_osr.h"
|
||||||
#include "include/internal/cef_types_runtime.h"
|
#include "include/internal/cef_types_runtime.h"
|
||||||
|
|
||||||
// Handle types.
|
|
||||||
// Actually NSCursor*
|
|
||||||
#define cef_cursor_handle_t void*
|
|
||||||
// Acutally NSEvent*
|
|
||||||
#define cef_event_handle_t void*
|
|
||||||
// Actually NSView*
|
|
||||||
#define cef_window_handle_t void*
|
|
||||||
// Actually IOSurface*
|
|
||||||
#define cef_shared_texture_handle_t void*
|
|
||||||
|
|
||||||
#define kNullCursorHandle NULL
|
#define kNullCursorHandle NULL
|
||||||
#define kNullEventHandle NULL
|
#define kNullEventHandle NULL
|
||||||
#define kNullWindowHandle NULL
|
#define kNullWindowHandle NULL
|
||||||
@@ -78,6 +70,16 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Handle types.
|
||||||
|
// Actually NSCursor*
|
||||||
|
typedef void* cef_cursor_handle_t;
|
||||||
|
// Actually NSEvent*
|
||||||
|
typedef void* cef_event_handle_t;
|
||||||
|
// Actually NSView*
|
||||||
|
typedef void* cef_window_handle_t;
|
||||||
|
// Actually IOSurface*
|
||||||
|
typedef void* cef_shared_texture_handle_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Structure representing CefExecuteProcess arguments.
|
/// Structure representing CefExecuteProcess arguments.
|
||||||
///
|
///
|
||||||
|
@@ -31,8 +31,15 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "include/internal/cef_types_geometry.h"
|
#include "include/internal/cef_types_geometry.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Structure containing shared texture common metadata.
|
/// Structure containing shared texture common metadata.
|
||||||
/// For documentation on each field, please refer to
|
/// For documentation on each field, please refer to
|
||||||
@@ -107,4 +114,8 @@ typedef struct _cef_accelerated_paint_info_common_t {
|
|||||||
|
|
||||||
} cef_accelerated_paint_info_common_t;
|
} cef_accelerated_paint_info_common_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
|
||||||
|
@@ -31,10 +31,15 @@
|
|||||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include "include/base/cef_build.h"
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "include/internal/cef_string.h"
|
#include "include/internal/cef_string.h"
|
||||||
#include "include/internal/cef_types_color.h"
|
#include "include/internal/cef_types_color.h"
|
||||||
@@ -42,12 +47,6 @@
|
|||||||
#include "include/internal/cef_types_osr.h"
|
#include "include/internal/cef_types_osr.h"
|
||||||
#include "include/internal/cef_types_runtime.h"
|
#include "include/internal/cef_types_runtime.h"
|
||||||
|
|
||||||
// Handle types.
|
|
||||||
#define cef_cursor_handle_t HCURSOR
|
|
||||||
#define cef_event_handle_t MSG*
|
|
||||||
#define cef_window_handle_t HWND
|
|
||||||
#define cef_shared_texture_handle_t HANDLE
|
|
||||||
|
|
||||||
#define kNullCursorHandle NULL
|
#define kNullCursorHandle NULL
|
||||||
#define kNullEventHandle NULL
|
#define kNullEventHandle NULL
|
||||||
#define kNullWindowHandle NULL
|
#define kNullWindowHandle NULL
|
||||||
@@ -56,6 +55,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Handle types.
|
||||||
|
typedef HCURSOR cef_cursor_handle_t;
|
||||||
|
typedef MSG* cef_event_handle_t;
|
||||||
|
typedef HWND cef_window_handle_t;
|
||||||
|
typedef HANDLE cef_shared_texture_handle_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Structure representing CefExecuteProcess arguments.
|
/// Structure representing CefExecuteProcess arguments.
|
||||||
///
|
///
|
||||||
|
@@ -48,23 +48,23 @@ CEF_EXPORT int cef_version_info(int entry) {
|
|||||||
#include "cef/libcef_dll/cef_api_versions.inc"
|
#include "cef/libcef_dll/cef_api_versions.inc"
|
||||||
|
|
||||||
CEF_EXPORT const char* cef_api_hash(int version, int entry) {
|
CEF_EXPORT const char* cef_api_hash(int version, int entry) {
|
||||||
static const ApiVersionHash* hash = nullptr;
|
static const ApiVersionHash* current_version_hash = nullptr;
|
||||||
|
|
||||||
// Initialize on the first successful lookup.
|
// Initialize on the first successful lookup.
|
||||||
if (!hash) {
|
if (!current_version_hash) {
|
||||||
for (size_t i = 0; i < kApiVersionHashesSize; ++i) {
|
for (const auto& version_hash : kApiVersionHashes) {
|
||||||
if (version == kApiVersionHashes[i].version) {
|
if (version == version_hash.version) {
|
||||||
hash = &kApiVersionHashes[i];
|
current_version_hash = &version_hash;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hash) {
|
if (current_version_hash) {
|
||||||
g_version = version;
|
g_version = version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hash) {
|
if (!current_version_hash) {
|
||||||
LOG(ERROR) << "Request for unsupported CEF API version " << version;
|
LOG(ERROR) << "Request for unsupported CEF API version " << version;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -76,9 +76,8 @@ CEF_EXPORT const char* cef_api_hash(int version, int entry) {
|
|||||||
|
|
||||||
switch (entry) {
|
switch (entry) {
|
||||||
case 0:
|
case 0:
|
||||||
return hash->platform;
|
|
||||||
case 1:
|
case 1:
|
||||||
return hash->universal;
|
return current_version_hash->hash;
|
||||||
case 2:
|
case 2:
|
||||||
return CEF_COMMIT_HASH;
|
return CEF_COMMIT_HASH;
|
||||||
default:
|
default:
|
||||||
@@ -97,9 +96,8 @@ CEF_EXPORT int cef_id_for_pack_resource_name(const char* name) {
|
|||||||
|
|
||||||
// Initialize on the first call.
|
// Initialize on the first call.
|
||||||
if (string_to_id_map->empty()) {
|
if (string_to_id_map->empty()) {
|
||||||
for (size_t i = 0; i < kIdNamesPackResourcesSize; ++i) {
|
for (const auto& pack_resource : kIdNamesPackResources) {
|
||||||
(*string_to_id_map)[kIdNamesPackResources[i].name] =
|
(*string_to_id_map)[pack_resource.name] = pack_resource.id;
|
||||||
kIdNamesPackResources[i].id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +117,8 @@ CEF_EXPORT int cef_id_for_pack_string_name(const char* name) {
|
|||||||
|
|
||||||
// Initialize on the first call.
|
// Initialize on the first call.
|
||||||
if (string_to_id_map->empty()) {
|
if (string_to_id_map->empty()) {
|
||||||
for (size_t i = 0; i < kIdNamesPackStringsSize; ++i) {
|
for (const auto& pack_string : kIdNamesPackStrings) {
|
||||||
(*string_to_id_map)[kIdNamesPackStrings[i].name] =
|
(*string_to_id_map)[pack_string.name] = pack_string.id;
|
||||||
kIdNamesPackStrings[i].id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,9 +138,8 @@ CEF_EXPORT int cef_id_for_command_id_name(const char* name) {
|
|||||||
|
|
||||||
// Initialize on the first call.
|
// Initialize on the first call.
|
||||||
if (string_to_id_map->empty()) {
|
if (string_to_id_map->empty()) {
|
||||||
for (size_t i = 0; i < kIdNamesCommandIdsSize; ++i) {
|
for (const auto& command : kIdNamesCommandIds) {
|
||||||
(*string_to_id_map)[kIdNamesCommandIds[i].name] =
|
(*string_to_id_map)[command.name] = command.id;
|
||||||
kIdNamesCommandIds[i].id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git base/BUILD.gn base/BUILD.gn
|
diff --git base/BUILD.gn base/BUILD.gn
|
||||||
index 5d8029ab4b82c..3fd3b54866cf7 100644
|
index e0c6828f0cd7f..40e3d558dfda3 100644
|
||||||
--- base/BUILD.gn
|
--- base/BUILD.gn
|
||||||
+++ base/BUILD.gn
|
+++ base/BUILD.gn
|
||||||
@@ -42,6 +42,7 @@ import("//build/rust/rust_static_library.gni")
|
@@ -42,6 +42,7 @@ import("//build/rust/rust_static_library.gni")
|
||||||
|
@@ -20,10 +20,10 @@ index 01dab0910e066..4c6d6faae8ce9 100644
|
|||||||
|
|
||||||
// Make an exception to allow most visited tiles to commit in third-party
|
// Make an exception to allow most visited tiles to commit in third-party
|
||||||
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
|
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
|
||||||
index 5a95c24b9acc5..b8e93ae3b5881 100644
|
index f1794420f6b41..29258c5f6ee88 100644
|
||||||
--- content/browser/renderer_host/navigation_request.cc
|
--- content/browser/renderer_host/navigation_request.cc
|
||||||
+++ content/browser/renderer_host/navigation_request.cc
|
+++ content/browser/renderer_host/navigation_request.cc
|
||||||
@@ -8243,10 +8243,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
|
@@ -8250,10 +8250,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
|
||||||
bool use_opaque_origin =
|
bool use_opaque_origin =
|
||||||
(sandbox_flags & network::mojom::WebSandboxFlags::kOrigin) ==
|
(sandbox_flags & network::mojom::WebSandboxFlags::kOrigin) ==
|
||||||
network::mojom::WebSandboxFlags::kOrigin;
|
network::mojom::WebSandboxFlags::kOrigin;
|
||||||
@@ -47,7 +47,7 @@ index 5a95c24b9acc5..b8e93ae3b5881 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
return origin_and_debug_info;
|
return origin_and_debug_info;
|
||||||
@@ -8354,11 +8366,20 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
@@ -8361,11 +8373,20 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||||
DetermineInitiatorRelationship(initiator_rfh,
|
DetermineInitiatorRelationship(initiator_rfh,
|
||||||
frame_tree_node_->current_frame_host()));
|
frame_tree_node_->current_frame_host()));
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||||
index 968f2f959882a..e96fca4f0e130 100644
|
index df58070095c59..98335fcff067e 100644
|
||||||
--- chrome/browser/BUILD.gn
|
--- chrome/browser/BUILD.gn
|
||||||
+++ chrome/browser/BUILD.gn
|
+++ chrome/browser/BUILD.gn
|
||||||
@@ -12,6 +12,7 @@ import("//build/config/compiler/pgo/pgo.gni")
|
@@ -12,6 +12,7 @@ import("//build/config/compiler/pgo/pgo.gni")
|
||||||
|
@@ -648,3 +648,59 @@ index f12ba73369a65..23c43dcb1dd24 100644
|
|||||||
NavigateParams params(browser, std::move(new_contents));
|
NavigateParams params(browser, std::move(new_contents));
|
||||||
params.source_contents = source_contents;
|
params.source_contents = source_contents;
|
||||||
params.url = target_url;
|
params.url = target_url;
|
||||||
|
diff --git chrome/browser/ui/browser_window/browser_window_features.cc chrome/browser/ui/browser_window/browser_window_features.cc
|
||||||
|
index bbec40f5004dd..5aa12213af081 100644
|
||||||
|
--- chrome/browser/ui/browser_window/browser_window_features.cc
|
||||||
|
+++ chrome/browser/ui/browser_window/browser_window_features.cc
|
||||||
|
@@ -62,6 +62,14 @@ BrowserWindowFeatures::BrowserWindowFeaturesFactory& GetFactory() {
|
||||||
|
return *factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
+bool IsNormalBrowser(Browser* browser) {
|
||||||
|
+ // CEF normal browsers have TYPE_POPUP.
|
||||||
|
+ if (browser->is_type_popup() && browser->cef_delegate()) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ return browser->is_type_normal();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
// static
|
||||||
|
@@ -141,10 +149,12 @@ void BrowserWindowFeatures::Init(BrowserWindowInterface* browser) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserWindowFeatures::InitPostWindowConstruction(Browser* browser) {
|
||||||
|
+ const bool supports_toolbar = IsNormalBrowser(browser);
|
||||||
|
+
|
||||||
|
// Features that are only enabled for normal browser windows (e.g. a window
|
||||||
|
// with an omnibox and a tab strip). By default most features should be
|
||||||
|
// instantiated in this block.
|
||||||
|
- if (browser->is_type_normal()) {
|
||||||
|
+ if (supports_toolbar) {
|
||||||
|
if (IsChromeLabsEnabled()) {
|
||||||
|
chrome_labs_coordinator_ =
|
||||||
|
std::make_unique<ChromeLabsCoordinator>(browser);
|
||||||
|
@@ -186,7 +196,7 @@ void BrowserWindowFeatures::InitPostWindowConstruction(Browser* browser) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ((browser->is_type_normal() || browser->is_type_app()) &&
|
||||||
|
+ if ((supports_toolbar || browser->is_type_app()) &&
|
||||||
|
base::FeatureList::IsEnabled(toast_features::kToastFramework)) {
|
||||||
|
toast_service_ = std::make_unique<ToastService>(browser);
|
||||||
|
}
|
||||||
|
@@ -219,10 +229,12 @@ void BrowserWindowFeatures::InitPostBrowserViewConstruction(
|
||||||
|
browser_view->browser(),
|
||||||
|
side_panel_coordinator_->GetWindowRegistry());
|
||||||
|
|
||||||
|
+ const bool supports_toolbar = IsNormalBrowser(browser_view->browser());
|
||||||
|
+
|
||||||
|
// Memory Saver mode is default off but is available to turn on.
|
||||||
|
// The controller relies on performance manager which isn't initialized in
|
||||||
|
// some unit tests without browser view.
|
||||||
|
- if (browser_view->GetIsNormalType()) {
|
||||||
|
+ if (supports_toolbar) {
|
||||||
|
memory_saver_opt_in_iph_controller_ =
|
||||||
|
std::make_unique<MemorySaverOptInIPHController>(
|
||||||
|
browser_view->browser());
|
||||||
|
@@ -726,7 +726,7 @@ index 121c651acf814..9d9b86da4705a 100644
|
|||||||
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
||||||
// interface to keep these two classes decoupled and testable.
|
// interface to keep these two classes decoupled and testable.
|
||||||
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
|
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||||
index 0c01106d900a3..42ce123ef2b01 100644
|
index c364e306bcee6..de46e443ff566 100644
|
||||||
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||||
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||||
@@ -53,6 +53,10 @@
|
@@ -53,6 +53,10 @@
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
diff --git chrome/browser/ui/views/profiles/profile_menu_view_base.cc chrome/browser/ui/views/profiles/profile_menu_view_base.cc
|
diff --git chrome/browser/ui/views/profiles/profile_menu_view_base.cc chrome/browser/ui/views/profiles/profile_menu_view_base.cc
|
||||||
index 5383396da441c..a53441bcd1c74 100644
|
index 435d03b95d769..f17a2a0646c74 100644
|
||||||
--- chrome/browser/ui/views/profiles/profile_menu_view_base.cc
|
--- chrome/browser/ui/views/profiles/profile_menu_view_base.cc
|
||||||
+++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc
|
+++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc
|
||||||
@@ -1198,8 +1198,8 @@ int ProfileMenuViewBase::GetMaxHeight() const {
|
@@ -1215,8 +1215,8 @@ int ProfileMenuViewBase::GetMaxHeight() const {
|
||||||
->GetDisplayNearestPoint(anchor_rect.CenterPoint())
|
->GetDisplayNearestPoint(anchor_rect.CenterPoint())
|
||||||
.work_area();
|
.work_area();
|
||||||
int available_space = screen_space.bottom() - anchor_rect.bottom();
|
int available_space = screen_space.bottom() - anchor_rect.bottom();
|
||||||
|
@@ -56,10 +56,10 @@ index f1030a744809c..c222a209949e6 100644
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
|
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
|
||||||
index 7ba8c01db7e93..0888ecebf8d6f 100644
|
index 3b450b572c3ef..a1b4835cc10f5 100644
|
||||||
--- content/browser/renderer_host/render_widget_host_impl.cc
|
--- content/browser/renderer_host/render_widget_host_impl.cc
|
||||||
+++ content/browser/renderer_host/render_widget_host_impl.cc
|
+++ content/browser/renderer_host/render_widget_host_impl.cc
|
||||||
@@ -818,7 +818,7 @@ void RenderWidgetHostImpl::WasHidden() {
|
@@ -820,7 +820,7 @@ void RenderWidgetHostImpl::WasHidden() {
|
||||||
|
|
||||||
// Cancel pending pointer lock requests, unless there's an open user prompt.
|
// Cancel pending pointer lock requests, unless there's an open user prompt.
|
||||||
// Prompts should remain open and functional across tab switches.
|
// Prompts should remain open and functional across tab switches.
|
||||||
@@ -68,7 +68,7 @@ index 7ba8c01db7e93..0888ecebf8d6f 100644
|
|||||||
RejectPointerLockOrUnlockIfNecessary(
|
RejectPointerLockOrUnlockIfNecessary(
|
||||||
blink::mojom::PointerLockResult::kWrongDocument);
|
blink::mojom::PointerLockResult::kWrongDocument);
|
||||||
}
|
}
|
||||||
@@ -3289,6 +3289,11 @@ void RenderWidgetHostImpl::DecrementInFlightEventCount(
|
@@ -3293,6 +3293,11 @@ void RenderWidgetHostImpl::DecrementInFlightEventCount(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,10 +81,10 @@ index 7ba8c01db7e93..0888ecebf8d6f 100644
|
|||||||
const WebInputEvent& event) {
|
const WebInputEvent& event) {
|
||||||
if ((base::FeatureList::IsEnabled(
|
if ((base::FeatureList::IsEnabled(
|
||||||
diff --git content/browser/renderer_host/render_widget_host_impl.h content/browser/renderer_host/render_widget_host_impl.h
|
diff --git content/browser/renderer_host/render_widget_host_impl.h content/browser/renderer_host/render_widget_host_impl.h
|
||||||
index 56670ed68f85f..f4ec82b6c3941 100644
|
index 82d6357c3006b..48cf3141004ff 100644
|
||||||
--- content/browser/renderer_host/render_widget_host_impl.h
|
--- content/browser/renderer_host/render_widget_host_impl.h
|
||||||
+++ content/browser/renderer_host/render_widget_host_impl.h
|
+++ content/browser/renderer_host/render_widget_host_impl.h
|
||||||
@@ -844,6 +844,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
@@ -847,6 +847,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||||
|
|
||||||
void ProgressFlingIfNeeded(base::TimeTicks current_time);
|
void ProgressFlingIfNeeded(base::TimeTicks current_time);
|
||||||
void StopFling();
|
void StopFling();
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
|
diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
|
||||||
index 6aef73a782904..226fdb101ac15 100644
|
index 64f31c87d0642..e705eba155e2e 100644
|
||||||
--- content/browser/renderer_host/render_frame_host_impl.cc
|
--- content/browser/renderer_host/render_frame_host_impl.cc
|
||||||
+++ content/browser/renderer_host/render_frame_host_impl.cc
|
+++ content/browser/renderer_host/render_frame_host_impl.cc
|
||||||
@@ -9265,6 +9265,16 @@ void RenderFrameHostImpl::CreateNewWindow(
|
@@ -9266,6 +9266,16 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ index 6aef73a782904..226fdb101ac15 100644
|
|||||||
// Otherwise, consume user activation before we proceed. In particular, it is
|
// Otherwise, consume user activation before we proceed. In particular, it is
|
||||||
// important to do this before we return from the |opener_suppressed| case
|
// important to do this before we return from the |opener_suppressed| case
|
||||||
// below.
|
// below.
|
||||||
@@ -11612,6 +11622,7 @@ void RenderFrameHostImpl::CommitNavigation(
|
@@ -11613,6 +11623,7 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||||
auto browser_calc_origin_to_commit =
|
auto browser_calc_origin_to_commit =
|
||||||
navigation_request->GetOriginToCommitWithDebugInfo();
|
navigation_request->GetOriginToCommitWithDebugInfo();
|
||||||
if (!process_lock.is_error_page() && !is_mhtml_subframe &&
|
if (!process_lock.is_error_page() && !is_mhtml_subframe &&
|
||||||
|
@@ -403,10 +403,10 @@ index fc1d5fccc3845..c065cafcd537c 100644
|
|||||||
|
|
||||||
explicit MenuHost(SubmenuView* submenu);
|
explicit MenuHost(SubmenuView* submenu);
|
||||||
diff --git ui/views/controls/menu/menu_item_view.cc ui/views/controls/menu/menu_item_view.cc
|
diff --git ui/views/controls/menu/menu_item_view.cc ui/views/controls/menu/menu_item_view.cc
|
||||||
index 9e948231f2a57..f88c0a1cf2660 100644
|
index a25a814a939a8..3c88058ff731c 100644
|
||||||
--- ui/views/controls/menu/menu_item_view.cc
|
--- ui/views/controls/menu/menu_item_view.cc
|
||||||
+++ ui/views/controls/menu/menu_item_view.cc
|
+++ ui/views/controls/menu/menu_item_view.cc
|
||||||
@@ -1138,6 +1138,15 @@ void MenuItemView::PaintBackground(gfx::Canvas* canvas,
|
@@ -1149,6 +1149,15 @@ void MenuItemView::PaintBackground(gfx::Canvas* canvas,
|
||||||
spilling_rect.set_y(spilling_rect.y() - corner_radius_);
|
spilling_rect.set_y(spilling_rect.y() - corner_radius_);
|
||||||
spilling_rect.set_height(spilling_rect.height() + corner_radius_);
|
spilling_rect.set_height(spilling_rect.height() + corner_radius_);
|
||||||
canvas->DrawRoundRect(spilling_rect, corner_radius_, flags);
|
canvas->DrawRoundRect(spilling_rect, corner_radius_, flags);
|
||||||
@@ -422,7 +422,7 @@ index 9e948231f2a57..f88c0a1cf2660 100644
|
|||||||
} else if (paint_as_selected) {
|
} else if (paint_as_selected) {
|
||||||
gfx::Rect item_bounds = GetLocalBounds();
|
gfx::Rect item_bounds = GetLocalBounds();
|
||||||
if (type_ == Type::kActionableSubMenu) {
|
if (type_ == Type::kActionableSubMenu) {
|
||||||
@@ -1208,6 +1217,13 @@ void MenuItemView::PaintMinorIconAndText(gfx::Canvas* canvas, SkColor color) {
|
@@ -1219,6 +1228,13 @@ void MenuItemView::PaintMinorIconAndText(gfx::Canvas* canvas, SkColor color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SkColor MenuItemView::GetTextColor(bool minor, bool paint_as_selected) const {
|
SkColor MenuItemView::GetTextColor(bool minor, bool paint_as_selected) const {
|
||||||
|
@@ -317,4 +317,9 @@ if(OS_WINDOWS)
|
|||||||
# Copy CEF binary and resource files to the target output directory.
|
# Copy CEF binary and resource files to the target output directory.
|
||||||
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
|
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
|
||||||
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
|
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
|
||||||
|
|
||||||
|
if(USE_SANDBOX)
|
||||||
|
# Set LPAC ACLs required for Windows sandbox support.
|
||||||
|
SET_LPAC_ACLS("${CEF_TARGET}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -30,6 +30,7 @@ const char kNameValueSet[] = "preferences_set";
|
|||||||
const char kNameValueState[] = "preferences_state";
|
const char kNameValueState[] = "preferences_state";
|
||||||
|
|
||||||
// Used with "preferences_get" messages.
|
// Used with "preferences_get" messages.
|
||||||
|
const char kGlobalPrefsKey[] = "global_prefs";
|
||||||
const char kIncludeDefaultsKey[] = "include_defaults";
|
const char kIncludeDefaultsKey[] = "include_defaults";
|
||||||
|
|
||||||
// Used with "preferences_set" messages.
|
// Used with "preferences_set" messages.
|
||||||
@@ -73,30 +74,34 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
if (message_name == kNameValueGet) {
|
if (message_name == kNameValueGet) {
|
||||||
// JavaScript is requesting a JSON representation of the preferences tree.
|
// JavaScript is requesting a JSON representation of the preferences tree.
|
||||||
|
|
||||||
// Verify the "include_defaults" key.
|
// Verify the "global_prefs" and "include_defaults" keys.
|
||||||
if (!VerifyKey(request_dict, kIncludeDefaultsKey, VTYPE_BOOL, callback)) {
|
if (!VerifyKey(request_dict, kGlobalPrefsKey, VTYPE_BOOL, callback) ||
|
||||||
|
!VerifyKey(request_dict, kIncludeDefaultsKey, VTYPE_BOOL, callback)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool global_prefs = request_dict->GetBool(kGlobalPrefsKey);
|
||||||
const bool include_defaults = request_dict->GetBool(kIncludeDefaultsKey);
|
const bool include_defaults = request_dict->GetBool(kIncludeDefaultsKey);
|
||||||
|
|
||||||
OnPreferencesGet(browser, include_defaults, callback);
|
OnPreferencesGet(browser, global_prefs, include_defaults, callback);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (message_name == kNameValueSet) {
|
} else if (message_name == kNameValueSet) {
|
||||||
// JavaScript is requesting that preferences be updated to match the
|
// JavaScript is requesting that preferences be updated to match the
|
||||||
// specified JSON representation.
|
// specified JSON representation.
|
||||||
|
|
||||||
// Verify the "preferences" key.
|
// Verify the "global_prefs" and "preferences" keys.
|
||||||
if (!VerifyKey(request_dict, kPreferencesKey, VTYPE_DICTIONARY,
|
if (!VerifyKey(request_dict, kGlobalPrefsKey, VTYPE_BOOL, callback) ||
|
||||||
|
!VerifyKey(request_dict, kPreferencesKey, VTYPE_DICTIONARY,
|
||||||
callback)) {
|
callback)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool global_prefs = request_dict->GetBool(kGlobalPrefsKey);
|
||||||
CefRefPtr<CefDictionaryValue> preferences =
|
CefRefPtr<CefDictionaryValue> preferences =
|
||||||
request_dict->GetDictionary(kPreferencesKey);
|
request_dict->GetDictionary(kPreferencesKey);
|
||||||
|
|
||||||
OnPreferencesSet(browser, preferences, callback);
|
OnPreferencesSet(browser, global_prefs, preferences, callback);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (message_name == kNameValueState) {
|
} else if (message_name == kNameValueState) {
|
||||||
@@ -113,14 +118,19 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
private:
|
private:
|
||||||
// Execute |callback| with the preferences dictionary as a JSON string.
|
// Execute |callback| with the preferences dictionary as a JSON string.
|
||||||
static void OnPreferencesGet(CefRefPtr<CefBrowser> browser,
|
static void OnPreferencesGet(CefRefPtr<CefBrowser> browser,
|
||||||
|
bool global_prefs,
|
||||||
bool include_defaults,
|
bool include_defaults,
|
||||||
CefRefPtr<Callback> callback) {
|
CefRefPtr<Callback> callback) {
|
||||||
CefRefPtr<CefRequestContext> context =
|
CefRefPtr<CefPreferenceManager> pref_manager;
|
||||||
browser->GetHost()->GetRequestContext();
|
if (global_prefs) {
|
||||||
|
pref_manager = CefPreferenceManager::GetGlobalPreferenceManager();
|
||||||
|
} else {
|
||||||
|
pref_manager = browser->GetHost()->GetRequestContext();
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieve all preference values.
|
// Retrieve all preference values.
|
||||||
CefRefPtr<CefDictionaryValue> prefs =
|
CefRefPtr<CefDictionaryValue> prefs =
|
||||||
context->GetAllPreferences(include_defaults);
|
pref_manager->GetAllPreferences(include_defaults);
|
||||||
|
|
||||||
// Serialize the preferences to JSON and return to the JavaScript caller.
|
// Serialize the preferences to JSON and return to the JavaScript caller.
|
||||||
callback->Success(GetJSON(prefs));
|
callback->Success(GetJSON(prefs));
|
||||||
@@ -129,10 +139,15 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
// Set preferences based on the contents of |preferences|. Execute |callback|
|
// Set preferences based on the contents of |preferences|. Execute |callback|
|
||||||
// with a descriptive result message.
|
// with a descriptive result message.
|
||||||
static void OnPreferencesSet(CefRefPtr<CefBrowser> browser,
|
static void OnPreferencesSet(CefRefPtr<CefBrowser> browser,
|
||||||
|
bool global_prefs,
|
||||||
CefRefPtr<CefDictionaryValue> preferences,
|
CefRefPtr<CefDictionaryValue> preferences,
|
||||||
CefRefPtr<Callback> callback) {
|
CefRefPtr<Callback> callback) {
|
||||||
CefRefPtr<CefRequestContext> context =
|
CefRefPtr<CefPreferenceManager> pref_manager;
|
||||||
browser->GetHost()->GetRequestContext();
|
if (global_prefs) {
|
||||||
|
pref_manager = CefPreferenceManager::GetGlobalPreferenceManager();
|
||||||
|
} else {
|
||||||
|
pref_manager = browser->GetHost()->GetRequestContext();
|
||||||
|
}
|
||||||
|
|
||||||
CefRefPtr<CefValue> value = CefValue::Create();
|
CefRefPtr<CefValue> value = CefValue::Create();
|
||||||
value->SetDictionary(preferences);
|
value->SetDictionary(preferences);
|
||||||
@@ -142,7 +157,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
|
|
||||||
// Apply preferences. This may result in errors.
|
// Apply preferences. This may result in errors.
|
||||||
const bool success =
|
const bool success =
|
||||||
ApplyPrefs(context, std::string(), value, error, changed_names);
|
ApplyPrefs(pref_manager, std::string(), value, error, changed_names);
|
||||||
|
|
||||||
// Create a message that accurately represents the result.
|
// Create a message that accurately represents the result.
|
||||||
std::string message;
|
std::string message;
|
||||||
@@ -245,14 +260,14 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
// Apply preferences. Returns true on success. Returns false and sets |error|
|
// Apply preferences. Returns true on success. Returns false and sets |error|
|
||||||
// to a descriptive error string on failure. |changed_names| is the list of
|
// to a descriptive error string on failure. |changed_names| is the list of
|
||||||
// preferences that were successfully changed.
|
// preferences that were successfully changed.
|
||||||
static bool ApplyPrefs(CefRefPtr<CefRequestContext> context,
|
static bool ApplyPrefs(CefRefPtr<CefPreferenceManager> pref_manager,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
CefRefPtr<CefValue> value,
|
CefRefPtr<CefValue> value,
|
||||||
std::string& error,
|
std::string& error,
|
||||||
NameVector& changed_names) {
|
NameVector& changed_names) {
|
||||||
if (!name.empty() && context->HasPreference(name)) {
|
if (!name.empty() && pref_manager->HasPreference(name)) {
|
||||||
// The preference exists. Set the value.
|
// The preference exists. Set the value.
|
||||||
return SetPref(context, name, value, error, changed_names);
|
return SetPref(pref_manager, name, value, error, changed_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value->GetType() == VTYPE_DICTIONARY) {
|
if (value->GetType() == VTYPE_DICTIONARY) {
|
||||||
@@ -265,7 +280,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
for (const auto& i : keys) {
|
for (const auto& i : keys) {
|
||||||
const std::string& key = i;
|
const std::string& key = i;
|
||||||
const std::string& current_name = name.empty() ? key : name + "." + key;
|
const std::string& current_name = name.empty() ? key : name + "." + key;
|
||||||
if (!ApplyPrefs(context, current_name, dict->GetValue(key), error,
|
if (!ApplyPrefs(pref_manager, current_name, dict->GetValue(key), error,
|
||||||
changed_names)) {
|
changed_names)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -282,12 +297,12 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
// successfully or has not changed. If the value has changed then |name| will
|
// successfully or has not changed. If the value has changed then |name| will
|
||||||
// be added to |changed_names|. Returns false and sets |error| to a
|
// be added to |changed_names|. Returns false and sets |error| to a
|
||||||
// descriptive error string on failure.
|
// descriptive error string on failure.
|
||||||
static bool SetPref(CefRefPtr<CefRequestContext> context,
|
static bool SetPref(CefRefPtr<CefPreferenceManager> pref_manager,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
CefRefPtr<CefValue> value,
|
CefRefPtr<CefValue> value,
|
||||||
std::string& error,
|
std::string& error,
|
||||||
NameVector& changed_names) {
|
NameVector& changed_names) {
|
||||||
CefRefPtr<CefValue> existing_value = context->GetPreference(name);
|
CefRefPtr<CefValue> existing_value = pref_manager->GetPreference(name);
|
||||||
DCHECK(existing_value);
|
DCHECK(existing_value);
|
||||||
|
|
||||||
if (value->GetType() == VTYPE_STRING &&
|
if (value->GetType() == VTYPE_STRING &&
|
||||||
@@ -322,7 +337,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
|||||||
|
|
||||||
// Attempt to set the preference.
|
// Attempt to set the preference.
|
||||||
CefString error_str;
|
CefString error_str;
|
||||||
if (!context->SetPreference(name, value, error_str)) {
|
if (!pref_manager->SetPreference(name, value, error_str)) {
|
||||||
error = error_str.ToString() + ": " + name;
|
error = error_str.ToString() + ": " + name;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -96,7 +96,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td align="left">
|
<td align="left">
|
||||||
<input type="button" value="Refresh" onClick="refreshEditor()"/>
|
<input type="button" value="Refresh" onClick="refreshEditor()"/>
|
||||||
<input type="checkbox" id="hide_defaults"/> Show modified preferences only
|
<input type="checkbox" id="global_prefs" onChange="refreshEditor()"/> Show global preferences
|
||||||
|
<input type="checkbox" id="hide_defaults" onChange="refreshEditor()"/> Show modified preferences only
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<input type="button" value="Apply Changes" onClick="applyEditorChanges()"/>
|
<input type="button" value="Apply Changes" onClick="applyEditorChanges()"/>
|
||||||
@@ -161,10 +162,11 @@
|
|||||||
|
|
||||||
// Get the preferences and execute |onSuccessCallback| with the resulting
|
// Get the preferences and execute |onSuccessCallback| with the resulting
|
||||||
// JSON object.
|
// JSON object.
|
||||||
function getPreferences(include_defaults, onSuccessCallback) {
|
function getPreferences(global_prefs, include_defaults, onSuccessCallback) {
|
||||||
// Create the request object.
|
// Create the request object.
|
||||||
var request = {};
|
var request = {};
|
||||||
request.name = "preferences_get";
|
request.name = "preferences_get";
|
||||||
|
request.global_prefs = global_prefs;
|
||||||
request.include_defaults = include_defaults;
|
request.include_defaults = include_defaults;
|
||||||
|
|
||||||
// Send the request to C++.
|
// Send the request to C++.
|
||||||
@@ -177,10 +179,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the preferences.
|
// Set the preferences.
|
||||||
function setPreferences(preferences) {
|
function setPreferences(global_prefs, preferences) {
|
||||||
// Create the request object.
|
// Create the request object.
|
||||||
var request = {};
|
var request = {};
|
||||||
request.name = "preferences_set";
|
request.name = "preferences_set";
|
||||||
|
request.global_prefs = global_prefs;
|
||||||
request.preferences = preferences;
|
request.preferences = preferences;
|
||||||
|
|
||||||
// Send the request to C++.
|
// Send the request to C++.
|
||||||
@@ -214,8 +217,9 @@
|
|||||||
|
|
||||||
// Refresh the editor view contents.
|
// Refresh the editor view contents.
|
||||||
function refreshEditor() {
|
function refreshEditor() {
|
||||||
|
global_prefs = document.getElementById("global_prefs").checked;
|
||||||
include_defaults = !document.getElementById("hide_defaults").checked;
|
include_defaults = !document.getElementById("hide_defaults").checked;
|
||||||
getPreferences(include_defaults, function(response) {
|
getPreferences(global_prefs, include_defaults, function(response) {
|
||||||
// Set the JSON in the editor.
|
// Set the JSON in the editor.
|
||||||
editor.set(response);
|
editor.set(response);
|
||||||
});
|
});
|
||||||
@@ -223,12 +227,13 @@
|
|||||||
|
|
||||||
// Apply changes from the editor view.
|
// Apply changes from the editor view.
|
||||||
function applyEditorChanges() {
|
function applyEditorChanges() {
|
||||||
setPreferences(editor.get());
|
global_prefs = document.getElementById("global_prefs").checked;
|
||||||
|
setPreferences(global_prefs, editor.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the simple view contents.
|
// Refresh the simple view contents.
|
||||||
function refreshSimple() {
|
function refreshSimple() {
|
||||||
getPreferences(true, function(response) {
|
getPreferences(false, true, function(response) {
|
||||||
// Spellcheck settings.
|
// Spellcheck settings.
|
||||||
if (preferences_state.spellcheck_disabled) {
|
if (preferences_state.spellcheck_disabled) {
|
||||||
// Cannot enable spell checking when disabled via the command-line.
|
// Cannot enable spell checking when disabled via the command-line.
|
||||||
@@ -318,7 +323,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (has_preferences)
|
if (has_preferences)
|
||||||
setPreferences(preferences);
|
setPreferences(false, preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the proxy type is changed.
|
// Called when the proxy type is changed.
|
||||||
|
@@ -212,4 +212,9 @@ if(OS_WINDOWS)
|
|||||||
# Copy binary and resource files to the target output directory.
|
# Copy binary and resource files to the target output directory.
|
||||||
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
|
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")
|
||||||
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
|
COPY_FILES("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${CEF_TARGET_OUT_DIR}")
|
||||||
|
|
||||||
|
if(USE_SANDBOX)
|
||||||
|
# Set LPAC ACLs required for Windows sandbox support.
|
||||||
|
SET_LPAC_ACLS("${CEF_TARGET}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -260,4 +260,9 @@ if(OS_WINDOWS)
|
|||||||
"resources/"
|
"resources/"
|
||||||
)
|
)
|
||||||
COPY_RESOURCES("${CEF_TARGET}" "${UNITTESTS_DATA_RESOURCES_SRCS}" "${PREFIXES}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}/ceftests_files")
|
COPY_RESOURCES("${CEF_TARGET}" "${UNITTESTS_DATA_RESOURCES_SRCS}" "${PREFIXES}" "${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET_OUT_DIR}/ceftests_files")
|
||||||
|
|
||||||
|
if(USE_SANDBOX)
|
||||||
|
# Set LPAC ACLs required for Windows sandbox support.
|
||||||
|
SET_LPAC_ACLS("${CEF_TARGET}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -19,6 +19,6 @@ TEST(VersionTest, VersionInfo) {
|
|||||||
|
|
||||||
TEST(VersionTest, ApiHash) {
|
TEST(VersionTest, ApiHash) {
|
||||||
EXPECT_STREQ(CEF_API_HASH_PLATFORM, cef_api_hash(CEF_API_VERSION, 0));
|
EXPECT_STREQ(CEF_API_HASH_PLATFORM, cef_api_hash(CEF_API_VERSION, 0));
|
||||||
EXPECT_STREQ(CEF_API_HASH_UNIVERSAL, cef_api_hash(CEF_API_VERSION, 1));
|
EXPECT_STREQ(CEF_API_HASH_PLATFORM, cef_api_hash(CEF_API_VERSION, 1));
|
||||||
EXPECT_STREQ(CEF_COMMIT_HASH, cef_api_hash(CEF_API_VERSION, 2));
|
EXPECT_STREQ(CEF_COMMIT_HASH, cef_api_hash(CEF_API_VERSION, 2));
|
||||||
}
|
}
|
||||||
|
@@ -4,343 +4,381 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from typing import Dict, List
|
||||||
from clang_util import clang_eval
|
from clang_util import clang_eval
|
||||||
from file_util import *
|
from file_util import *
|
||||||
import hashlib
|
import hashlib
|
||||||
import itertools
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import string
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
from version_util import EXP_VERSION
|
from version_util import EXP_VERSION
|
||||||
|
|
||||||
# Determines string type for python 2 and python 3.
|
API_TOKEN = '#if CEF_API'
|
||||||
if sys.version_info[0] == 3:
|
OS_TOKEN = '#if defined(OS_'
|
||||||
string_type = str
|
INCLUDE_START_MARKER = 'int begin_includes_tag;\n'
|
||||||
else:
|
INCLUDE_DIRS = [
|
||||||
string_type = basestring
|
'.', # Includes relative to the 'src/cef' directory.
|
||||||
|
'..', # Includes relative to the 'src' directory.
|
||||||
|
]
|
||||||
|
PLATFORM_DEFINES = {
|
||||||
|
'windows': ['OS_WIN', 'ARCH_CPU_X86_64'],
|
||||||
|
'mac': ['OS_MAC', 'OS_POSIX', 'ARCH_CPU_ARM64'],
|
||||||
|
'linux': ['OS_LINUX', 'OS_POSIX', 'CEF_X11', 'ARCH_CPU_X86_64'],
|
||||||
|
}
|
||||||
|
|
||||||
|
SYSTEM_INCLUDES_PATTERN = re.compile(r'(#include <[^>]+>)')
|
||||||
|
FUNCTION_DECLARATION_PATTERN = re.compile(
|
||||||
|
r'\nCEF_EXPORT\s+?.*?\s+?(\w+)\s*?\(.*?\)\s*?;', re.DOTALL)
|
||||||
|
STRUCT_PATTERN = re.compile(
|
||||||
|
r'\ntypedef\s+?struct\s+?(\w+)\s+?\{.*?\}\s+?(\w+)\s*?;', re.DOTALL)
|
||||||
|
ENUM_PATTERN = re.compile(r'\ntypedef\s+?enum\s+?\{.*?\}\s+?(\w+)\s*?;',
|
||||||
|
re.DOTALL)
|
||||||
|
TYPEDEF_PATTERN = re.compile(r'\ntypedef\s+?.*?\s+(\w+);')
|
||||||
|
WHITESPACE_PATTERN = re.compile(r'\s+')
|
||||||
|
PARENTHESIS_PATTERN = re.compile(r'\(\s+')
|
||||||
|
SINGLE_LINE_COMMENT_PATTERN = re.compile(r'//.*\n')
|
||||||
|
CEF_STRING_TYPE_PATTERN = re.compile(
|
||||||
|
r'\n\s*?#\s*?define\s+?(CEF_STRING_TYPE_\w+)\s+?.*?\n')
|
||||||
|
DEFINE_PATTERN = re.compile(r'#define\s+?.*?')
|
||||||
|
|
||||||
|
|
||||||
def _run_clang_eval(filename, content, api_version, added_defines, verbose):
|
def _prepare_content(content: str) -> str:
|
||||||
# Add a tag so we know where the header-specific output begins.
|
"""
|
||||||
tag = 'int begin_includes_tag;\n'
|
Add a marker to the content to indicate where the header-specific output
|
||||||
|
begins and replace system includes with a placeholder
|
||||||
|
"""
|
||||||
find = '#ifdef __cplusplus\nextern "C" {'
|
find = '#ifdef __cplusplus\nextern "C" {'
|
||||||
pos = content.find(find)
|
pos = content.find(find)
|
||||||
assert pos > 0, filename
|
assert pos > 0, f'Cannot find "{find}" in {content}'
|
||||||
content = content[0:pos] + tag + content[pos:]
|
content = content[0:pos] + INCLUDE_START_MARKER + content[pos:]
|
||||||
|
|
||||||
defines = [
|
content = DEFINE_PATTERN.sub('//DEFINE_PLACEHOLDER//', content)
|
||||||
# Makes sure CEF_EXPORT is defined.
|
return SYSTEM_INCLUDES_PATTERN.sub('//INCLUDE_PLACEHOLDER//', content)
|
||||||
'USING_CEF_SHARED',
|
|
||||||
|
|
||||||
# Avoid include of generated headers.
|
|
||||||
'GENERATING_CEF_API_HASH',
|
|
||||||
]
|
|
||||||
|
|
||||||
if filename.find('test/') >= 0:
|
def _process_result(result: str) -> str:
|
||||||
# Avoids errors parsing test includes.
|
"""
|
||||||
defines.append('UNIT_TEST')
|
Remove the non header-specific output and undo substitutions from cef_export.h
|
||||||
|
"""
|
||||||
# Not the experimental version.
|
pos = result.find(INCLUDE_START_MARKER)
|
||||||
api_version = int(api_version)
|
if pos == -1:
|
||||||
if api_version != EXP_VERSION:
|
return result
|
||||||
# Specify the exact version.
|
result = result[pos + len(INCLUDE_START_MARKER):]
|
||||||
defines.append('CEF_API_VERSION=%d' % api_version)
|
|
||||||
|
|
||||||
if not added_defines is None:
|
|
||||||
defines.extend(added_defines)
|
|
||||||
|
|
||||||
includes = [
|
|
||||||
# Includes relative to the 'src/cef' directory.
|
|
||||||
'.',
|
|
||||||
# Includes relative to the 'src' directory.
|
|
||||||
'..',
|
|
||||||
]
|
|
||||||
|
|
||||||
result = clang_eval(
|
|
||||||
filename,
|
|
||||||
content,
|
|
||||||
defines=defines,
|
|
||||||
includes=includes,
|
|
||||||
as_cpp=False,
|
|
||||||
verbose=verbose)
|
|
||||||
if result is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
pos = result.find(tag)
|
|
||||||
assert pos > 0, filename
|
|
||||||
result = result[pos + len(tag):]
|
|
||||||
|
|
||||||
replacements = [
|
replacements = [
|
||||||
# Undo substitutions from cef_export.h
|
|
||||||
['__declspec(dllimport)', 'CEF_EXPORT'],
|
['__declspec(dllimport)', 'CEF_EXPORT'],
|
||||||
['__attribute__((visibility("default")))', 'CEF_EXPORT'],
|
['__attribute__((visibility("default")))', 'CEF_EXPORT'],
|
||||||
['__stdcall', ''],
|
['__stdcall', ''],
|
||||||
]
|
]
|
||||||
|
|
||||||
for find, replace in replacements:
|
for find, replace in replacements:
|
||||||
result = result.replace(find, replace)
|
result = result.replace(find, replace)
|
||||||
|
# Must always start with newline as required by _parse_objects()
|
||||||
return result
|
return '\n' + result
|
||||||
|
|
||||||
|
|
||||||
class cef_api_hash:
|
def _get_defines(filename: str, added_defines: list) -> List[str]:
|
||||||
""" CEF API hash calculator """
|
defines = [
|
||||||
|
# Makes sure CEF_EXPORT is defined.
|
||||||
|
'USING_CEF_SHARED',
|
||||||
|
# Avoid include of generated headers.
|
||||||
|
'GENERATING_CEF_API_HASH',
|
||||||
|
]
|
||||||
|
|
||||||
def __init__(self, headerdir, verbose=False):
|
# Avoids errors parsing test includes.
|
||||||
if headerdir is None or len(headerdir) == 0:
|
if filename.find('test/') >= 0:
|
||||||
raise AssertionError("headerdir is not specified")
|
defines.append('UNIT_TEST')
|
||||||
|
|
||||||
self.__headerdir = headerdir
|
defines.extend(added_defines)
|
||||||
self.__verbose = verbose
|
return defines
|
||||||
|
|
||||||
self.platforms = ["windows", "mac", "linux"]
|
|
||||||
|
|
||||||
cef_dir = os.path.abspath(os.path.join(self.__headerdir, os.pardir))
|
def parse_versioned_content(filename: str,
|
||||||
|
content: str,
|
||||||
|
api_version: str,
|
||||||
|
added_defines: list,
|
||||||
|
debug_dir,
|
||||||
|
verbose) -> list:
|
||||||
|
"""
|
||||||
|
Parse the header file content using clang with the specified API version
|
||||||
|
Used for files that are version-specific but not platform-specific
|
||||||
|
"""
|
||||||
|
content = _prepare_content(content)
|
||||||
|
defines = _get_defines(filename, added_defines)
|
||||||
|
|
||||||
|
if api_version != EXP_VERSION:
|
||||||
|
# Specify the exact version.
|
||||||
|
defines.append(f'CEF_API_VERSION={api_version}')
|
||||||
|
|
||||||
|
result = clang_eval(filename, content, defines, INCLUDE_DIRS, verbose)
|
||||||
|
assert result, f'clang failed to eval {filename} with {api_version=}'
|
||||||
|
|
||||||
|
result = _process_result(result)
|
||||||
|
|
||||||
|
if debug_dir:
|
||||||
|
_write_debug_file(debug_dir, 'clang-' + filename.replace('/', '-'), result)
|
||||||
|
|
||||||
|
return _parse_objects(filename, result, 'universal')
|
||||||
|
|
||||||
|
|
||||||
|
def parse_platformed_content(filename: str,
|
||||||
|
content: str,
|
||||||
|
debug_dir,
|
||||||
|
verbose,
|
||||||
|
api_version,
|
||||||
|
added_defines: list) -> list:
|
||||||
|
"""
|
||||||
|
Parse the header file content using clang for every supported platform
|
||||||
|
with the specified API version. Used for files that are both version-specific
|
||||||
|
and platform-specific.
|
||||||
|
"""
|
||||||
|
content = _prepare_content(content)
|
||||||
|
defines = _get_defines(filename, added_defines)
|
||||||
|
|
||||||
|
if api_version and api_version != EXP_VERSION:
|
||||||
|
# Specify the exact version.
|
||||||
|
defines.append(f'CEF_API_VERSION={api_version}')
|
||||||
|
|
||||||
|
content_objects = []
|
||||||
|
for platform, platform_defines in PLATFORM_DEFINES.items():
|
||||||
|
result = clang_eval(filename, content, defines + platform_defines,
|
||||||
|
INCLUDE_DIRS, verbose)
|
||||||
|
assert result, f'clang failed to eval {filename} on {platform=}'
|
||||||
|
|
||||||
|
result = _process_result(result)
|
||||||
|
if debug_dir:
|
||||||
|
_write_debug_file(
|
||||||
|
debug_dir, f'clang-{platform}-' + filename.replace('/', '-'), result)
|
||||||
|
|
||||||
|
objects = _parse_objects(filename, result, platform)
|
||||||
|
content_objects.extend(objects)
|
||||||
|
|
||||||
|
return content_objects
|
||||||
|
|
||||||
|
|
||||||
|
def _write_debug_file(debug_dir, filename, content) -> None:
|
||||||
|
make_dir(debug_dir)
|
||||||
|
outfile = os.path.join(debug_dir, filename)
|
||||||
|
dir = os.path.dirname(outfile)
|
||||||
|
make_dir(dir)
|
||||||
|
if not isinstance(content, str):
|
||||||
|
content = '\n'.join(content)
|
||||||
|
write_file(outfile, content)
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_objects(filename: str, content: str, platform: str) -> list:
|
||||||
|
objects = []
|
||||||
|
content = SINGLE_LINE_COMMENT_PATTERN.sub('', content)
|
||||||
|
|
||||||
|
for m in FUNCTION_DECLARATION_PATTERN.finditer(content):
|
||||||
|
objects.append({
|
||||||
|
'filename': filename,
|
||||||
|
'name': m.group(1),
|
||||||
|
'platform': platform,
|
||||||
|
'text': _prepare_text(m.group(0))
|
||||||
|
})
|
||||||
|
|
||||||
|
for m in STRUCT_PATTERN.finditer(content):
|
||||||
|
# Remove 'CEF_CALLBACK' to normalize cross-platform clang output
|
||||||
|
objects.append({
|
||||||
|
'filename': filename,
|
||||||
|
'name': m.group(2),
|
||||||
|
'platform': platform,
|
||||||
|
'text': _prepare_text(m.group(0).replace('CEF_CALLBACK', ''))
|
||||||
|
})
|
||||||
|
|
||||||
|
for m in ENUM_PATTERN.finditer(content):
|
||||||
|
objects.append({
|
||||||
|
'filename': filename,
|
||||||
|
'name': m.group(1),
|
||||||
|
'platform': platform,
|
||||||
|
'text': _prepare_text(m.group(0))
|
||||||
|
})
|
||||||
|
|
||||||
|
for m in TYPEDEF_PATTERN.finditer(content):
|
||||||
|
if m.group(1) == 'char16_t':
|
||||||
|
# Skip char16_t typedefs to avoid platform-specific differences.
|
||||||
|
continue
|
||||||
|
|
||||||
|
objects.append({
|
||||||
|
'filename': filename,
|
||||||
|
'name': m.group(1),
|
||||||
|
'platform': platform,
|
||||||
|
'text': _prepare_text(m.group(0))
|
||||||
|
})
|
||||||
|
|
||||||
|
return objects
|
||||||
|
|
||||||
|
|
||||||
|
def _prepare_text(text: str) -> str:
|
||||||
|
""" Normalize text for hashing. """
|
||||||
|
text = WHITESPACE_PATTERN.sub(' ', text.strip())
|
||||||
|
return PARENTHESIS_PATTERN.sub('(', text)
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_string_type(filename: str, content: str) -> list:
|
||||||
|
""" Grab defined CEF_STRING_TYPE_xxx """
|
||||||
|
objects = []
|
||||||
|
for m in CEF_STRING_TYPE_PATTERN.finditer(content):
|
||||||
|
objects.append({
|
||||||
|
'filename': filename,
|
||||||
|
'name': m.group(1),
|
||||||
|
'text': _prepare_text(m.group(0)),
|
||||||
|
'platform': 'universal'
|
||||||
|
})
|
||||||
|
return objects
|
||||||
|
|
||||||
|
|
||||||
|
def _get_final_sig(objects, platform) -> str:
|
||||||
|
return '\n'.join(o['text'] for o in objects
|
||||||
|
if o['platform'] == 'universal' or o['platform'] == platform)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_filenames(header_dir) -> List[str]:
|
||||||
|
""" Return file names to be processed, relative to header_dir """
|
||||||
|
cef_dir = os.path.abspath(os.path.join(header_dir, os.pardir))
|
||||||
|
|
||||||
# Read the variables list from the autogenerated cef_paths.gypi file.
|
# Read the variables list from the autogenerated cef_paths.gypi file.
|
||||||
cef_paths = eval_file(os.path.join(cef_dir, 'cef_paths.gypi'))
|
cef_paths = eval_file(os.path.join(cef_dir, 'cef_paths.gypi'))
|
||||||
cef_paths = cef_paths['variables']
|
cef_paths = cef_paths['variables']
|
||||||
|
|
||||||
# Read the variables list from the manually edited cef_paths2.gypi file.
|
# Read the variables list from the manually edited cef_paths2.gypi file.
|
||||||
cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi'))
|
cef_paths2 = eval_file(os.path.join(cef_dir, 'cef_paths2.gypi'))
|
||||||
cef_paths2 = cef_paths2['variables']
|
cef_paths2 = cef_paths2['variables']
|
||||||
|
|
||||||
# Excluded files (paths relative to the include/ directory).
|
|
||||||
excluded_files = []
|
|
||||||
|
|
||||||
# List of platform-specific C API include/ files.
|
|
||||||
self.platform_files = {
|
|
||||||
"windows":
|
|
||||||
self.__get_filenames(cef_dir, cef_paths2['includes_win_capi'],
|
|
||||||
excluded_files),
|
|
||||||
"mac":
|
|
||||||
self.__get_filenames(cef_dir, cef_paths2['includes_mac_capi'],
|
|
||||||
excluded_files),
|
|
||||||
"linux":
|
|
||||||
self.__get_filenames(cef_dir, cef_paths2['includes_linux_capi'],
|
|
||||||
excluded_files)
|
|
||||||
}
|
|
||||||
|
|
||||||
# List of all C API include/ files.
|
# List of all C API include/ files.
|
||||||
paths = cef_paths2['includes_capi'] + cef_paths2['includes_common_capi'] + \
|
paths = cef_paths2['includes_capi'] + cef_paths2['includes_common_capi'] + \
|
||||||
cef_paths2['includes_linux_capi'] + cef_paths2['includes_mac_capi'] + \
|
cef_paths2['includes_linux_capi'] + cef_paths2['includes_mac_capi'] + \
|
||||||
cef_paths2['includes_win_capi'] + cef_paths['autogen_capi_includes']
|
cef_paths2['includes_win_capi'] + cef_paths['autogen_capi_includes']
|
||||||
self.filenames = self.__get_filenames(cef_dir, paths, excluded_files)
|
|
||||||
|
|
||||||
self.filecontents = {}
|
return [
|
||||||
self.filecontentobjs = {}
|
os.path.relpath(os.path.join(cef_dir, filename), header_dir).replace(
|
||||||
|
'\\', '/').lower() for filename in paths
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _save_objects_to_file(debug_dir: str, objects: list) -> None:
|
||||||
|
name_len = max([len(o['name']) for o in objects])
|
||||||
|
filename_len = max([len(o['filename']) for o in objects])
|
||||||
|
platform_len = max([len(o['platform']) for o in objects])
|
||||||
|
dump_sig = [
|
||||||
|
f"{o['name']:<{name_len}}|{o['filename']:<{filename_len}}|{o['platform']:<{platform_len}}|{o['text']}"
|
||||||
|
for o in objects
|
||||||
|
]
|
||||||
|
_write_debug_file(debug_dir, 'objects.txt', dump_sig)
|
||||||
|
|
||||||
|
|
||||||
|
class CefApiHasher:
|
||||||
|
""" CEF API hash calculator """
|
||||||
|
|
||||||
|
def __init__(self, header_dir, debug_dir, verbose=False):
|
||||||
|
if header_dir is None or len(header_dir) == 0:
|
||||||
|
raise AssertionError('header_dir is not specified')
|
||||||
|
|
||||||
|
self.filenames = _get_filenames(header_dir)
|
||||||
|
self.debug_dir = debug_dir
|
||||||
|
self.verbose = verbose
|
||||||
|
self.versioned_contents = {}
|
||||||
|
self.platformed_contents = {}
|
||||||
|
self.file_content_objs = {}
|
||||||
|
|
||||||
# Cache values that will not change between calls to calculate().
|
# Cache values that will not change between calls to calculate().
|
||||||
for filename in self.filenames:
|
for filename in self.filenames:
|
||||||
if self.__verbose:
|
self.print(f'Processing {filename} ...')
|
||||||
print("Processing " + filename + "...")
|
|
||||||
|
|
||||||
assert not filename in self.filecontents, filename
|
if filename in self.versioned_contents \
|
||||||
assert not filename in self.filecontentobjs, filename
|
or filename in self.platformed_contents \
|
||||||
|
or filename in self.file_content_objs:
|
||||||
|
self.print(f'{filename} already processed, skipping...')
|
||||||
|
continue
|
||||||
|
|
||||||
content = read_file(os.path.join(self.__headerdir, filename), True)
|
content = read_file(os.path.join(header_dir, filename), normalize=True)
|
||||||
content_objects = None
|
content_objects = None
|
||||||
|
|
||||||
# Parse cef_string.h happens in special case: grab only defined CEF_STRING_TYPE_xxx declaration
|
is_platform_specific = OS_TOKEN in content
|
||||||
if filename == "internal/cef_string.h":
|
is_version_specific = API_TOKEN in content
|
||||||
content_objects = self.__parse_string_type(content)
|
|
||||||
elif content.find('#if CEF_API') >= 0:
|
# Special case for parsing cef_string.h:
|
||||||
# Needs to be passed to clang with version-specific defines.
|
# Only extract declarations of the form #define CEF_STRING_TYPE_xxx
|
||||||
self.filecontents[filename] = content
|
if filename == 'internal/cef_string.h':
|
||||||
|
content_objects = _parse_string_type(filename, content)
|
||||||
|
elif is_platform_specific and not is_version_specific:
|
||||||
|
# Parse once and cache for all platforms
|
||||||
|
content_objects = parse_platformed_content(
|
||||||
|
filename,
|
||||||
|
content,
|
||||||
|
debug_dir,
|
||||||
|
verbose,
|
||||||
|
api_version=None,
|
||||||
|
added_defines=[])
|
||||||
|
elif is_platform_specific and is_version_specific:
|
||||||
|
# Needs to be passed to clang with version and platform defines.
|
||||||
|
self.platformed_contents[filename] = content
|
||||||
|
elif is_version_specific:
|
||||||
|
# Needs to be passed to clang with version defines.
|
||||||
|
self.versioned_contents[filename] = content
|
||||||
else:
|
else:
|
||||||
content_objects = self.__parse_objects(content)
|
content_objects = _parse_objects(filename, content, 'universal')
|
||||||
|
|
||||||
if not content_objects is None:
|
if content_objects is not None:
|
||||||
self.__prepare_objects(filename, content_objects)
|
self.file_content_objs[filename] = content_objects
|
||||||
self.filecontentobjs[filename] = content_objects
|
|
||||||
|
|
||||||
def calculate(self, api_version, debug_dir=None, added_defines=None):
|
def calculate(self, api_version: str, added_defines: list) -> Dict[str, str]:
|
||||||
debug_enabled = not (debug_dir is None) and len(debug_dir) > 0
|
""" Calculate the API hash per platform for the specified API version """
|
||||||
|
debug_dir = os.path.join(self.debug_dir,
|
||||||
|
api_version) if self.debug_dir else None
|
||||||
|
|
||||||
objects = []
|
objects = []
|
||||||
for filename in self.filenames:
|
for filename in self.filenames:
|
||||||
if self.__verbose:
|
self.print(f'Processing {filename}...')
|
||||||
print("Processing " + filename + "...")
|
|
||||||
|
|
||||||
content = self.filecontents.get(filename, None)
|
if filename in self.versioned_contents:
|
||||||
if not content is None:
|
content = self.versioned_contents.get(filename, None)
|
||||||
assert content.find('#if CEF_API') >= 0, filename
|
content_objects = parse_versioned_content(filename, content,
|
||||||
content = _run_clang_eval(filename, content, api_version, added_defines,
|
api_version, added_defines,
|
||||||
self.__verbose)
|
debug_dir, self.verbose)
|
||||||
if content is None:
|
elif filename in self.platformed_contents:
|
||||||
sys.stderr.write(
|
content = self.platformed_contents.get(filename, None)
|
||||||
'ERROR: Failed to compute API hash for %s\n' % filename)
|
content_objects = parse_platformed_content(filename, content, debug_dir,
|
||||||
return False
|
self.verbose, api_version,
|
||||||
if debug_enabled:
|
added_defines)
|
||||||
self.__write_debug_file(
|
|
||||||
debug_dir, 'clang-' + filename.replace('/', '-'), content)
|
|
||||||
|
|
||||||
# content must always start with newline as required by __parse_objects()
|
|
||||||
content_objects = self.__parse_objects('\n' + content)
|
|
||||||
self.__prepare_objects(filename, content_objects)
|
|
||||||
else:
|
else:
|
||||||
content_objects = self.filecontentobjs.get(filename, None)
|
content_objects = self.file_content_objs.get(filename, None)
|
||||||
|
|
||||||
assert not content_objects is None, filename
|
# May be None if the full contents of the file are excluded at certain API versions.
|
||||||
|
if not content_objects is None:
|
||||||
objects.extend(content_objects)
|
objects.extend(content_objects)
|
||||||
|
|
||||||
# objects will be sorted including filename, to make stable universal hashes
|
# objects will be sorted including filename to make stable hashes
|
||||||
objects = sorted(objects, key=lambda o: o["name"] + "@" + o["filename"])
|
objects = sorted(objects, key=lambda o: f"{o['name']}@{o['filename']}")
|
||||||
|
|
||||||
if debug_enabled:
|
if debug_dir:
|
||||||
namelen = max([len(o["name"]) for o in objects])
|
_save_objects_to_file(debug_dir, objects)
|
||||||
filenamelen = max([len(o["filename"]) for o in objects])
|
|
||||||
dumpsig = []
|
|
||||||
for o in objects:
|
|
||||||
dumpsig.append(
|
|
||||||
format(o["name"], str(namelen) + "s") + "|" + format(
|
|
||||||
o["filename"], "" + str(filenamelen) + "s") + "|" + o["text"])
|
|
||||||
self.__write_debug_file(debug_dir, "objects.txt", dumpsig)
|
|
||||||
|
|
||||||
revisions = {}
|
hashes = {}
|
||||||
|
for platform in PLATFORM_DEFINES.keys():
|
||||||
|
sig = _get_final_sig(objects, platform)
|
||||||
|
if debug_dir:
|
||||||
|
_write_debug_file(debug_dir, f'{platform}.sig', sig)
|
||||||
|
hashes[platform] = hashlib.sha1(sig.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
for platform in itertools.chain(["universal"], self.platforms):
|
return hashes
|
||||||
sig = self.__get_final_sig(objects, platform)
|
|
||||||
if debug_enabled:
|
|
||||||
self.__write_debug_file(debug_dir, platform + ".sig", sig)
|
|
||||||
revstr = hashlib.sha1(sig.encode('utf-8')).hexdigest()
|
|
||||||
revisions[platform] = revstr
|
|
||||||
|
|
||||||
return revisions
|
def print(self, msg):
|
||||||
|
if self.verbose:
|
||||||
def __parse_objects(self, content):
|
print(msg)
|
||||||
""" Returns array of objects in content file. """
|
|
||||||
objects = []
|
|
||||||
content = re.sub(r"//.*\n", "", content)
|
|
||||||
|
|
||||||
# function declarations
|
|
||||||
for m in re.finditer(
|
|
||||||
r"\nCEF_EXPORT\s+?.*?\s+?(\w+)\s*?\(.*?\)\s*?;",
|
|
||||||
content,
|
|
||||||
flags=re.DOTALL):
|
|
||||||
object = {"name": m.group(1), "text": m.group(0).strip()}
|
|
||||||
objects.append(object)
|
|
||||||
|
|
||||||
# structs
|
|
||||||
for m in re.finditer(
|
|
||||||
r"\ntypedef\s+?struct\s+?(\w+)\s+?\{.*?\}\s+?(\w+)\s*?;",
|
|
||||||
content,
|
|
||||||
flags=re.DOTALL):
|
|
||||||
text = m.group(0).strip()
|
|
||||||
# remove 'CEF_CALLBACK' to normalize cross-platform clang output
|
|
||||||
text = text.replace('CEF_CALLBACK', '')
|
|
||||||
object = {"name": m.group(2), "text": text}
|
|
||||||
objects.append(object)
|
|
||||||
|
|
||||||
# enums
|
|
||||||
for m in re.finditer(
|
|
||||||
r"\ntypedef\s+?enum\s+?\{.*?\}\s+?(\w+)\s*?;", content,
|
|
||||||
flags=re.DOTALL):
|
|
||||||
object = {"name": m.group(1), "text": m.group(0).strip()}
|
|
||||||
objects.append(object)
|
|
||||||
|
|
||||||
# typedefs
|
|
||||||
for m in re.finditer(r"\ntypedef\s+?.*?\s+(\w+);", content, flags=0):
|
|
||||||
object = {"name": m.group(1), "text": m.group(0).strip()}
|
|
||||||
objects.append(object)
|
|
||||||
|
|
||||||
return objects
|
|
||||||
|
|
||||||
def __prepare_objects(self, filename, objects):
|
|
||||||
platforms = list(
|
|
||||||
[p for p in self.platforms if self.__is_platform_filename(filename, p)])
|
|
||||||
for o in objects:
|
|
||||||
o["text"] = self.__prepare_text(o["text"])
|
|
||||||
o["platforms"] = platforms
|
|
||||||
o["filename"] = filename
|
|
||||||
|
|
||||||
def __parse_string_type(self, content):
|
|
||||||
""" Grab defined CEF_STRING_TYPE_xxx """
|
|
||||||
objects = []
|
|
||||||
for m in re.finditer(
|
|
||||||
r"\n\s*?#\s*?define\s+?(CEF_STRING_TYPE_\w+)\s+?.*?\n",
|
|
||||||
content,
|
|
||||||
flags=0):
|
|
||||||
object = {
|
|
||||||
"name": m.group(1),
|
|
||||||
"text": m.group(0),
|
|
||||||
}
|
|
||||||
objects.append(object)
|
|
||||||
return objects
|
|
||||||
|
|
||||||
def __prepare_text(self, text):
|
|
||||||
text = text.strip()
|
|
||||||
text = re.sub(r"\s+", " ", text)
|
|
||||||
text = re.sub(r"\(\s+", "(", text)
|
|
||||||
return text
|
|
||||||
|
|
||||||
def __get_final_sig(self, objects, platform):
|
|
||||||
sig = []
|
|
||||||
|
|
||||||
for o in objects:
|
|
||||||
if platform == "universal" or platform in o["platforms"]:
|
|
||||||
sig.append(o["text"])
|
|
||||||
|
|
||||||
return "\n".join(sig)
|
|
||||||
|
|
||||||
def __get_filenames(self, cef_dir, paths, excluded_files):
|
|
||||||
""" Returns file names to be processed, relative to headerdir """
|
|
||||||
filenames = [
|
|
||||||
os.path.relpath(os.path.join(cef_dir, filename),
|
|
||||||
self.__headerdir).replace('\\', '/').lower()
|
|
||||||
for filename in paths
|
|
||||||
]
|
|
||||||
|
|
||||||
if len(excluded_files) == 0:
|
|
||||||
return filenames
|
|
||||||
|
|
||||||
return [
|
|
||||||
filename for filename in filenames if not filename in excluded_files
|
|
||||||
]
|
|
||||||
|
|
||||||
def __is_platform_filename(self, filename, platform):
|
|
||||||
if platform == "universal":
|
|
||||||
return True
|
|
||||||
if not platform in self.platform_files:
|
|
||||||
return False
|
|
||||||
listed = False
|
|
||||||
for p in self.platforms:
|
|
||||||
if filename in self.platform_files[p]:
|
|
||||||
if p == platform:
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
listed = True
|
|
||||||
return not listed
|
|
||||||
|
|
||||||
def __write_debug_file(self, debug_dir, filename, content):
|
|
||||||
make_dir(debug_dir)
|
|
||||||
outfile = os.path.join(debug_dir, filename)
|
|
||||||
dir = os.path.dirname(outfile)
|
|
||||||
make_dir(dir)
|
|
||||||
if not isinstance(content, string_type):
|
|
||||||
content = "\n".join(content)
|
|
||||||
write_file(outfile, content)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import time
|
|
||||||
|
|
||||||
disc = """
|
parser = OptionParser(description='This utility calculates CEF API hash')
|
||||||
This utility calculates CEF API hash.
|
|
||||||
"""
|
|
||||||
|
|
||||||
parser = OptionParser(description=disc)
|
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'--cpp-header-dir',
|
'--cpp-header-dir',
|
||||||
dest='cppheaderdir',
|
dest='cpp_header_dir',
|
||||||
metavar='DIR',
|
metavar='DIR',
|
||||||
help='input directory for C++ header files [required]')
|
help='input directory for C++ header files [required]')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'--debug-dir',
|
'--debug-dir',
|
||||||
dest='debugdir',
|
dest='debug_dir',
|
||||||
metavar='DIR',
|
metavar='DIR',
|
||||||
help='intermediate directory for easy debugging')
|
help='intermediate directory for easy debugging')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
@@ -352,28 +390,16 @@ if __name__ == "__main__":
|
|||||||
help='output detailed status information')
|
help='output detailed status information')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
# the cppheader option is required
|
# the cpp_header_dir option is required
|
||||||
if options.cppheaderdir is None:
|
if options.cpp_header_dir is None:
|
||||||
parser.print_help(sys.stdout)
|
parser.print_help(sys.stdout)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# calculate
|
calc = CefApiHasher(options.cpp_header_dir, options.debug_dir,
|
||||||
c_start_time = time.time()
|
options.verbose)
|
||||||
|
revisions = calc.calculate(EXP_VERSION, [])
|
||||||
|
|
||||||
calc = cef_api_hash(options.cppheaderdir, options.debugdir, options.verbose)
|
print('{')
|
||||||
revisions = calc.calculate(api_version=EXP_VERSION)
|
|
||||||
|
|
||||||
c_completed_in = time.time() - c_start_time
|
|
||||||
|
|
||||||
if bool(revisions):
|
|
||||||
print("{")
|
|
||||||
for k in sorted(revisions.keys()):
|
for k in sorted(revisions.keys()):
|
||||||
print(format("\"" + k + "\"", ">12s") + ": \"" + revisions[k] + "\"")
|
print(format('"' + k + '"', '>12s') + ': "' + revisions[k] + '"')
|
||||||
print("}")
|
print('}')
|
||||||
|
|
||||||
# print
|
|
||||||
# print 'Completed in: ' + str(c_completed_in)
|
|
||||||
# print
|
|
||||||
|
|
||||||
# print "Press any key to continue...";
|
|
||||||
# sys.stdin.readline();
|
|
||||||
|
375
tools/cef_api_hash_test.py
Normal file
375
tools/cef_api_hash_test.py
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
# Copyright (c) 2025 The Chromium Embedded Framework Authors. All rights
|
||||||
|
# reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
# can be found in the LICENSE file.
|
||||||
|
|
||||||
|
# Execute the following command to run unit tests:
|
||||||
|
# python3 -m unittest discover -s tools -p *_test.py
|
||||||
|
|
||||||
|
from cef_api_hash import *
|
||||||
|
from collections import Counter
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
# Test constants:
|
||||||
|
FILENAME = 'test.h'
|
||||||
|
NONE_DEBUG_DIR = None
|
||||||
|
VERBOSE = False
|
||||||
|
ADDED_DEFINES = []
|
||||||
|
|
||||||
|
CEF_TYPES_WIN = """#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
||||||
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "include/cef_api_hash.h"
|
||||||
|
#include "include/internal/cef_types_runtime.h"
|
||||||
|
|
||||||
|
#define kNullCursorHandle NULL
|
||||||
|
#define kNullEventHandle NULL
|
||||||
|
#define kNullWindowHandle NULL
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Handle types.
|
||||||
|
typedef HWND cef_window_handle_t;
|
||||||
|
|
||||||
|
typedef struct _cef_window_info_t {
|
||||||
|
size_t size;
|
||||||
|
DWORD ex_style;
|
||||||
|
HMENU menu;
|
||||||
|
cef_window_handle_t parent_window;
|
||||||
|
cef_runtime_style_t runtime_style;
|
||||||
|
#if CEF_API_ADDED(13304)
|
||||||
|
int api_version_test;
|
||||||
|
#endif
|
||||||
|
} cef_window_info_t;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif // OS_WIN
|
||||||
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
|
||||||
|
"""
|
||||||
|
|
||||||
|
CEF_TYPES_MAC = """#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
||||||
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <this_header_does_not_exist.h>
|
||||||
|
|
||||||
|
#if defined(OS_MAC)
|
||||||
|
#include "include/internal/cef_string.h"
|
||||||
|
#include "include/internal/cef_types_geometry.h"
|
||||||
|
#include "include/internal/cef_types_runtime.h"
|
||||||
|
|
||||||
|
#define kNullCursorHandle NULL
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
#if __has_feature(objc_arc)
|
||||||
|
#define CAST_CEF_CURSOR_HANDLE_TO_NSCURSOR(handle) ((__bridge NSCursor*)handle)
|
||||||
|
#define CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(handle) ((__bridge NSView*)handle)
|
||||||
|
|
||||||
|
#define CAST_NSCURSOR_TO_CEF_CURSOR_HANDLE(cursor) ((__bridge void*)cursor)
|
||||||
|
#define CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(view) ((__bridge void*)view)
|
||||||
|
#else // __has_feature(objc_arc)
|
||||||
|
#define CAST_CEF_CURSOR_HANDLE_TO_NSCURSOR(handle) ((NSCursor*)handle)
|
||||||
|
#define CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(handle) ((NSView*)handle)
|
||||||
|
|
||||||
|
#define CAST_NSCURSOR_TO_CEF_CURSOR_HANDLE(cursor) ((void*)cursor)
|
||||||
|
#define CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(view) ((void*)view)
|
||||||
|
#endif // __has_feature(objc_arc)
|
||||||
|
#endif // __OBJC__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Actually NSView*
|
||||||
|
typedef void* cef_window_handle_t;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Class representing window information.
|
||||||
|
///
|
||||||
|
typedef struct _cef_window_info_t {
|
||||||
|
size_t size;
|
||||||
|
cef_string_t window_name;
|
||||||
|
cef_rect_t bounds;
|
||||||
|
cef_window_handle_t view;
|
||||||
|
cef_runtime_style_t runtime_style;
|
||||||
|
} cef_window_info_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // OS_MAC
|
||||||
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
|
||||||
|
"""
|
||||||
|
|
||||||
|
CEF_TYPES_LINUX = """#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
||||||
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#if !defined(GENERATING_CEF_API_HASH)
|
||||||
|
#include "include/base/cef_build.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
|
||||||
|
#include "include/internal/cef_export.h"
|
||||||
|
#include "include/internal/cef_string.h"
|
||||||
|
#include "include/internal/cef_types_color.h"
|
||||||
|
#include "include/internal/cef_types_geometry.h"
|
||||||
|
#include "include/internal/cef_types_osr.h"
|
||||||
|
#include "include/internal/cef_types_runtime.h"
|
||||||
|
|
||||||
|
#define kNullCursorHandle 0
|
||||||
|
#define kNullEventHandle NULL
|
||||||
|
#define kNullWindowHandle 0
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CEF_X11)
|
||||||
|
typedef union _XEvent XEvent;
|
||||||
|
typedef struct _XDisplay XDisplay;
|
||||||
|
|
||||||
|
// Handle types.
|
||||||
|
typedef XEvent* cef_event_handle_t;
|
||||||
|
#else
|
||||||
|
typedef void* cef_event_handle_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned long cef_window_handle_t;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Return the singleton X11 display shared with Chromium. The display is not
|
||||||
|
/// thread-safe and must only be accessed on the browser process UI thread.
|
||||||
|
///
|
||||||
|
#if defined(CEF_X11)
|
||||||
|
CEF_EXPORT XDisplay* cef_get_xdisplay(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct _cef_window_info_t {
|
||||||
|
size_t size;
|
||||||
|
cef_string_t window_name;
|
||||||
|
cef_rect_t bounds;
|
||||||
|
cef_window_handle_t parent_window;
|
||||||
|
cef_window_handle_t window;
|
||||||
|
cef_runtime_style_t runtime_style;
|
||||||
|
} cef_window_info_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // OS_LINUX
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
|
||||||
|
"""
|
||||||
|
|
||||||
|
CEF_TYPES = """#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_H_
|
||||||
|
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_H_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/cef_api_hash.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CEF_CPAIT_OPTIMIZATION_GUIDE,
|
||||||
|
#if CEF_API_ADDED(13304)
|
||||||
|
CEF_CPAIT_COLLABORATION_MESSAGING,
|
||||||
|
#endif
|
||||||
|
CEF_CPAIT_NUM_VALUES,
|
||||||
|
} cef_chrome_page_action_icon_type_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_H_
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class TestRunClangEval(unittest.TestCase):
|
||||||
|
|
||||||
|
def test_parse_platformed_content_version_13304(self):
|
||||||
|
expected_objects = [{
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'cef_window_handle_t',
|
||||||
|
'platform': 'windows',
|
||||||
|
'text': 'typedef HWND cef_window_handle_t;'
|
||||||
|
}, {
|
||||||
|
'filename':
|
||||||
|
FILENAME,
|
||||||
|
'name':
|
||||||
|
'cef_window_info_t',
|
||||||
|
'platform':
|
||||||
|
'windows',
|
||||||
|
'text':
|
||||||
|
'typedef struct _cef_window_info_t { size_t size; DWORD ex_style; HMENU menu; cef_window_handle_t parent_window; cef_runtime_style_t runtime_style; int api_version_test; } cef_window_info_t;'
|
||||||
|
}]
|
||||||
|
|
||||||
|
objects = parse_platformed_content(FILENAME, CEF_TYPES_WIN, NONE_DEBUG_DIR,
|
||||||
|
VERBOSE, '13304', ADDED_DEFINES)
|
||||||
|
|
||||||
|
self.__assert_equal_objects(objects, expected_objects)
|
||||||
|
|
||||||
|
def test_parse_platformed_content_version_13300(self):
|
||||||
|
expected_objects = [{
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'cef_window_handle_t',
|
||||||
|
'platform': 'windows',
|
||||||
|
'text': 'typedef HWND cef_window_handle_t;'
|
||||||
|
}, {
|
||||||
|
'filename':
|
||||||
|
FILENAME,
|
||||||
|
'name':
|
||||||
|
'cef_window_info_t',
|
||||||
|
'platform':
|
||||||
|
'windows',
|
||||||
|
'text':
|
||||||
|
'typedef struct _cef_window_info_t { size_t size; DWORD ex_style; HMENU menu; cef_window_handle_t parent_window; cef_runtime_style_t runtime_style; } cef_window_info_t;'
|
||||||
|
}]
|
||||||
|
|
||||||
|
objects = parse_platformed_content(FILENAME, CEF_TYPES_WIN, NONE_DEBUG_DIR,
|
||||||
|
VERBOSE, '13300', ADDED_DEFINES)
|
||||||
|
|
||||||
|
self.__assert_equal_objects(objects, expected_objects)
|
||||||
|
|
||||||
|
def test_parse_platformed_content_mac(self):
|
||||||
|
expected_objects = [{
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'cef_window_handle_t',
|
||||||
|
'platform': 'mac',
|
||||||
|
'text': 'typedef void* cef_window_handle_t;'
|
||||||
|
}, {
|
||||||
|
'filename':
|
||||||
|
FILENAME,
|
||||||
|
'name':
|
||||||
|
'cef_window_info_t',
|
||||||
|
'platform':
|
||||||
|
'mac',
|
||||||
|
'text':
|
||||||
|
'typedef struct _cef_window_info_t { size_t size; cef_string_t window_name; cef_rect_t bounds; cef_window_handle_t view; cef_runtime_style_t runtime_style; } cef_window_info_t;'
|
||||||
|
}]
|
||||||
|
|
||||||
|
objects = parse_platformed_content(
|
||||||
|
FILENAME,
|
||||||
|
CEF_TYPES_MAC,
|
||||||
|
NONE_DEBUG_DIR,
|
||||||
|
VERBOSE,
|
||||||
|
api_version=None,
|
||||||
|
added_defines=[])
|
||||||
|
|
||||||
|
self.__assert_equal_objects(objects, expected_objects)
|
||||||
|
|
||||||
|
def test_parse_platformed_content_linux(self):
|
||||||
|
expected_objects = [{
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'XEvent',
|
||||||
|
'platform': 'linux',
|
||||||
|
'text': 'typedef union _XEvent XEvent;'
|
||||||
|
}, {
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'XDisplay',
|
||||||
|
'platform': 'linux',
|
||||||
|
'text': 'typedef struct _XDisplay XDisplay;'
|
||||||
|
}, {
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'cef_event_handle_t',
|
||||||
|
'platform': 'linux',
|
||||||
|
'text': 'typedef XEvent* cef_event_handle_t;'
|
||||||
|
}, {
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'cef_window_handle_t',
|
||||||
|
'platform': 'linux',
|
||||||
|
'text': 'typedef unsigned long cef_window_handle_t;'
|
||||||
|
}, {
|
||||||
|
'filename': FILENAME,
|
||||||
|
'name': 'cef_get_xdisplay',
|
||||||
|
'platform': 'linux',
|
||||||
|
'text': 'CEF_EXPORT XDisplay* cef_get_xdisplay(void);'
|
||||||
|
}, {
|
||||||
|
'filename':
|
||||||
|
FILENAME,
|
||||||
|
'name':
|
||||||
|
'cef_window_info_t',
|
||||||
|
'platform':
|
||||||
|
'linux',
|
||||||
|
'text':
|
||||||
|
'typedef struct _cef_window_info_t { size_t size; cef_string_t window_name; cef_rect_t bounds; cef_window_handle_t parent_window; cef_window_handle_t window; cef_runtime_style_t runtime_style; } cef_window_info_t;'
|
||||||
|
}]
|
||||||
|
|
||||||
|
objects = parse_platformed_content(
|
||||||
|
FILENAME,
|
||||||
|
CEF_TYPES_LINUX,
|
||||||
|
NONE_DEBUG_DIR,
|
||||||
|
VERBOSE,
|
||||||
|
api_version=None,
|
||||||
|
added_defines=[])
|
||||||
|
|
||||||
|
self.__assert_equal_objects(objects, expected_objects)
|
||||||
|
|
||||||
|
def test_parse_versioned_content_version_13304(self):
|
||||||
|
expected_objects = [{
|
||||||
|
'filename':
|
||||||
|
FILENAME,
|
||||||
|
'name':
|
||||||
|
'cef_chrome_page_action_icon_type_t',
|
||||||
|
'platform':
|
||||||
|
'universal',
|
||||||
|
'text':
|
||||||
|
'typedef enum { CEF_CPAIT_OPTIMIZATION_GUIDE, CEF_CPAIT_COLLABORATION_MESSAGING, CEF_CPAIT_NUM_VALUES, } cef_chrome_page_action_icon_type_t;'
|
||||||
|
}]
|
||||||
|
|
||||||
|
objects = parse_versioned_content(FILENAME, CEF_TYPES, '13304',
|
||||||
|
ADDED_DEFINES, NONE_DEBUG_DIR, VERBOSE)
|
||||||
|
|
||||||
|
self.assertEqual(objects, expected_objects)
|
||||||
|
|
||||||
|
def test_parse_versioned_content_version_13303(self):
|
||||||
|
expected_objects = [{
|
||||||
|
'filename':
|
||||||
|
FILENAME,
|
||||||
|
'name':
|
||||||
|
'cef_chrome_page_action_icon_type_t',
|
||||||
|
'platform':
|
||||||
|
'universal',
|
||||||
|
'text':
|
||||||
|
'typedef enum { CEF_CPAIT_OPTIMIZATION_GUIDE, CEF_CPAIT_NUM_VALUES, } cef_chrome_page_action_icon_type_t;'
|
||||||
|
}]
|
||||||
|
|
||||||
|
objects = parse_versioned_content(FILENAME, CEF_TYPES, '13303',
|
||||||
|
ADDED_DEFINES, NONE_DEBUG_DIR, VERBOSE)
|
||||||
|
|
||||||
|
self.assertEqual(objects, expected_objects)
|
||||||
|
|
||||||
|
def __assert_equal_objects(self, actual, expected):
|
||||||
|
# Compare the objects as sets since the order is not guaranteed
|
||||||
|
expected = Counter(tuple(sorted(d.items())) for d in expected)
|
||||||
|
actual = Counter(tuple(sorted(d.items())) for d in actual)
|
||||||
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@@ -1352,10 +1352,15 @@ class obj_class:
|
|||||||
|
|
||||||
# Clamp to class versions, if specified.
|
# Clamp to class versions, if specified.
|
||||||
if self.has_version_added():
|
if self.has_version_added():
|
||||||
versions = [x for x in versions if x >= self.get_version_added()]
|
version_added = self.get_version_added()
|
||||||
|
versions = [x for x in versions if x >= version_added]
|
||||||
|
if not version_added in versions:
|
||||||
|
versions.append(version_added)
|
||||||
if self.has_version_removed():
|
if self.has_version_removed():
|
||||||
versions = [x for x in versions if x < self.get_version_removed()]
|
versions = [x for x in versions if x < self.get_version_removed()]
|
||||||
|
|
||||||
|
assert len(versions) > 0, self.get_name()
|
||||||
|
|
||||||
self.allversions = sorted(versions)
|
self.allversions = sorted(versions)
|
||||||
return self.allversions
|
return self.allversions
|
||||||
|
|
||||||
|
@@ -161,7 +161,7 @@ class VersionFormatter:
|
|||||||
# - "X" is the Chromium major version (e.g. 74).
|
# - "X" is the Chromium major version (e.g. 74).
|
||||||
# - "Y" is an incremental number that starts at 0 when a release branch is
|
# - "Y" is an incremental number that starts at 0 when a release branch is
|
||||||
# created and changes only when the CEF C/C++ API changes (similar to how
|
# created and changes only when the CEF C/C++ API changes (similar to how
|
||||||
# the CEF_API_HASH_UNIVERSAL value behaves in cef_api_hash.h) (release
|
# the CEF_API_HASH_PLATFORM value behaves in cef_api_hash.h) (release
|
||||||
# branch only).
|
# branch only).
|
||||||
# - "Z" is an incremental number that starts at 0 when a release branch is
|
# - "Z" is an incremental number that starts at 0 when a release branch is
|
||||||
# created and changes on each commit, with reset to 0 when "Y" changes
|
# created and changes on each commit, with reset to 0 when "Y" changes
|
||||||
|
@@ -27,7 +27,7 @@ else:
|
|||||||
def clang_format(file_name, file_contents):
|
def clang_format(file_name, file_contents):
|
||||||
# -assume-filename is necessary to find the .clang-format file and determine
|
# -assume-filename is necessary to find the .clang-format file and determine
|
||||||
# the language when specifying contents via stdin.
|
# the language when specifying contents via stdin.
|
||||||
result = exec_cmd("%s -assume-filename=%s" % (clang_format_exe, file_name), \
|
result = exec_cmd("%s -assume-filename=%s" % (clang_format_exe, file_name),
|
||||||
cef_dir, file_contents.encode('utf-8'))
|
cef_dir, file_contents.encode('utf-8'))
|
||||||
if result['err'] != '':
|
if result['err'] != '':
|
||||||
sys.stderr.write("clang-format error: %s\n" % result['err'])
|
sys.stderr.write("clang-format error: %s\n" % result['err'])
|
||||||
@@ -48,32 +48,28 @@ def clang_format_inplace(file_name):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def clang_eval(file_name,
|
def clang_eval(file_name, file_contents, defines, includes, verbose):
|
||||||
file_contents,
|
lang = 'c'
|
||||||
defines=[],
|
|
||||||
includes=[],
|
|
||||||
as_cpp=True,
|
|
||||||
verbose=False):
|
|
||||||
lang = 'c++' if as_cpp else 'c'
|
|
||||||
if file_name.lower().endswith('.h'):
|
if file_name.lower().endswith('.h'):
|
||||||
lang += '-header'
|
lang += '-header'
|
||||||
# The -P option removes unnecessary line markers and whitespace.
|
# The -P option removes unnecessary line markers and whitespace.
|
||||||
format = '/EP' if sys.platform == 'win32' else '-E -P'
|
format = '/EP' if sys.platform == 'win32' else '-E -P'
|
||||||
|
|
||||||
cmd = "%s -x %s %s %s %s -" % (clang_exe, lang, format,
|
cmd = "%s -x %s %s %s %s -" % (clang_exe, lang, format,
|
||||||
' '.join(['-D' + v for v in defines]),
|
' '.join(['-D' + v for v in defines]),
|
||||||
' '.join(['-I' + v for v in includes]))
|
' '.join(['-I' + v for v in includes]))
|
||||||
if verbose:
|
if verbose:
|
||||||
print('--- Running "%s" in "%s"' % (cmd, cef_dir))
|
print(f'--- Running "{cmd}" in "{cef_dir}"')
|
||||||
|
|
||||||
result = exec_cmd(cmd, cef_dir, file_contents.encode('utf-8'))
|
result = exec_cmd(cmd, cef_dir, file_contents.encode('utf-8'))
|
||||||
if result['err'] != '':
|
if result['err'] != '' or result['ret'] != 0:
|
||||||
err = result['err'].replace('<stdin>', file_name)
|
error = result['err'].replace('<stdin>', file_name)
|
||||||
sys.stderr.write("clang error: %s\n" % err)
|
return_code = result['ret']
|
||||||
|
sys.stderr.write(f'clang {return_code=} {error=}\n')
|
||||||
return None
|
return None
|
||||||
if result['out'] != '':
|
|
||||||
output = result['out']
|
output = result['out']
|
||||||
if sys.platform == 'win32':
|
if output and sys.platform == 'win32':
|
||||||
# Convert to Unix line endings.
|
# Convert to Unix line endings.
|
||||||
output = output.replace("\r", "")
|
output = output.replace("\r", "")
|
||||||
return output
|
return output
|
||||||
return None
|
|
||||||
|
@@ -13,7 +13,7 @@ def exec_cmd(cmd, path, input_string=None):
|
|||||||
err = ''
|
err = ''
|
||||||
ret = -1
|
ret = -1
|
||||||
parts = cmd.split()
|
parts = cmd.split()
|
||||||
try:
|
|
||||||
if input_string is None:
|
if input_string is None:
|
||||||
process = Popen(
|
process = Popen(
|
||||||
parts,
|
parts,
|
||||||
@@ -33,9 +33,5 @@ def exec_cmd(cmd, path, input_string=None):
|
|||||||
shell=(sys.platform == 'win32'))
|
shell=(sys.platform == 'win32'))
|
||||||
out, err = process.communicate(input=input_string)
|
out, err = process.communicate(input=input_string)
|
||||||
ret = process.returncode
|
ret = process.returncode
|
||||||
except IOError as e:
|
|
||||||
(errno, strerror) = e.args
|
|
||||||
raise
|
|
||||||
except:
|
|
||||||
raise
|
|
||||||
return {'out': out.decode('utf-8'), 'err': err.decode('utf-8'), 'ret': ret}
|
return {'out': out.decode('utf-8'), 'err': err.decode('utf-8'), 'ret': ret}
|
||||||
|
@@ -8,8 +8,8 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
# Force use of the git version bundled with depot_tools.
|
# Force use of the system installed Git version.
|
||||||
git_exe = 'git.bat'
|
git_exe = 'git.exe'
|
||||||
else:
|
else:
|
||||||
git_exe = 'git'
|
git_exe = 'git'
|
||||||
|
|
||||||
@@ -30,6 +30,15 @@ def exec_git_cmd(args, path='.'):
|
|||||||
""" Executes a git command with the specified |args|. """
|
""" Executes a git command with the specified |args|. """
|
||||||
cmd = "%s %s" % (git_exe, args)
|
cmd = "%s %s" % (git_exe, args)
|
||||||
result = exec_cmd(cmd, path)
|
result = exec_cmd(cmd, path)
|
||||||
|
if result['ret'] != 0:
|
||||||
|
sys.stderr.write('Command \"%s\" exited with retval %d\n' % (cmd,
|
||||||
|
result['ret']))
|
||||||
|
if result['err'] != '':
|
||||||
|
err = result['err'].strip()
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
# Convert to Unix line endings.
|
||||||
|
err = err.replace('\r\n', '\n')
|
||||||
|
sys.stderr.write(err + '\n')
|
||||||
if result['out'] != '':
|
if result['out'] != '':
|
||||||
out = result['out'].strip()
|
out = result['out'].strip()
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
|
@@ -11,8 +11,8 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def make_api_versions_header(json):
|
def make_api_versions_header(json):
|
||||||
result = get_copyright(full=True, translator=False) + \
|
result = get_copyright(
|
||||||
"""//
|
full=True, translator=False) + """//
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// This file was generated by the make_api_versions_header.py tool. Versions
|
// This file was generated by the make_api_versions_header.py tool. Versions
|
||||||
@@ -27,42 +27,40 @@ def make_api_versions_header(json):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
for version, hashes in json['hashes'].items():
|
for version, hashes in json['hashes'].items():
|
||||||
version_part = """
|
version_part = f"""
|
||||||
// $COMMENT$
|
// $COMMENT$
|
||||||
#define CEF_API_VERSION_$VER$ $VER$
|
#define CEF_API_VERSION_{version} {version}
|
||||||
#define CEF_API_HASH_$VER$_UNIVERSAL "$UNIVERSAL$"
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#define CEF_API_HASH_$VER$_PLATFORM "$WINDOWS$"
|
#define CEF_API_HASH_{version} "$WINDOWS$"
|
||||||
#elif defined(OS_MAC)
|
#elif defined(OS_MAC)
|
||||||
#define CEF_API_HASH_$VER$_PLATFORM "$MAC$"
|
#define CEF_API_HASH_{version} "$MAC$"
|
||||||
#elif defined(OS_LINUX)
|
#elif defined(OS_LINUX)
|
||||||
#define CEF_API_HASH_$VER$_PLATFORM "$LINUX$"
|
#define CEF_API_HASH_{version} "$LINUX$"
|
||||||
#endif
|
#endif
|
||||||
""".replace('$VER$', version)
|
"""
|
||||||
|
|
||||||
# Substitute hash values for placeholders.
|
# Substitute hash values for placeholders.
|
||||||
for key, value in hashes.items():
|
for key, value in hashes.items():
|
||||||
version_part = version_part.replace('$%s$' % key.upper(), value)
|
version_part = version_part.replace(f"${key.upper()}$", value)
|
||||||
|
|
||||||
result += version_part
|
result += version_part
|
||||||
|
|
||||||
result += \
|
result += f"""
|
||||||
"""
|
|
||||||
// Oldest supported CEF version.
|
// Oldest supported CEF version.
|
||||||
#define CEF_API_VERSION_MIN CEF_API_VERSION_$MIN$
|
#define CEF_API_VERSION_MIN CEF_API_VERSION_{json['min']}
|
||||||
|
|
||||||
// Newest supported CEF version.
|
// Newest supported CEF version.
|
||||||
#define CEF_API_VERSION_LAST CEF_API_VERSION_$LAST$
|
#define CEF_API_VERSION_LAST CEF_API_VERSION_{json['last']}
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_API_VERSIONS_H_
|
#endif // CEF_INCLUDE_CEF_API_VERSIONS_H_
|
||||||
""".replace('$LAST$', json['last']).replace('$MIN$', json['min'])
|
"""
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def make_api_versions_inc(json):
|
def make_api_versions_inc(json):
|
||||||
result = get_copyright(full=False, translator=False) + \
|
result = get_copyright(
|
||||||
"""//
|
full=False, translator=False) + """//
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// This file was generated by the make_api_versions_header.py tool.
|
// This file was generated by the make_api_versions_header.py tool.
|
||||||
@@ -72,56 +70,53 @@ namespace {
|
|||||||
|
|
||||||
struct ApiVersionHash {
|
struct ApiVersionHash {
|
||||||
int version;
|
int version;
|
||||||
const char* const universal;
|
const char* const hash;
|
||||||
const char* const platform;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ApiVersionHash kApiVersionHashes[] = {"""
|
const ApiVersionHash kApiVersionHashes[] = {"""
|
||||||
|
|
||||||
for version, hashes in json['hashes'].items():
|
for version in json['hashes'].keys():
|
||||||
|
result += f"\n{{{version}, CEF_API_HASH_{version}}},"
|
||||||
|
|
||||||
result += """
|
result += """
|
||||||
{$VER$, CEF_API_HASH_$VER$_UNIVERSAL, CEF_API_HASH_$VER$_PLATFORM},""".replace(
|
|
||||||
'$VER$', version)
|
|
||||||
|
|
||||||
result += \
|
|
||||||
"""
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t kApiVersionHashesSize = std::size(kApiVersionHashes);
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def write_api_versions(out_header_file, out_inc_file, json):
|
def write_api_versions(out_header_file, out_inc_file, json) -> bool:
|
||||||
|
"""
|
||||||
|
Return True if the files were written, False if no changes were made.
|
||||||
|
"""
|
||||||
out_file = os.path.abspath(out_header_file)
|
out_file = os.path.abspath(out_header_file)
|
||||||
result = make_api_versions_header(json)
|
result = make_api_versions_header(json)
|
||||||
if not bool(result):
|
if not result:
|
||||||
sys.stderr.write('Failed to create %s\n' % out_file)
|
sys.stderr.write(f'Failed to create {out_file}\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
retval1 = write_file_if_changed(out_file, result)
|
header_write_result = write_file_if_changed(out_file, result)
|
||||||
|
|
||||||
out_file = os.path.abspath(out_inc_file)
|
out_file = os.path.abspath(out_inc_file)
|
||||||
result = make_api_versions_inc(json)
|
result = make_api_versions_inc(json)
|
||||||
if not bool(result):
|
if not result:
|
||||||
sys.stderr.write('Failed to create %s\n' % out_file)
|
sys.stderr.write(f'Failed to create {out_file}\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
retval2 = write_file_if_changed(out_file, result)
|
inc_write_result = write_file_if_changed(out_file, result)
|
||||||
|
|
||||||
return retval1 or retval2
|
return header_write_result or inc_write_result
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
if len(argv) < 5:
|
if len(argv) < 5:
|
||||||
print(
|
print(
|
||||||
"Usage:\n %s <output_header_file> <output_inc_file> <api_versions_file> <api_untracked_file>"
|
f"Usage:\n {argv[0]} <output_header_file> <output_inc_file> <api_versions_file> <api_untracked_file>"
|
||||||
% argv[0])
|
)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
json, initialized = \
|
json = read_version_files(argv[3], argv[4], initialize=True, combine=True)[0]
|
||||||
read_version_files(argv[3], argv[4], True, combine=True)
|
|
||||||
if not write_api_versions(argv[1], argv[2], json):
|
if not write_api_versions(argv[1], argv[2], json):
|
||||||
print('Nothing done')
|
print('Nothing done')
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ def make_capi_versions_header(header, filename):
|
|||||||
translate_map = header.get_capi_translations()
|
translate_map = header.get_capi_translations()
|
||||||
|
|
||||||
# header string
|
# header string
|
||||||
result = get_copyright(full=True, translator=False) + \
|
result = get_copyright(full=False, translator=False) + \
|
||||||
"""//
|
"""//
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@@ -102,6 +102,10 @@ def make_ctocpp_function_impl_new(cls, name, func, base_scoped, version,
|
|||||||
result += '\n auto* _struct = reinterpret_cast<'+\
|
result += '\n auto* _struct = reinterpret_cast<'+\
|
||||||
func.parent.get_capi_name(version=version)+'*>(GetStruct());'
|
func.parent.get_capi_name(version=version)+'*>(GetStruct());'
|
||||||
|
|
||||||
|
result += '\n if (!_struct->' + func.get_capi_name() + ') {'\
|
||||||
|
'\n return' + retval_default + ';'\
|
||||||
|
'\n }\n'
|
||||||
|
|
||||||
# add API hash check
|
# add API hash check
|
||||||
if func.has_attrib('api_hash_check'):
|
if func.has_attrib('api_hash_check'):
|
||||||
result += '\n const char* api_hash = cef_api_hash(CEF_API_VERSION, 0);'\
|
result += '\n const char* api_hash = cef_api_hash(CEF_API_VERSION, 0);'\
|
||||||
|
@@ -115,6 +115,8 @@ parser.add_option(
|
|||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if not options.patchfile is None:
|
if not options.patchfile is None:
|
||||||
apply_patch_file(options.patchfile, options.patchdir)
|
result = apply_patch_file(options.patchfile, options.patchdir)
|
||||||
|
if result == 'fail':
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
apply_patch_config()
|
apply_patch_config()
|
||||||
|
@@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from cef_api_hash import cef_api_hash
|
from typing import Dict
|
||||||
|
from cef_api_hash import CefApiHasher
|
||||||
from cef_version import VersionFormatter
|
from cef_version import VersionFormatter
|
||||||
from date_util import get_date
|
from date_util import get_date
|
||||||
from file_util import read_file, read_json_file, write_file, write_json_file
|
from file_util import read_file, read_json_file, write_file, write_json_file
|
||||||
@@ -41,49 +42,37 @@ def get_next_api_revision(api_versions_file, major_version):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
_CALC = None
|
def compute_api_hashes(api_version: str,
|
||||||
|
hasher: CefApiHasher,
|
||||||
|
next_allowed: bool) -> Dict[str, str]:
|
||||||
def compute_api_hashes(cpp_header_dir, api_version, next_allowed, debug_dir,
|
""" Computes API hashes for the specified |api_version|. """
|
||||||
verbose):
|
|
||||||
""" Computes API hashes for the specified |api_version|.
|
|
||||||
"""
|
|
||||||
if not debug_dir is None:
|
|
||||||
debug_dir = os.path.join(debug_dir, api_version)
|
|
||||||
|
|
||||||
if not next_allowed:
|
if not next_allowed:
|
||||||
# Next usage is banned with explicit API versions.
|
# Next usage is banned with explicit API versions.
|
||||||
assert not api_version in UNTRACKED_VERSIONS, api_version
|
assert api_version not in UNTRACKED_VERSIONS, api_version
|
||||||
added_defines = [
|
added_defines = [
|
||||||
# Using CEF_API_VERSION_NEXT is an error.
|
# Using CEF_API_VERSION_NEXT is an error.
|
||||||
'CEF_API_VERSION_NEXT="Please_specify_an_exact_CEF_version"',
|
'CEF_API_VERSION_NEXT="Please_specify_an_exact_CEF_version"',
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
added_defines = None
|
added_defines = []
|
||||||
|
|
||||||
global _CALC
|
hashes = hasher.calculate(api_version, added_defines)
|
||||||
if _CALC is None:
|
if hashes:
|
||||||
_CALC = cef_api_hash(cpp_header_dir, verbose=verbose)
|
|
||||||
|
|
||||||
hashes = _CALC.calculate(api_version, debug_dir, added_defines)
|
|
||||||
if bool(hashes):
|
|
||||||
if api_version in UNTRACKED_VERSIONS:
|
if api_version in UNTRACKED_VERSIONS:
|
||||||
label = version_label(api_version)
|
label = version_label(api_version)
|
||||||
label = label[0:1].upper() + label[1:]
|
label = label[0:1].upper() + label[1:]
|
||||||
hashes['comment'] = '%s last updated %s.' % (label, get_date())
|
hashes['comment'] = f'{label} last updated {get_date()}.'
|
||||||
else:
|
else:
|
||||||
hashes['comment'] = 'Added %s.' % get_date()
|
hashes['comment'] = f'Added {get_date()}.'
|
||||||
return hashes
|
return hashes
|
||||||
|
|
||||||
|
|
||||||
def same_api_hashes(hashes1, hashes2):
|
def same_api_hashes(hashes1, hashes2):
|
||||||
for key in ('universal', 'linux', 'mac', 'windows'):
|
return all(hashes1[key] == hashes2[key]
|
||||||
if hashes1[key] != hashes2[key]:
|
for key in ['linux', 'mac', 'windows'])
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def compute_next_api_verson(api_versions_file):
|
def compute_next_api_version(api_versions_file):
|
||||||
""" Computes the next available API version number.
|
""" Computes the next available API version number.
|
||||||
"""
|
"""
|
||||||
major_version = int(VersionFormatter().get_chrome_major_version())
|
major_version = int(VersionFormatter().get_chrome_major_version())
|
||||||
@@ -95,7 +84,10 @@ def compute_next_api_verson(api_versions_file):
|
|||||||
|
|
||||||
|
|
||||||
def git_grep_next(cef_dir):
|
def git_grep_next(cef_dir):
|
||||||
cmd = "grep --no-color -n -E (CEF_NEXT|CEF_NEXT)|=next -- :!include/cef_api_hash.h *.h"
|
cmd = "grep --no-color -n -E (CEF_NEXT|CEF_NEXT)|=next -- :!include/cef_api_hash.h *.h *.cc"
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
# Pass the pipe (|) character as a literal argument.
|
||||||
|
cmd = cmd.replace('|', '^|')
|
||||||
return exec_git_cmd(cmd, cef_dir)
|
return exec_git_cmd(cmd, cef_dir)
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +97,7 @@ def find_next_usage(cpp_header_dir):
|
|||||||
if result is None:
|
if result is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
sys.stderr.write('ERROR: NEXT usage found in CEF headers:\n\n' + result +
|
sys.stderr.write('ERROR: NEXT usage found in CEF source files:\n\n' + result +
|
||||||
'\n\nFix manually or run with --replace-next.\n')
|
'\n\nFix manually or run with --replace-next.\n')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -204,8 +196,11 @@ def find_replace_next_usage(cpp_header_dir, next_version):
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
def exec_apply(api_versions_file,
|
||||||
next_version, debug_dir, apply_next, verbose):
|
api_untracked_file,
|
||||||
|
next_version,
|
||||||
|
apply_next,
|
||||||
|
hasher: CefApiHasher) -> int:
|
||||||
""" Updates untracked API hashes if necessary.
|
""" Updates untracked API hashes if necessary.
|
||||||
Saves the hash for the next API version if |apply_next| is true.
|
Saves the hash for the next API version if |apply_next| is true.
|
||||||
"""
|
"""
|
||||||
@@ -219,9 +214,8 @@ def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
|||||||
untracked_changed = False
|
untracked_changed = False
|
||||||
for version in UNTRACKED_VERSIONS:
|
for version in UNTRACKED_VERSIONS:
|
||||||
label = version_label(version)
|
label = version_label(version)
|
||||||
hashes = compute_api_hashes(cpp_header_dir, version, True, debug_dir,
|
hashes = compute_api_hashes(version, hasher, next_allowed=True)
|
||||||
verbose)
|
if not hashes:
|
||||||
if not bool(hashes):
|
|
||||||
sys.stderr.write('ERROR: Failed to process %s\n' % label)
|
sys.stderr.write('ERROR: Failed to process %s\n' % label)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -237,9 +231,8 @@ def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
|||||||
if apply_next:
|
if apply_next:
|
||||||
next_label = version_label(next_version)
|
next_label = version_label(next_version)
|
||||||
|
|
||||||
hashes = compute_api_hashes(cpp_header_dir, next_version, False, debug_dir,
|
hashes = compute_api_hashes(next_version, hasher, next_allowed=False)
|
||||||
verbose)
|
if not hashes:
|
||||||
if not bool(hashes):
|
|
||||||
sys.stderr.write('ERROR: Failed to process %s\n' % next_label)
|
sys.stderr.write('ERROR: Failed to process %s\n' % next_label)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@@ -275,29 +268,33 @@ def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def exec_check(cpp_header_dir, api_versions_file, api_untracked_file, debug_dir,
|
def exec_check(api_versions_file,
|
||||||
fast_check, force_update, skip_untracked, verbose):
|
api_untracked_file,
|
||||||
|
fast_check,
|
||||||
|
force_update,
|
||||||
|
skip_untracked,
|
||||||
|
hasher: CefApiHasher) -> int:
|
||||||
""" Checks existing API version hashes.
|
""" Checks existing API version hashes.
|
||||||
Resaves all API hashes if |force_update| is true. Otherwise, hash
|
Resaves all API hashes if |force_update| is true. Otherwise, hash
|
||||||
changes are considered an error.
|
changes are considered an error.
|
||||||
"""
|
"""
|
||||||
assert not (fast_check and force_update)
|
assert not (fast_check and force_update)
|
||||||
|
|
||||||
json_versions, json_untracked, initialized = \
|
json_versions, json_untracked, initialized = read_version_files(
|
||||||
read_version_files(api_versions_file, api_untracked_file, False)
|
api_versions_file, api_untracked_file, initialize=False)
|
||||||
assert not initialized
|
assert not initialized
|
||||||
|
|
||||||
versions = []
|
versions = []
|
||||||
len_versioned_existing = len_versioned_checked = len_versioned_failed = 0
|
len_versioned_existing = len_versioned_checked = len_versioned_failed = 0
|
||||||
len_untracked_existing = len_untracked_checked = len_untracked_failed = 0
|
len_untracked_existing = len_untracked_checked = len_untracked_failed = 0
|
||||||
|
|
||||||
if not json_versions is None:
|
if json_versions is not None:
|
||||||
keys = json_versions['hashes'].keys()
|
keys = json_versions['hashes'].keys()
|
||||||
len_versioned_existing = len(keys)
|
len_versioned_existing = len(keys)
|
||||||
if len_versioned_existing > 0:
|
if len_versioned_existing > 0:
|
||||||
if fast_check:
|
if fast_check:
|
||||||
# Only checking a subset of versions.
|
# Only checking a subset of versions.
|
||||||
for key in ('last', 'min'):
|
for key in ['last', 'min']:
|
||||||
if key in json_versions:
|
if key in json_versions:
|
||||||
version = json_versions[key]
|
version = json_versions[key]
|
||||||
assert version in json_versions['hashes'], version
|
assert version in json_versions['hashes'], version
|
||||||
@@ -307,14 +304,14 @@ def exec_check(cpp_header_dir, api_versions_file, api_untracked_file, debug_dir,
|
|||||||
versions.extend(keys)
|
versions.extend(keys)
|
||||||
len_versioned_checked = len_versioned_existing
|
len_versioned_checked = len_versioned_existing
|
||||||
|
|
||||||
if not json_untracked is None:
|
if json_untracked is not None:
|
||||||
keys = json_untracked['hashes'].keys()
|
keys = json_untracked['hashes'].keys()
|
||||||
len_untracked_existing = len(keys)
|
len_untracked_existing = len(keys)
|
||||||
if len_untracked_existing > 0 and not skip_untracked:
|
if len_untracked_existing > 0 and not skip_untracked:
|
||||||
versions.extend(keys)
|
versions.extend(keys)
|
||||||
len_untracked_checked = len_untracked_existing
|
len_untracked_checked = len_untracked_existing
|
||||||
|
|
||||||
if len(versions) == 0:
|
if not versions:
|
||||||
print('No hashes to check.')
|
print('No hashes to check.')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -328,8 +325,7 @@ def exec_check(cpp_header_dir, api_versions_file, api_untracked_file, debug_dir,
|
|||||||
else:
|
else:
|
||||||
stored_hashes = json_versions['hashes'][version]
|
stored_hashes = json_versions['hashes'][version]
|
||||||
label = version_label(version)
|
label = version_label(version)
|
||||||
computed_hashes = compute_api_hashes(cpp_header_dir, version, True,
|
computed_hashes = compute_api_hashes(version, hasher, next_allowed=True)
|
||||||
debug_dir, verbose)
|
|
||||||
if not bool(computed_hashes):
|
if not bool(computed_hashes):
|
||||||
sys.stderr.write('ERROR: Failed to process %s\n' % label)
|
sys.stderr.write('ERROR: Failed to process %s\n' % label)
|
||||||
return 1
|
return 1
|
||||||
@@ -362,8 +358,10 @@ def exec_check(cpp_header_dir, api_versions_file, api_untracked_file, debug_dir,
|
|||||||
print('WARNING: This change can break back/forward binary compatibility.')
|
print('WARNING: This change can break back/forward binary compatibility.')
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('ERROR: %d hashes checked and failed\n' % len_failed)
|
sys.stderr.write('ERROR: %d hashes checked and failed\n' % len_failed)
|
||||||
sys.stderr.write('\nFor debugging tips/tricks see\n' +
|
sys.stderr.write(
|
||||||
'https://github.com/chromiumembedded/cef/issues/3836#issuecomment-2587767028\n\n')
|
'\nFor debugging tips/tricks see\n' +
|
||||||
|
'https://github.com/chromiumembedded/cef/issues/3836#issuecomment-2587767028\n\n'
|
||||||
|
)
|
||||||
|
|
||||||
print('%d hashes checked and match (%d/%d versioned, %d/%d untracked).' %
|
print('%d hashes checked and match (%d/%d versioned, %d/%d untracked).' %
|
||||||
(len(versions) - len_failed,
|
(len(versions) - len_failed,
|
||||||
@@ -412,7 +410,7 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
|||||||
parser = CustomParser(description=desc, epilog=epilog)
|
parser = CustomParser(description=desc, epilog=epilog)
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'--debug-dir',
|
'--debug-dir',
|
||||||
dest='debugdir',
|
dest='debug_dir',
|
||||||
metavar='DIR',
|
metavar='DIR',
|
||||||
help='intermediate directory for easy debugging')
|
help='intermediate directory for easy debugging')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
@@ -472,7 +470,7 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
|||||||
parser.add_option(
|
parser.add_option(
|
||||||
'--force-update',
|
'--force-update',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
dest='forceupdate',
|
dest='force_update',
|
||||||
default=False,
|
default=False,
|
||||||
help='force update all API hashes (use with -c)')
|
help='force update all API hashes (use with -c)')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
@@ -496,7 +494,7 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
|||||||
parser.print_help(sys.stdout)
|
parser.print_help(sys.stdout)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
next_version = compute_next_api_verson(api_versions_file)
|
next_version = compute_next_api_version(api_versions_file)
|
||||||
if next_version is None:
|
if next_version is None:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -522,17 +520,13 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
|||||||
changed = translate(cef_dir, verbose=options.verbose) > 0
|
changed = translate(cef_dir, verbose=options.verbose) > 0
|
||||||
skip_untracked = False
|
skip_untracked = False
|
||||||
|
|
||||||
|
hasher = CefApiHasher(cpp_header_dir, options.debug_dir, options.verbose)
|
||||||
|
|
||||||
if options.update or will_apply_next or changed or not os.path.isfile(
|
if options.update or will_apply_next or changed or not os.path.isfile(
|
||||||
api_untracked_file):
|
api_untracked_file):
|
||||||
skip_untracked = True
|
skip_untracked = True
|
||||||
if exec_apply(
|
if exec_apply(api_versions_file, api_untracked_file, next_version,
|
||||||
cpp_header_dir,
|
options.apply, hasher) > 0:
|
||||||
api_versions_file,
|
|
||||||
api_untracked_file,
|
|
||||||
next_version,
|
|
||||||
options.debugdir,
|
|
||||||
apply_next=options.apply,
|
|
||||||
verbose=options.verbose) > 0:
|
|
||||||
# Apply failed.
|
# Apply failed.
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif not options.check:
|
elif not options.check:
|
||||||
@@ -540,12 +534,6 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
sys.exit(
|
sys.exit(
|
||||||
exec_check(
|
exec_check(api_versions_file, api_untracked_file, options.fastcheck and
|
||||||
cpp_header_dir,
|
not options.force_update, options.check and
|
||||||
api_versions_file,
|
options.force_update, skip_untracked, hasher))
|
||||||
api_untracked_file,
|
|
||||||
options.debugdir,
|
|
||||||
options.fastcheck and not options.forceupdate,
|
|
||||||
options.check and options.forceupdate,
|
|
||||||
skip_untracked,
|
|
||||||
verbose=options.verbose))
|
|
||||||
|
@@ -92,7 +92,7 @@ def read_version_files(api_versions_file,
|
|||||||
}
|
}
|
||||||
initialized = True
|
initialized = True
|
||||||
else:
|
else:
|
||||||
json_version = None
|
json_versions = None
|
||||||
else:
|
else:
|
||||||
assert 'hashes' in json_versions, api_versions_file
|
assert 'hashes' in json_versions, api_versions_file
|
||||||
assert 'last' in json_versions, api_versions_file
|
assert 'last' in json_versions, api_versions_file
|
||||||
|
Reference in New Issue
Block a user