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
|
||||
|
||||
{
|
||||
'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": {
|
||||
"13300": {
|
||||
"comment": "Added January 13, 2025.",
|
||||
"linux": "b622b5e8d42567bd96b6c530c3bf39b42d94c97a",
|
||||
"mac": "10daecda70220382f54f8b1fc3b2d1df7da3088c",
|
||||
"universal": "a5c9449c676e3d151ac2d141bd3907dcd1fec3d4",
|
||||
"windows": "854c5a8fc37bb040ad0ad8e4680f62b07ec217c0"
|
||||
"comment": "Added February 21, 2025.",
|
||||
"linux": "2508f3f0b0e5dfa191036fa6c04f8dcfa18c94b9",
|
||||
"mac": "80c0b59ba9dd783aa71fae0aa5f7dad64620e8c9",
|
||||
"windows": "45d39c3669ba75467e3e609f626c31506c0eae22"
|
||||
},
|
||||
"13301": {
|
||||
"comment": "Added January 13, 2025.",
|
||||
"linux": "0ec77d8bc98964aaf2c4ac037dbbe47f59863902",
|
||||
"mac": "65b51b1dfde1ab0af99d98e1e8b6aadf5bc28707",
|
||||
"universal": "e343550e4371b76f59813dac2742a9d3206cb98f",
|
||||
"windows": "34b14819172ed39721a3fe298cf73dec7b6e7df2"
|
||||
"comment": "Added February 21, 2025.",
|
||||
"linux": "aa073dd1c586812503ca293c718358460d8c2dd6",
|
||||
"mac": "fda40a5df44628cac50a589ff979c0746011591e",
|
||||
"windows": "7109702038d51512d35dd2ed77231f9100e38214"
|
||||
},
|
||||
"13302": {
|
||||
"comment": "Added January 13, 2025.",
|
||||
"linux": "e98affe8187daaa1ee02b01677208ff0a54af74c",
|
||||
"mac": "45a0649980f85c53a6156627f0af6368ccfc5554",
|
||||
"universal": "b8423655541f6f2a1a9b6f5252f03e59842dc31a",
|
||||
"windows": "b04c40f0d79e2ea6f6a4d508843b9eaafb102c1e"
|
||||
"comment": "Added February 21, 2025.",
|
||||
"linux": "d5597ebfa30081953425e897209a8387b9584205",
|
||||
"mac": "4aa24470ba3a4bd9c06bc0e4a201b896394a86b5",
|
||||
"windows": "18799961f4461a9cbae2aed89ac04b73ab7c37f3"
|
||||
},
|
||||
"13303": {
|
||||
"comment": "Added January 13, 2025.",
|
||||
"linux": "1b2584e9f06dc0cb59ccceee89857fc164d4db52",
|
||||
"mac": "82d74e5024ed80b43d49d7e83b0e8a3a42a0b319",
|
||||
"universal": "a0905ba86f2c4964857f6c9c0706ab3e1050a8cd",
|
||||
"windows": "bc115a66808672931cf676ce31d58ded946f680e"
|
||||
"comment": "Added February 21, 2025.",
|
||||
"linux": "f3a696ee30ce1e00490a58df017393c126c89709",
|
||||
"mac": "f2cdce2b9a4b635c28b5b92c42c35625a937380c",
|
||||
"windows": "20016fd6a9b87ef4c539cd1f42bf1ca09b6903ca"
|
||||
},
|
||||
"13304": {
|
||||
"comment": "Added January 13, 2025.",
|
||||
"linux": "199fe896c737a07dcf1506e0c86688363df7e8b6",
|
||||
"mac": "405810f1f8b146678867b6a91cbe8c4670febbbf",
|
||||
"universal": "be55f7cf1813ae098d4f68b2a2c9ca85784fc3ee",
|
||||
"windows": "73bb28a92f4be742e3fc80057a80797e3bf23063"
|
||||
"comment": "Added February 21, 2025.",
|
||||
"linux": "f1ababb4ff51ecbf77c481cee3721ef0eca9c8ca",
|
||||
"mac": "98964c37b8917d83da4b173e22905503d38ad08f",
|
||||
"windows": "19c014af0082aa901398e006381b6980e4f806e9"
|
||||
}
|
||||
},
|
||||
"last": "13304",
|
||||
|
@@ -271,6 +271,17 @@ macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
|
||||
)
|
||||
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)
|
||||
|
||||
|
||||
|
@@ -77,19 +77,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _CEF_AH_PASTE(a, b, c) a##_##b##_##c
|
||||
#define _CEF_AH_EVAL(a, b, c) _CEF_AH_PASTE(a, b, c)
|
||||
#define _CEF_AH_DECLARE(version, suffix) \
|
||||
_CEF_AH_EVAL(CEF_API_HASH, version, suffix)
|
||||
#define _CEF_AH_PASTE(a, b) a##_##b
|
||||
#define _CEF_AH_EVAL(a, b) _CEF_AH_PASTE(a, b)
|
||||
#define _CEF_AH_DECLARE(version) _CEF_AH_EVAL(CEF_API_HASH, version)
|
||||
|
||||
// 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
|
||||
// hash value will change when header files are modified in a way that may
|
||||
// cause binary incompatibility with other builds. The universal hash value
|
||||
// will change if any platform is affected whereas the platform hash values
|
||||
// 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)
|
||||
// cause binary incompatibility with other builds.
|
||||
#define CEF_API_HASH_PLATFORM _CEF_AH_DECLARE(CEF_API_VERSION)
|
||||
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
|
||||
@@ -132,7 +128,7 @@ extern "C" {
|
||||
/// parameter describes which hash value will be returned:
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
CEF_EXPORT const char* cef_api_hash(int version, int entry);
|
||||
|
@@ -31,8 +31,11 @@
|
||||
#define CEF_INCLUDE_CEF_BASE_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/base/cef_atomic_ref_count.h"
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include "include/base/cef_build.h"
|
||||
#endif
|
||||
|
||||
#include "include/base/cef_atomic_ref_count.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
|
||||
// Bring in common C++ type definitions used by CEF consumers.
|
||||
|
@@ -31,7 +31,10 @@
|
||||
#define CEF_INCLUDE_CEF_SANDBOX_MAC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include "include/base/cef_build.h"
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
|
||||
#if defined(OS_MAC)
|
||||
|
@@ -31,7 +31,9 @@
|
||||
#define CEF_INCLUDE_CEF_SANDBOX_WIN_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include "include/base/cef_build.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
|
@@ -31,7 +31,9 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_APP_WIN_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include "include/base/cef_build.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
|
@@ -32,7 +32,9 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include "include/base/cef_build.h"
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_MSVC)
|
||||
|
||||
|
@@ -31,12 +31,14 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#elif defined(OS_POSIX)
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
|
||||
|
@@ -35,8 +35,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
|
||||
|
@@ -993,9 +993,11 @@ typedef enum {
|
||||
// No error.
|
||||
ERR_NONE = 0,
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#define NET_ERROR(label, value) ERR_##label = value,
|
||||
#include "include/base/internal/cef_net_error_list.h"
|
||||
#undef NET_ERROR
|
||||
#endif
|
||||
|
||||
} cef_errorcode_t;
|
||||
|
||||
|
@@ -31,15 +31,12 @@
|
||||
#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)
|
||||
|
||||
#if defined(CEF_X11)
|
||||
typedef union _XEvent XEvent;
|
||||
typedef struct _XDisplay XDisplay;
|
||||
#endif
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
#include "include/internal/cef_string.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_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 kNullEventHandle NULL
|
||||
#define kNullWindowHandle 0
|
||||
@@ -66,6 +52,20 @@ typedef struct _XDisplay XDisplay;
|
||||
extern "C" {
|
||||
#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
|
||||
/// 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_
|
||||
#pragma once
|
||||
|
||||
#if !defined(GENERATING_CEF_API_HASH)
|
||||
#include "include/base/cef_build.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MAC)
|
||||
#include "include/internal/cef_string.h"
|
||||
@@ -40,16 +42,6 @@
|
||||
#include "include/internal/cef_types_osr.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 kNullEventHandle NULL
|
||||
#define kNullWindowHandle NULL
|
||||
@@ -78,6 +70,16 @@
|
||||
extern "C" {
|
||||
#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.
|
||||
///
|
||||
|
@@ -31,8 +31,15 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Structure containing shared texture common metadata.
|
||||
/// 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;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
|
||||
|
@@ -31,10 +31,15 @@
|
||||
#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/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_color.h"
|
||||
@@ -42,12 +47,6 @@
|
||||
#include "include/internal/cef_types_osr.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 kNullEventHandle NULL
|
||||
#define kNullWindowHandle NULL
|
||||
@@ -56,6 +55,12 @@
|
||||
extern "C" {
|
||||
#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.
|
||||
///
|
||||
|
@@ -48,23 +48,23 @@ CEF_EXPORT int cef_version_info(int entry) {
|
||||
#include "cef/libcef_dll/cef_api_versions.inc"
|
||||
|
||||
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.
|
||||
if (!hash) {
|
||||
for (size_t i = 0; i < kApiVersionHashesSize; ++i) {
|
||||
if (version == kApiVersionHashes[i].version) {
|
||||
hash = &kApiVersionHashes[i];
|
||||
if (!current_version_hash) {
|
||||
for (const auto& version_hash : kApiVersionHashes) {
|
||||
if (version == version_hash.version) {
|
||||
current_version_hash = &version_hash;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hash) {
|
||||
if (current_version_hash) {
|
||||
g_version = version;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hash) {
|
||||
if (!current_version_hash) {
|
||||
LOG(ERROR) << "Request for unsupported CEF API version " << version;
|
||||
return nullptr;
|
||||
}
|
||||
@@ -76,9 +76,8 @@ CEF_EXPORT const char* cef_api_hash(int version, int entry) {
|
||||
|
||||
switch (entry) {
|
||||
case 0:
|
||||
return hash->platform;
|
||||
case 1:
|
||||
return hash->universal;
|
||||
return current_version_hash->hash;
|
||||
case 2:
|
||||
return CEF_COMMIT_HASH;
|
||||
default:
|
||||
@@ -97,9 +96,8 @@ CEF_EXPORT int cef_id_for_pack_resource_name(const char* name) {
|
||||
|
||||
// Initialize on the first call.
|
||||
if (string_to_id_map->empty()) {
|
||||
for (size_t i = 0; i < kIdNamesPackResourcesSize; ++i) {
|
||||
(*string_to_id_map)[kIdNamesPackResources[i].name] =
|
||||
kIdNamesPackResources[i].id;
|
||||
for (const auto& pack_resource : kIdNamesPackResources) {
|
||||
(*string_to_id_map)[pack_resource.name] = pack_resource.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,9 +117,8 @@ CEF_EXPORT int cef_id_for_pack_string_name(const char* name) {
|
||||
|
||||
// Initialize on the first call.
|
||||
if (string_to_id_map->empty()) {
|
||||
for (size_t i = 0; i < kIdNamesPackStringsSize; ++i) {
|
||||
(*string_to_id_map)[kIdNamesPackStrings[i].name] =
|
||||
kIdNamesPackStrings[i].id;
|
||||
for (const auto& pack_string : kIdNamesPackStrings) {
|
||||
(*string_to_id_map)[pack_string.name] = pack_string.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,9 +138,8 @@ CEF_EXPORT int cef_id_for_command_id_name(const char* name) {
|
||||
|
||||
// Initialize on the first call.
|
||||
if (string_to_id_map->empty()) {
|
||||
for (size_t i = 0; i < kIdNamesCommandIdsSize; ++i) {
|
||||
(*string_to_id_map)[kIdNamesCommandIds[i].name] =
|
||||
kIdNamesCommandIds[i].id;
|
||||
for (const auto& command : kIdNamesCommandIds) {
|
||||
(*string_to_id_map)[command.name] = command.id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git base/BUILD.gn base/BUILD.gn
|
||||
index 5d8029ab4b82c..3fd3b54866cf7 100644
|
||||
index e0c6828f0cd7f..40e3d558dfda3 100644
|
||||
--- base/BUILD.gn
|
||||
+++ base/BUILD.gn
|
||||
@@ -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
|
||||
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
|
||||
@@ -8243,10 +8243,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
|
||||
@@ -8250,10 +8250,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
|
||||
bool use_opaque_origin =
|
||||
(sandbox_flags & network::mojom::WebSandboxFlags::kOrigin) ==
|
||||
network::mojom::WebSandboxFlags::kOrigin;
|
||||
@@ -47,7 +47,7 @@ index 5a95c24b9acc5..b8e93ae3b5881 100644
|
||||
}
|
||||
|
||||
return origin_and_debug_info;
|
||||
@@ -8354,11 +8366,20 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||
@@ -8361,11 +8373,20 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||
DetermineInitiatorRelationship(initiator_rfh,
|
||||
frame_tree_node_->current_frame_host()));
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
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
|
||||
@@ -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));
|
||||
params.source_contents = source_contents;
|
||||
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
|
||||
// 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
|
||||
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
|
||||
@@ -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
|
||||
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
|
||||
@@ -1198,8 +1198,8 @@ int ProfileMenuViewBase::GetMaxHeight() const {
|
||||
@@ -1215,8 +1215,8 @@ int ProfileMenuViewBase::GetMaxHeight() const {
|
||||
->GetDisplayNearestPoint(anchor_rect.CenterPoint())
|
||||
.work_area();
|
||||
int available_space = screen_space.bottom() - anchor_rect.bottom();
|
||||
|
@@ -56,10 +56,10 @@ index f1030a744809c..c222a209949e6 100644
|
||||
return nullptr;
|
||||
}
|
||||
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
|
||||
@@ -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.
|
||||
// Prompts should remain open and functional across tab switches.
|
||||
@@ -68,7 +68,7 @@ index 7ba8c01db7e93..0888ecebf8d6f 100644
|
||||
RejectPointerLockOrUnlockIfNecessary(
|
||||
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) {
|
||||
if ((base::FeatureList::IsEnabled(
|
||||
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
|
||||
@@ -844,6 +844,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
@@ -847,6 +847,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
|
||||
void ProgressFlingIfNeeded(base::TimeTicks current_time);
|
||||
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
|
||||
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
|
||||
@@ -9265,6 +9265,16 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -9266,6 +9266,16 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ index 6aef73a782904..226fdb101ac15 100644
|
||||
// Otherwise, consume user activation before we proceed. In particular, it is
|
||||
// important to do this before we return from the |opener_suppressed| case
|
||||
// below.
|
||||
@@ -11612,6 +11622,7 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||
@@ -11613,6 +11623,7 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||
auto browser_calc_origin_to_commit =
|
||||
navigation_request->GetOriginToCommitWithDebugInfo();
|
||||
if (!process_lock.is_error_page() && !is_mhtml_subframe &&
|
||||
|
@@ -403,10 +403,10 @@ index fc1d5fccc3845..c065cafcd537c 100644
|
||||
|
||||
explicit MenuHost(SubmenuView* submenu);
|
||||
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
|
||||
@@ -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_height(spilling_rect.height() + corner_radius_);
|
||||
canvas->DrawRoundRect(spilling_rect, corner_radius_, flags);
|
||||
@@ -422,7 +422,7 @@ index 9e948231f2a57..f88c0a1cf2660 100644
|
||||
} else if (paint_as_selected) {
|
||||
gfx::Rect item_bounds = GetLocalBounds();
|
||||
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 {
|
||||
|
@@ -317,4 +317,9 @@ if(OS_WINDOWS)
|
||||
# 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_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()
|
||||
|
@@ -30,6 +30,7 @@ const char kNameValueSet[] = "preferences_set";
|
||||
const char kNameValueState[] = "preferences_state";
|
||||
|
||||
// Used with "preferences_get" messages.
|
||||
const char kGlobalPrefsKey[] = "global_prefs";
|
||||
const char kIncludeDefaultsKey[] = "include_defaults";
|
||||
|
||||
// Used with "preferences_set" messages.
|
||||
@@ -73,30 +74,34 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
if (message_name == kNameValueGet) {
|
||||
// JavaScript is requesting a JSON representation of the preferences tree.
|
||||
|
||||
// Verify the "include_defaults" key.
|
||||
if (!VerifyKey(request_dict, kIncludeDefaultsKey, VTYPE_BOOL, callback)) {
|
||||
// Verify the "global_prefs" and "include_defaults" keys.
|
||||
if (!VerifyKey(request_dict, kGlobalPrefsKey, VTYPE_BOOL, callback) ||
|
||||
!VerifyKey(request_dict, kIncludeDefaultsKey, VTYPE_BOOL, callback)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool global_prefs = request_dict->GetBool(kGlobalPrefsKey);
|
||||
const bool include_defaults = request_dict->GetBool(kIncludeDefaultsKey);
|
||||
|
||||
OnPreferencesGet(browser, include_defaults, callback);
|
||||
OnPreferencesGet(browser, global_prefs, include_defaults, callback);
|
||||
|
||||
return true;
|
||||
} else if (message_name == kNameValueSet) {
|
||||
// JavaScript is requesting that preferences be updated to match the
|
||||
// specified JSON representation.
|
||||
|
||||
// Verify the "preferences" key.
|
||||
if (!VerifyKey(request_dict, kPreferencesKey, VTYPE_DICTIONARY,
|
||||
// Verify the "global_prefs" and "preferences" keys.
|
||||
if (!VerifyKey(request_dict, kGlobalPrefsKey, VTYPE_BOOL, callback) ||
|
||||
!VerifyKey(request_dict, kPreferencesKey, VTYPE_DICTIONARY,
|
||||
callback)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool global_prefs = request_dict->GetBool(kGlobalPrefsKey);
|
||||
CefRefPtr<CefDictionaryValue> preferences =
|
||||
request_dict->GetDictionary(kPreferencesKey);
|
||||
|
||||
OnPreferencesSet(browser, preferences, callback);
|
||||
OnPreferencesSet(browser, global_prefs, preferences, callback);
|
||||
|
||||
return true;
|
||||
} else if (message_name == kNameValueState) {
|
||||
@@ -113,14 +118,19 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
private:
|
||||
// Execute |callback| with the preferences dictionary as a JSON string.
|
||||
static void OnPreferencesGet(CefRefPtr<CefBrowser> browser,
|
||||
bool global_prefs,
|
||||
bool include_defaults,
|
||||
CefRefPtr<Callback> callback) {
|
||||
CefRefPtr<CefRequestContext> context =
|
||||
browser->GetHost()->GetRequestContext();
|
||||
CefRefPtr<CefPreferenceManager> pref_manager;
|
||||
if (global_prefs) {
|
||||
pref_manager = CefPreferenceManager::GetGlobalPreferenceManager();
|
||||
} else {
|
||||
pref_manager = browser->GetHost()->GetRequestContext();
|
||||
}
|
||||
|
||||
// Retrieve all preference values.
|
||||
CefRefPtr<CefDictionaryValue> prefs =
|
||||
context->GetAllPreferences(include_defaults);
|
||||
pref_manager->GetAllPreferences(include_defaults);
|
||||
|
||||
// Serialize the preferences to JSON and return to the JavaScript caller.
|
||||
callback->Success(GetJSON(prefs));
|
||||
@@ -129,10 +139,15 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
// Set preferences based on the contents of |preferences|. Execute |callback|
|
||||
// with a descriptive result message.
|
||||
static void OnPreferencesSet(CefRefPtr<CefBrowser> browser,
|
||||
bool global_prefs,
|
||||
CefRefPtr<CefDictionaryValue> preferences,
|
||||
CefRefPtr<Callback> callback) {
|
||||
CefRefPtr<CefRequestContext> context =
|
||||
browser->GetHost()->GetRequestContext();
|
||||
CefRefPtr<CefPreferenceManager> pref_manager;
|
||||
if (global_prefs) {
|
||||
pref_manager = CefPreferenceManager::GetGlobalPreferenceManager();
|
||||
} else {
|
||||
pref_manager = browser->GetHost()->GetRequestContext();
|
||||
}
|
||||
|
||||
CefRefPtr<CefValue> value = CefValue::Create();
|
||||
value->SetDictionary(preferences);
|
||||
@@ -142,7 +157,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
|
||||
// Apply preferences. This may result in errors.
|
||||
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.
|
||||
std::string message;
|
||||
@@ -245,14 +260,14 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
// Apply preferences. Returns true on success. Returns false and sets |error|
|
||||
// to a descriptive error string on failure. |changed_names| is the list of
|
||||
// preferences that were successfully changed.
|
||||
static bool ApplyPrefs(CefRefPtr<CefRequestContext> context,
|
||||
static bool ApplyPrefs(CefRefPtr<CefPreferenceManager> pref_manager,
|
||||
const std::string& name,
|
||||
CefRefPtr<CefValue> value,
|
||||
std::string& error,
|
||||
NameVector& changed_names) {
|
||||
if (!name.empty() && context->HasPreference(name)) {
|
||||
if (!name.empty() && pref_manager->HasPreference(name)) {
|
||||
// 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) {
|
||||
@@ -265,7 +280,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
for (const auto& i : keys) {
|
||||
const std::string& key = i;
|
||||
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)) {
|
||||
return false;
|
||||
}
|
||||
@@ -282,12 +297,12 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
// 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
|
||||
// descriptive error string on failure.
|
||||
static bool SetPref(CefRefPtr<CefRequestContext> context,
|
||||
static bool SetPref(CefRefPtr<CefPreferenceManager> pref_manager,
|
||||
const std::string& name,
|
||||
CefRefPtr<CefValue> value,
|
||||
std::string& error,
|
||||
NameVector& changed_names) {
|
||||
CefRefPtr<CefValue> existing_value = context->GetPreference(name);
|
||||
CefRefPtr<CefValue> existing_value = pref_manager->GetPreference(name);
|
||||
DCHECK(existing_value);
|
||||
|
||||
if (value->GetType() == VTYPE_STRING &&
|
||||
@@ -322,7 +337,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
|
||||
|
||||
// Attempt to set the preference.
|
||||
CefString error_str;
|
||||
if (!context->SetPreference(name, value, error_str)) {
|
||||
if (!pref_manager->SetPreference(name, value, error_str)) {
|
||||
error = error_str.ToString() + ": " + name;
|
||||
return false;
|
||||
}
|
||||
|
@@ -96,7 +96,8 @@
|
||||
<tr>
|
||||
<td align="left">
|
||||
<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 align="right">
|
||||
<input type="button" value="Apply Changes" onClick="applyEditorChanges()"/>
|
||||
@@ -161,10 +162,11 @@
|
||||
|
||||
// Get the preferences and execute |onSuccessCallback| with the resulting
|
||||
// JSON object.
|
||||
function getPreferences(include_defaults, onSuccessCallback) {
|
||||
function getPreferences(global_prefs, include_defaults, onSuccessCallback) {
|
||||
// Create the request object.
|
||||
var request = {};
|
||||
request.name = "preferences_get";
|
||||
request.global_prefs = global_prefs;
|
||||
request.include_defaults = include_defaults;
|
||||
|
||||
// Send the request to C++.
|
||||
@@ -177,10 +179,11 @@
|
||||
}
|
||||
|
||||
// Set the preferences.
|
||||
function setPreferences(preferences) {
|
||||
function setPreferences(global_prefs, preferences) {
|
||||
// Create the request object.
|
||||
var request = {};
|
||||
request.name = "preferences_set";
|
||||
request.global_prefs = global_prefs;
|
||||
request.preferences = preferences;
|
||||
|
||||
// Send the request to C++.
|
||||
@@ -214,8 +217,9 @@
|
||||
|
||||
// Refresh the editor view contents.
|
||||
function refreshEditor() {
|
||||
global_prefs = document.getElementById("global_prefs").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.
|
||||
editor.set(response);
|
||||
});
|
||||
@@ -223,12 +227,13 @@
|
||||
|
||||
// Apply changes from the editor view.
|
||||
function applyEditorChanges() {
|
||||
setPreferences(editor.get());
|
||||
global_prefs = document.getElementById("global_prefs").checked;
|
||||
setPreferences(global_prefs, editor.get());
|
||||
}
|
||||
|
||||
// Refresh the simple view contents.
|
||||
function refreshSimple() {
|
||||
getPreferences(true, function(response) {
|
||||
getPreferences(false, true, function(response) {
|
||||
// Spellcheck settings.
|
||||
if (preferences_state.spellcheck_disabled) {
|
||||
// Cannot enable spell checking when disabled via the command-line.
|
||||
@@ -318,7 +323,7 @@
|
||||
}
|
||||
|
||||
if (has_preferences)
|
||||
setPreferences(preferences);
|
||||
setPreferences(false, preferences);
|
||||
}
|
||||
|
||||
// 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_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}")
|
||||
|
||||
if(USE_SANDBOX)
|
||||
# Set LPAC ACLs required for Windows sandbox support.
|
||||
SET_LPAC_ACLS("${CEF_TARGET}")
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -260,4 +260,9 @@ if(OS_WINDOWS)
|
||||
"resources/"
|
||||
)
|
||||
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()
|
||||
|
@@ -19,6 +19,6 @@ TEST(VersionTest, VersionInfo) {
|
||||
|
||||
TEST(VersionTest, ApiHash) {
|
||||
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));
|
||||
}
|
||||
|
@@ -4,343 +4,381 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from typing import Dict, List
|
||||
from clang_util import clang_eval
|
||||
from file_util import *
|
||||
import hashlib
|
||||
import itertools
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import sys
|
||||
import time
|
||||
from version_util import EXP_VERSION
|
||||
|
||||
# Determines string type for python 2 and python 3.
|
||||
if sys.version_info[0] == 3:
|
||||
string_type = str
|
||||
else:
|
||||
string_type = basestring
|
||||
API_TOKEN = '#if CEF_API'
|
||||
OS_TOKEN = '#if defined(OS_'
|
||||
INCLUDE_START_MARKER = 'int begin_includes_tag;\n'
|
||||
INCLUDE_DIRS = [
|
||||
'.', # 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):
|
||||
# Add a tag so we know where the header-specific output begins.
|
||||
tag = 'int begin_includes_tag;\n'
|
||||
def _prepare_content(content: str) -> str:
|
||||
"""
|
||||
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" {'
|
||||
pos = content.find(find)
|
||||
assert pos > 0, filename
|
||||
content = content[0:pos] + tag + content[pos:]
|
||||
assert pos > 0, f'Cannot find "{find}" in {content}'
|
||||
content = content[0:pos] + INCLUDE_START_MARKER + content[pos:]
|
||||
|
||||
defines = [
|
||||
# Makes sure CEF_EXPORT is defined.
|
||||
'USING_CEF_SHARED',
|
||||
content = DEFINE_PATTERN.sub('//DEFINE_PLACEHOLDER//', content)
|
||||
return SYSTEM_INCLUDES_PATTERN.sub('//INCLUDE_PLACEHOLDER//', content)
|
||||
|
||||
# Avoid include of generated headers.
|
||||
'GENERATING_CEF_API_HASH',
|
||||
]
|
||||
|
||||
if filename.find('test/') >= 0:
|
||||
# Avoids errors parsing test includes.
|
||||
defines.append('UNIT_TEST')
|
||||
|
||||
# Not the experimental version.
|
||||
api_version = int(api_version)
|
||||
if api_version != EXP_VERSION:
|
||||
# Specify the exact version.
|
||||
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):]
|
||||
def _process_result(result: str) -> str:
|
||||
"""
|
||||
Remove the non header-specific output and undo substitutions from cef_export.h
|
||||
"""
|
||||
pos = result.find(INCLUDE_START_MARKER)
|
||||
if pos == -1:
|
||||
return result
|
||||
result = result[pos + len(INCLUDE_START_MARKER):]
|
||||
|
||||
replacements = [
|
||||
# Undo substitutions from cef_export.h
|
||||
['__declspec(dllimport)', 'CEF_EXPORT'],
|
||||
['__attribute__((visibility("default")))', 'CEF_EXPORT'],
|
||||
['__stdcall', ''],
|
||||
]
|
||||
|
||||
for find, replace in replacements:
|
||||
result = result.replace(find, replace)
|
||||
|
||||
return result
|
||||
# Must always start with newline as required by _parse_objects()
|
||||
return '\n' + result
|
||||
|
||||
|
||||
class cef_api_hash:
|
||||
def _get_defines(filename: str, added_defines: list) -> List[str]:
|
||||
defines = [
|
||||
# Makes sure CEF_EXPORT is defined.
|
||||
'USING_CEF_SHARED',
|
||||
# Avoid include of generated headers.
|
||||
'GENERATING_CEF_API_HASH',
|
||||
]
|
||||
|
||||
# Avoids errors parsing test includes.
|
||||
if filename.find('test/') >= 0:
|
||||
defines.append('UNIT_TEST')
|
||||
|
||||
defines.extend(added_defines)
|
||||
return defines
|
||||
|
||||
|
||||
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.
|
||||
cef_paths = eval_file(os.path.join(cef_dir, 'cef_paths.gypi'))
|
||||
cef_paths = cef_paths['variables']
|
||||
# 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 = cef_paths2['variables']
|
||||
|
||||
# List of all C API include/ files.
|
||||
paths = cef_paths2['includes_capi'] + cef_paths2['includes_common_capi'] + \
|
||||
cef_paths2['includes_linux_capi'] + cef_paths2['includes_mac_capi'] + \
|
||||
cef_paths2['includes_win_capi'] + cef_paths['autogen_capi_includes']
|
||||
|
||||
return [
|
||||
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, headerdir, verbose=False):
|
||||
if headerdir is None or len(headerdir) == 0:
|
||||
raise AssertionError("headerdir is not specified")
|
||||
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.__headerdir = headerdir
|
||||
self.__verbose = verbose
|
||||
|
||||
self.platforms = ["windows", "mac", "linux"]
|
||||
|
||||
cef_dir = os.path.abspath(os.path.join(self.__headerdir, os.pardir))
|
||||
|
||||
# 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 = cef_paths['variables']
|
||||
|
||||
# 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 = 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.
|
||||
paths = cef_paths2['includes_capi'] + cef_paths2['includes_common_capi'] + \
|
||||
cef_paths2['includes_linux_capi'] + cef_paths2['includes_mac_capi'] + \
|
||||
cef_paths2['includes_win_capi'] + cef_paths['autogen_capi_includes']
|
||||
self.filenames = self.__get_filenames(cef_dir, paths, excluded_files)
|
||||
|
||||
self.filecontents = {}
|
||||
self.filecontentobjs = {}
|
||||
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().
|
||||
for filename in self.filenames:
|
||||
if self.__verbose:
|
||||
print("Processing " + filename + "...")
|
||||
self.print(f'Processing {filename} ...')
|
||||
|
||||
assert not filename in self.filecontents, filename
|
||||
assert not filename in self.filecontentobjs, filename
|
||||
if filename in self.versioned_contents \
|
||||
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
|
||||
|
||||
# Parse cef_string.h happens in special case: grab only defined CEF_STRING_TYPE_xxx declaration
|
||||
if filename == "internal/cef_string.h":
|
||||
content_objects = self.__parse_string_type(content)
|
||||
elif content.find('#if CEF_API') >= 0:
|
||||
# Needs to be passed to clang with version-specific defines.
|
||||
self.filecontents[filename] = content
|
||||
is_platform_specific = OS_TOKEN in content
|
||||
is_version_specific = API_TOKEN in content
|
||||
|
||||
# Special case for parsing cef_string.h:
|
||||
# Only extract declarations of the form #define CEF_STRING_TYPE_xxx
|
||||
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:
|
||||
content_objects = self.__parse_objects(content)
|
||||
content_objects = _parse_objects(filename, content, 'universal')
|
||||
|
||||
if not content_objects is None:
|
||||
self.__prepare_objects(filename, content_objects)
|
||||
self.filecontentobjs[filename] = content_objects
|
||||
if content_objects is not None:
|
||||
self.file_content_objs[filename] = content_objects
|
||||
|
||||
def calculate(self, api_version, debug_dir=None, added_defines=None):
|
||||
debug_enabled = not (debug_dir is None) and len(debug_dir) > 0
|
||||
def calculate(self, api_version: str, added_defines: list) -> Dict[str, str]:
|
||||
""" 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 = []
|
||||
for filename in self.filenames:
|
||||
if self.__verbose:
|
||||
print("Processing " + filename + "...")
|
||||
self.print(f'Processing {filename}...')
|
||||
|
||||
content = self.filecontents.get(filename, None)
|
||||
if not content is None:
|
||||
assert content.find('#if CEF_API') >= 0, filename
|
||||
content = _run_clang_eval(filename, content, api_version, added_defines,
|
||||
self.__verbose)
|
||||
if content is None:
|
||||
sys.stderr.write(
|
||||
'ERROR: Failed to compute API hash for %s\n' % filename)
|
||||
return False
|
||||
if debug_enabled:
|
||||
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)
|
||||
if filename in self.versioned_contents:
|
||||
content = self.versioned_contents.get(filename, None)
|
||||
content_objects = parse_versioned_content(filename, content,
|
||||
api_version, added_defines,
|
||||
debug_dir, self.verbose)
|
||||
elif filename in self.platformed_contents:
|
||||
content = self.platformed_contents.get(filename, None)
|
||||
content_objects = parse_platformed_content(filename, content, debug_dir,
|
||||
self.verbose, api_version,
|
||||
added_defines)
|
||||
else:
|
||||
content_objects = self.filecontentobjs.get(filename, None)
|
||||
content_objects = self.file_content_objs.get(filename, None)
|
||||
|
||||
assert not content_objects is None, filename
|
||||
objects.extend(content_objects)
|
||||
# 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 will be sorted including filename, to make stable universal hashes
|
||||
objects = sorted(objects, key=lambda o: o["name"] + "@" + o["filename"])
|
||||
# objects will be sorted including filename to make stable hashes
|
||||
objects = sorted(objects, key=lambda o: f"{o['name']}@{o['filename']}")
|
||||
|
||||
if debug_enabled:
|
||||
namelen = max([len(o["name"]) for o in 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)
|
||||
if debug_dir:
|
||||
_save_objects_to_file(debug_dir, objects)
|
||||
|
||||
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):
|
||||
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 hashes
|
||||
|
||||
return revisions
|
||||
|
||||
def __parse_objects(self, content):
|
||||
""" 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)
|
||||
def print(self, msg):
|
||||
if self.verbose:
|
||||
print(msg)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if __name__ == '__main__':
|
||||
from optparse import OptionParser
|
||||
import time
|
||||
|
||||
disc = """
|
||||
This utility calculates CEF API hash.
|
||||
"""
|
||||
|
||||
parser = OptionParser(description=disc)
|
||||
parser = OptionParser(description='This utility calculates CEF API hash')
|
||||
parser.add_option(
|
||||
'--cpp-header-dir',
|
||||
dest='cppheaderdir',
|
||||
dest='cpp_header_dir',
|
||||
metavar='DIR',
|
||||
help='input directory for C++ header files [required]')
|
||||
parser.add_option(
|
||||
'--debug-dir',
|
||||
dest='debugdir',
|
||||
dest='debug_dir',
|
||||
metavar='DIR',
|
||||
help='intermediate directory for easy debugging')
|
||||
parser.add_option(
|
||||
@@ -352,28 +390,16 @@ if __name__ == "__main__":
|
||||
help='output detailed status information')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# the cppheader option is required
|
||||
if options.cppheaderdir is None:
|
||||
# the cpp_header_dir option is required
|
||||
if options.cpp_header_dir is None:
|
||||
parser.print_help(sys.stdout)
|
||||
sys.exit()
|
||||
|
||||
# calculate
|
||||
c_start_time = time.time()
|
||||
calc = CefApiHasher(options.cpp_header_dir, options.debug_dir,
|
||||
options.verbose)
|
||||
revisions = calc.calculate(EXP_VERSION, [])
|
||||
|
||||
calc = cef_api_hash(options.cppheaderdir, options.debugdir, options.verbose)
|
||||
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()):
|
||||
print(format("\"" + k + "\"", ">12s") + ": \"" + revisions[k] + "\"")
|
||||
print("}")
|
||||
|
||||
# print
|
||||
# print 'Completed in: ' + str(c_completed_in)
|
||||
# print
|
||||
|
||||
# print "Press any key to continue...";
|
||||
# sys.stdin.readline();
|
||||
print('{')
|
||||
for k in sorted(revisions.keys()):
|
||||
print(format('"' + k + '"', '>12s') + ': "' + revisions[k] + '"')
|
||||
print('}')
|
||||
|
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.
|
||||
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():
|
||||
versions = [x for x in versions if x < self.get_version_removed()]
|
||||
|
||||
assert len(versions) > 0, self.get_name()
|
||||
|
||||
self.allversions = sorted(versions)
|
||||
return self.allversions
|
||||
|
||||
|
@@ -161,7 +161,7 @@ class VersionFormatter:
|
||||
# - "X" is the Chromium major version (e.g. 74).
|
||||
# - "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
|
||||
# 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).
|
||||
# - "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
|
||||
|
@@ -27,7 +27,7 @@ else:
|
||||
def clang_format(file_name, file_contents):
|
||||
# -assume-filename is necessary to find the .clang-format file and determine
|
||||
# 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'))
|
||||
if result['err'] != '':
|
||||
sys.stderr.write("clang-format error: %s\n" % result['err'])
|
||||
@@ -48,32 +48,28 @@ def clang_format_inplace(file_name):
|
||||
return True
|
||||
|
||||
|
||||
def clang_eval(file_name,
|
||||
file_contents,
|
||||
defines=[],
|
||||
includes=[],
|
||||
as_cpp=True,
|
||||
verbose=False):
|
||||
lang = 'c++' if as_cpp else 'c'
|
||||
def clang_eval(file_name, file_contents, defines, includes, verbose):
|
||||
lang = 'c'
|
||||
if file_name.lower().endswith('.h'):
|
||||
lang += '-header'
|
||||
# The -P option removes unnecessary line markers and whitespace.
|
||||
format = '/EP' if sys.platform == 'win32' else '-E -P'
|
||||
|
||||
cmd = "%s -x %s %s %s %s -" % (clang_exe, lang, format,
|
||||
' '.join(['-D' + v for v in defines]),
|
||||
' '.join(['-I' + v for v in includes]))
|
||||
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'))
|
||||
if result['err'] != '':
|
||||
err = result['err'].replace('<stdin>', file_name)
|
||||
sys.stderr.write("clang error: %s\n" % err)
|
||||
if result['err'] != '' or result['ret'] != 0:
|
||||
error = result['err'].replace('<stdin>', file_name)
|
||||
return_code = result['ret']
|
||||
sys.stderr.write(f'clang {return_code=} {error=}\n')
|
||||
return None
|
||||
if result['out'] != '':
|
||||
output = result['out']
|
||||
if sys.platform == 'win32':
|
||||
# Convert to Unix line endings.
|
||||
output = output.replace("\r", "")
|
||||
return output
|
||||
return None
|
||||
|
||||
output = result['out']
|
||||
if output and sys.platform == 'win32':
|
||||
# Convert to Unix line endings.
|
||||
output = output.replace("\r", "")
|
||||
return output
|
||||
|
@@ -13,29 +13,25 @@ def exec_cmd(cmd, path, input_string=None):
|
||||
err = ''
|
||||
ret = -1
|
||||
parts = cmd.split()
|
||||
try:
|
||||
if input_string is None:
|
||||
process = Popen(
|
||||
parts,
|
||||
cwd=path,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate()
|
||||
ret = process.returncode
|
||||
else:
|
||||
process = Popen(
|
||||
parts,
|
||||
cwd=path,
|
||||
stdin=PIPE,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate(input=input_string)
|
||||
ret = process.returncode
|
||||
except IOError as e:
|
||||
(errno, strerror) = e.args
|
||||
raise
|
||||
except:
|
||||
raise
|
||||
|
||||
if input_string is None:
|
||||
process = Popen(
|
||||
parts,
|
||||
cwd=path,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate()
|
||||
ret = process.returncode
|
||||
else:
|
||||
process = Popen(
|
||||
parts,
|
||||
cwd=path,
|
||||
stdin=PIPE,
|
||||
stdout=PIPE,
|
||||
stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate(input=input_string)
|
||||
ret = process.returncode
|
||||
|
||||
return {'out': out.decode('utf-8'), 'err': err.decode('utf-8'), 'ret': ret}
|
||||
|
@@ -8,8 +8,8 @@ import os
|
||||
import sys
|
||||
|
||||
if sys.platform == 'win32':
|
||||
# Force use of the git version bundled with depot_tools.
|
||||
git_exe = 'git.bat'
|
||||
# Force use of the system installed Git version.
|
||||
git_exe = 'git.exe'
|
||||
else:
|
||||
git_exe = 'git'
|
||||
|
||||
@@ -30,6 +30,15 @@ def exec_git_cmd(args, path='.'):
|
||||
""" Executes a git command with the specified |args|. """
|
||||
cmd = "%s %s" % (git_exe, args)
|
||||
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'] != '':
|
||||
out = result['out'].strip()
|
||||
if sys.platform == 'win32':
|
||||
|
@@ -11,8 +11,8 @@ import sys
|
||||
|
||||
|
||||
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
|
||||
@@ -27,42 +27,40 @@ def make_api_versions_header(json):
|
||||
"""
|
||||
|
||||
for version, hashes in json['hashes'].items():
|
||||
version_part = """
|
||||
version_part = f"""
|
||||
// $COMMENT$
|
||||
#define CEF_API_VERSION_$VER$ $VER$
|
||||
#define CEF_API_HASH_$VER$_UNIVERSAL "$UNIVERSAL$"
|
||||
#define CEF_API_VERSION_{version} {version}
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_$VER$_PLATFORM "$WINDOWS$"
|
||||
#define CEF_API_HASH_{version} "$WINDOWS$"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_$VER$_PLATFORM "$MAC$"
|
||||
#define CEF_API_HASH_{version} "$MAC$"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_$VER$_PLATFORM "$LINUX$"
|
||||
#define CEF_API_HASH_{version} "$LINUX$"
|
||||
#endif
|
||||
""".replace('$VER$', version)
|
||||
"""
|
||||
|
||||
# Substitute hash values for placeholders.
|
||||
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 += \
|
||||
"""
|
||||
result += f"""
|
||||
// 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.
|
||||
#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_
|
||||
""".replace('$LAST$', json['last']).replace('$MIN$', json['min'])
|
||||
"""
|
||||
|
||||
return result
|
||||
|
||||
|
||||
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.
|
||||
@@ -72,56 +70,53 @@ namespace {
|
||||
|
||||
struct ApiVersionHash {
|
||||
int version;
|
||||
const char* const universal;
|
||||
const char* const platform;
|
||||
const char* const hash;
|
||||
};
|
||||
|
||||
const ApiVersionHash kApiVersionHashes[] = {"""
|
||||
|
||||
for version, hashes in json['hashes'].items():
|
||||
result += """
|
||||
{$VER$, CEF_API_HASH_$VER$_UNIVERSAL, CEF_API_HASH_$VER$_PLATFORM},""".replace(
|
||||
'$VER$', version)
|
||||
for version in json['hashes'].keys():
|
||||
result += f"\n{{{version}, CEF_API_HASH_{version}}},"
|
||||
|
||||
result += \
|
||||
"""
|
||||
result += """
|
||||
};
|
||||
|
||||
const size_t kApiVersionHashesSize = std::size(kApiVersionHashes);
|
||||
|
||||
} // namespace
|
||||
"""
|
||||
|
||||
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)
|
||||
result = make_api_versions_header(json)
|
||||
if not bool(result):
|
||||
sys.stderr.write('Failed to create %s\n' % out_file)
|
||||
if not result:
|
||||
sys.stderr.write(f'Failed to create {out_file}\n')
|
||||
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)
|
||||
result = make_api_versions_inc(json)
|
||||
if not bool(result):
|
||||
sys.stderr.write('Failed to create %s\n' % out_file)
|
||||
if not result:
|
||||
sys.stderr.write(f'Failed to create {out_file}\n')
|
||||
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):
|
||||
if len(argv) < 5:
|
||||
print(
|
||||
"Usage:\n %s <output_header_file> <output_inc_file> <api_versions_file> <api_untracked_file>"
|
||||
% argv[0])
|
||||
f"Usage:\n {argv[0]} <output_header_file> <output_inc_file> <api_versions_file> <api_untracked_file>"
|
||||
)
|
||||
sys.exit(-1)
|
||||
|
||||
json, initialized = \
|
||||
read_version_files(argv[3], argv[4], True, combine=True)
|
||||
json = read_version_files(argv[3], argv[4], initialize=True, combine=True)[0]
|
||||
|
||||
if not write_api_versions(argv[1], argv[2], json):
|
||||
print('Nothing done')
|
||||
|
||||
|
@@ -43,7 +43,7 @@ def make_capi_versions_header(header, filename):
|
||||
translate_map = header.get_capi_translations()
|
||||
|
||||
# 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<'+\
|
||||
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
|
||||
if func.has_attrib('api_hash_check'):
|
||||
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()
|
||||
|
||||
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:
|
||||
apply_patch_config()
|
||||
|
@@ -4,7 +4,8 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
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 date_util import get_date
|
||||
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
|
||||
|
||||
|
||||
_CALC = None
|
||||
|
||||
|
||||
def compute_api_hashes(cpp_header_dir, api_version, next_allowed, debug_dir,
|
||||
verbose):
|
||||
""" Computes API hashes for the specified |api_version|.
|
||||
"""
|
||||
if not debug_dir is None:
|
||||
debug_dir = os.path.join(debug_dir, api_version)
|
||||
|
||||
def compute_api_hashes(api_version: str,
|
||||
hasher: CefApiHasher,
|
||||
next_allowed: bool) -> Dict[str, str]:
|
||||
""" Computes API hashes for the specified |api_version|. """
|
||||
if not next_allowed:
|
||||
# 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 = [
|
||||
# Using CEF_API_VERSION_NEXT is an error.
|
||||
'CEF_API_VERSION_NEXT="Please_specify_an_exact_CEF_version"',
|
||||
]
|
||||
else:
|
||||
added_defines = None
|
||||
added_defines = []
|
||||
|
||||
global _CALC
|
||||
if _CALC is None:
|
||||
_CALC = cef_api_hash(cpp_header_dir, verbose=verbose)
|
||||
|
||||
hashes = _CALC.calculate(api_version, debug_dir, added_defines)
|
||||
if bool(hashes):
|
||||
hashes = hasher.calculate(api_version, added_defines)
|
||||
if hashes:
|
||||
if api_version in UNTRACKED_VERSIONS:
|
||||
label = version_label(api_version)
|
||||
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:
|
||||
hashes['comment'] = 'Added %s.' % get_date()
|
||||
hashes['comment'] = f'Added {get_date()}.'
|
||||
return hashes
|
||||
|
||||
|
||||
def same_api_hashes(hashes1, hashes2):
|
||||
for key in ('universal', 'linux', 'mac', 'windows'):
|
||||
if hashes1[key] != hashes2[key]:
|
||||
return False
|
||||
return True
|
||||
return all(hashes1[key] == hashes2[key]
|
||||
for key in ['linux', 'mac', 'windows'])
|
||||
|
||||
|
||||
def compute_next_api_verson(api_versions_file):
|
||||
def compute_next_api_version(api_versions_file):
|
||||
""" Computes the next available API version number.
|
||||
"""
|
||||
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):
|
||||
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)
|
||||
|
||||
|
||||
@@ -105,7 +97,7 @@ def find_next_usage(cpp_header_dir):
|
||||
if result is None:
|
||||
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')
|
||||
return True
|
||||
|
||||
@@ -204,8 +196,11 @@ def find_replace_next_usage(cpp_header_dir, next_version):
|
||||
return 0
|
||||
|
||||
|
||||
def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
||||
next_version, debug_dir, apply_next, verbose):
|
||||
def exec_apply(api_versions_file,
|
||||
api_untracked_file,
|
||||
next_version,
|
||||
apply_next,
|
||||
hasher: CefApiHasher) -> int:
|
||||
""" Updates untracked API hashes if necessary.
|
||||
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
|
||||
for version in UNTRACKED_VERSIONS:
|
||||
label = version_label(version)
|
||||
hashes = compute_api_hashes(cpp_header_dir, version, True, debug_dir,
|
||||
verbose)
|
||||
if not bool(hashes):
|
||||
hashes = compute_api_hashes(version, hasher, next_allowed=True)
|
||||
if not hashes:
|
||||
sys.stderr.write('ERROR: Failed to process %s\n' % label)
|
||||
return 1
|
||||
|
||||
@@ -237,9 +231,8 @@ def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
||||
if apply_next:
|
||||
next_label = version_label(next_version)
|
||||
|
||||
hashes = compute_api_hashes(cpp_header_dir, next_version, False, debug_dir,
|
||||
verbose)
|
||||
if not bool(hashes):
|
||||
hashes = compute_api_hashes(next_version, hasher, next_allowed=False)
|
||||
if not hashes:
|
||||
sys.stderr.write('ERROR: Failed to process %s\n' % next_label)
|
||||
return 1
|
||||
|
||||
@@ -275,29 +268,33 @@ def exec_apply(cpp_header_dir, api_versions_file, api_untracked_file,
|
||||
return 0
|
||||
|
||||
|
||||
def exec_check(cpp_header_dir, api_versions_file, api_untracked_file, debug_dir,
|
||||
fast_check, force_update, skip_untracked, verbose):
|
||||
def exec_check(api_versions_file,
|
||||
api_untracked_file,
|
||||
fast_check,
|
||||
force_update,
|
||||
skip_untracked,
|
||||
hasher: CefApiHasher) -> int:
|
||||
""" Checks existing API version hashes.
|
||||
Resaves all API hashes if |force_update| is true. Otherwise, hash
|
||||
changes are considered an error.
|
||||
"""
|
||||
assert not (fast_check and force_update)
|
||||
|
||||
json_versions, json_untracked, initialized = \
|
||||
read_version_files(api_versions_file, api_untracked_file, False)
|
||||
json_versions, json_untracked, initialized = read_version_files(
|
||||
api_versions_file, api_untracked_file, initialize=False)
|
||||
assert not initialized
|
||||
|
||||
versions = []
|
||||
len_versioned_existing = len_versioned_checked = len_versioned_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()
|
||||
len_versioned_existing = len(keys)
|
||||
if len_versioned_existing > 0:
|
||||
if fast_check:
|
||||
# Only checking a subset of versions.
|
||||
for key in ('last', 'min'):
|
||||
for key in ['last', 'min']:
|
||||
if key in json_versions:
|
||||
version = json_versions[key]
|
||||
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)
|
||||
len_versioned_checked = len_versioned_existing
|
||||
|
||||
if not json_untracked is None:
|
||||
if json_untracked is not None:
|
||||
keys = json_untracked['hashes'].keys()
|
||||
len_untracked_existing = len(keys)
|
||||
if len_untracked_existing > 0 and not skip_untracked:
|
||||
versions.extend(keys)
|
||||
len_untracked_checked = len_untracked_existing
|
||||
|
||||
if len(versions) == 0:
|
||||
if not versions:
|
||||
print('No hashes to check.')
|
||||
return 0
|
||||
|
||||
@@ -328,8 +325,7 @@ def exec_check(cpp_header_dir, api_versions_file, api_untracked_file, debug_dir,
|
||||
else:
|
||||
stored_hashes = json_versions['hashes'][version]
|
||||
label = version_label(version)
|
||||
computed_hashes = compute_api_hashes(cpp_header_dir, version, True,
|
||||
debug_dir, verbose)
|
||||
computed_hashes = compute_api_hashes(version, hasher, next_allowed=True)
|
||||
if not bool(computed_hashes):
|
||||
sys.stderr.write('ERROR: Failed to process %s\n' % label)
|
||||
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.')
|
||||
else:
|
||||
sys.stderr.write('ERROR: %d hashes checked and failed\n' % len_failed)
|
||||
sys.stderr.write('\nFor debugging tips/tricks see\n' +
|
||||
'https://github.com/chromiumembedded/cef/issues/3836#issuecomment-2587767028\n\n')
|
||||
sys.stderr.write(
|
||||
'\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).' %
|
||||
(len(versions) - len_failed,
|
||||
@@ -412,7 +410,7 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
||||
parser = CustomParser(description=desc, epilog=epilog)
|
||||
parser.add_option(
|
||||
'--debug-dir',
|
||||
dest='debugdir',
|
||||
dest='debug_dir',
|
||||
metavar='DIR',
|
||||
help='intermediate directory for easy debugging')
|
||||
parser.add_option(
|
||||
@@ -472,7 +470,7 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
||||
parser.add_option(
|
||||
'--force-update',
|
||||
action='store_true',
|
||||
dest='forceupdate',
|
||||
dest='force_update',
|
||||
default=False,
|
||||
help='force update all API hashes (use with -c)')
|
||||
(options, args) = parser.parse_args()
|
||||
@@ -496,7 +494,7 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
||||
parser.print_help(sys.stdout)
|
||||
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:
|
||||
sys.exit(1)
|
||||
|
||||
@@ -522,17 +520,13 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
||||
changed = translate(cef_dir, verbose=options.verbose) > 0
|
||||
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(
|
||||
api_untracked_file):
|
||||
skip_untracked = True
|
||||
if exec_apply(
|
||||
cpp_header_dir,
|
||||
api_versions_file,
|
||||
api_untracked_file,
|
||||
next_version,
|
||||
options.debugdir,
|
||||
apply_next=options.apply,
|
||||
verbose=options.verbose) > 0:
|
||||
if exec_apply(api_versions_file, api_untracked_file, next_version,
|
||||
options.apply, hasher) > 0:
|
||||
# Apply failed.
|
||||
sys.exit(1)
|
||||
elif not options.check:
|
||||
@@ -540,12 +534,6 @@ https://bitbucket.org/chromiumembedded/cef/wiki/ApiVersioning.md
|
||||
sys.exit(0)
|
||||
|
||||
sys.exit(
|
||||
exec_check(
|
||||
cpp_header_dir,
|
||||
api_versions_file,
|
||||
api_untracked_file,
|
||||
options.debugdir,
|
||||
options.fastcheck and not options.forceupdate,
|
||||
options.check and options.forceupdate,
|
||||
skip_untracked,
|
||||
verbose=options.verbose))
|
||||
exec_check(api_versions_file, api_untracked_file, options.fastcheck and
|
||||
not options.force_update, options.check and
|
||||
options.force_update, skip_untracked, hasher))
|
||||
|
@@ -92,7 +92,7 @@ def read_version_files(api_versions_file,
|
||||
}
|
||||
initialized = True
|
||||
else:
|
||||
json_version = None
|
||||
json_versions = None
|
||||
else:
|
||||
assert 'hashes' in json_versions, api_versions_file
|
||||
assert 'last' in json_versions, api_versions_file
|
||||
|
Reference in New Issue
Block a user