Compare commits

...

4 Commits

Author SHA1 Message Date
Marshall Greenblatt a231b7ead7 cefclient: Fix toolbar visibility with --hide-controls (fixes #3745) 2024-10-04 09:57:45 -04:00
Marshall Greenblatt e5bc3c9255 Update generated files for void* return value (see #3591) 2024-10-04 09:22:22 -04:00
Marshall Greenblatt 330534a2e7 tools: translator: Add void* return value support (fixes #3591) 2024-10-04 09:22:22 -04:00
Marshall Greenblatt 467a0d6a85 tools: automate: Fail early if directory can't be renamed (fixes #2502) 2024-10-04 09:22:22 -04:00
13 changed files with 65 additions and 38 deletions

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=e4cad5e75e1837d5d68c936e71b919e1702afad9$
// $hash=a5ca27729a570de0318a9d15416fee153afaec32$
//
#include "libcef_dll/cpptoc/binary_value_cpptoc.h"
@ -145,14 +145,13 @@ const void* CEF_CALLBACK
binary_value_get_raw_data(struct _cef_binary_value_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return NULL;
}
// This manual implementation can be removed once support for 'const void*'
// is integrated into the CEF translator tool (issue #3591).
// Execute
const void* _retval = CefBinaryValueCppToC::Get(self)->GetRawData();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d9074b7c1500d594cc88a4eedb68d9d31c5f5018$
// $hash=fd37d01fdcf8c3de25e36d428ca38781c4749586$
//
#include "libcef_dll/cpptoc/shared_memory_region_cpptoc.h"
@ -60,14 +60,13 @@ void* CEF_CALLBACK
shared_memory_region_memory(struct _cef_shared_memory_region_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return NULL;
}
// This manual implementation can be removed once support for 'void*'
// is integrated into the CEF translator tool (issue #3591).
// Execute
void* _retval = CefSharedMemoryRegionCppToC::Get(self)->Memory();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=592d43a6597f03f91eb13ea9354ed552f581ebec$
// $hash=fb7e4b1912656da200ed1dd614a9f03e7d5f8ce7$
//
#include "libcef_dll/cpptoc/shared_process_message_builder_cpptoc.h"
@ -84,15 +84,17 @@ void* CEF_CALLBACK shared_process_message_builder_memory(
struct _cef_shared_process_message_builder_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
return NULL;
}
// Execute
void* _retval = CefSharedProcessMessageBuilderCppToC::Get(self)->Memory();
// Return type: simple
// Return type: simple_byaddr
return _retval;
}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=befb2f29af8a0e8eabf745fad126ebad5a741c74$
// $hash=10ac43c0f16dedaf21bfa55f126f61c4d179abca$
//
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
@ -976,14 +976,13 @@ v8value_get_array_buffer_byte_length(struct _cef_v8value_t* self) {
}
void* CEF_CALLBACK v8value_get_array_buffer_data(struct _cef_v8value_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return NULL;
}
// This manual implementation can be removed once support for 'void*'
// is integrated into the CEF translator tool (issue #3591).
// Execute
void* _retval = CefV8ValueCppToC::Get(self)->GetArrayBufferData();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=e5fd79e6dbb20737b5c3a5b6e4bf547336c62398$
// $hash=8ff0f88b9a33d5c635a0128aef98046c68ddb3ad$
//
#include "libcef_dll/ctocpp/binary_value_ctocpp.h"
@ -148,8 +148,7 @@ NO_SANITIZE("cfi-icall") const void* CefBinaryValueCToCpp::GetRawData() {
return nullptr;
}
// This manual implementation can be removed once support for 'const void*'
// is integrated into the CEF translator tool (issue #3591).
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
const void* _retval = _struct->get_raw_data(_struct);

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b2e33c91a598c69f92031e0624bf96803247439c$
// $hash=2ac7389e153471dba2e636363a5fb49a5afb0d3a$
//
#include "libcef_dll/ctocpp/shared_memory_region_ctocpp.h"
@ -57,11 +57,10 @@ NO_SANITIZE("cfi-icall") void* CefSharedMemoryRegionCToCpp::Memory() {
cef_shared_memory_region_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, memory)) {
return NULL;
return nullptr;
}
// This manual implementation can be removed once support for 'void*'
// is integrated into the CEF translator tool (issue #3591).
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
void* _retval = _struct->memory(_struct);

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=da73d238eb11ae25ae64d3373e2357e40a01051a$
// $hash=b950950a19b7825e808132e616468bb51f8607fb$
//
#include "libcef_dll/ctocpp/shared_process_message_builder_ctocpp.h"
@ -82,13 +82,15 @@ NO_SANITIZE("cfi-icall") void* CefSharedProcessMessageBuilderCToCpp::Memory() {
cef_shared_process_message_builder_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, memory)) {
return NULL;
return nullptr;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
void* _retval = _struct->memory(_struct);
// Return type: simple
// Return type: simple_byaddr
return _retval;
}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=df9571f843ed0e55e581dc6282079803e3641d2c$
// $hash=8469f8012718df705bf24d8abc2c127d68df07c2$
//
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
@ -989,8 +989,7 @@ NO_SANITIZE("cfi-icall") void* CefV8ValueCToCpp::GetArrayBufferData() {
return nullptr;
}
// This manual implementation can be removed once support for 'void*'
// is integrated into the CEF translator tool (issue #3591).
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
void* _retval = _struct->get_array_buffer_data(_struct);

View File

@ -1064,9 +1064,9 @@ ViewsWindow::ViewsWindow(WindowType type,
with_controls_ = is_normal_type && delegate_->WithControls();
const bool hide_frame = command_line->HasSwitch(switches::kHideFrame);
const bool hide_overlays =
!is_normal_type || command_line->HasSwitch(switches::kHideOverlays);
const bool hide_toolbar = hide_overlays && !with_controls_;
const bool show_overlays = is_normal_type && hide_frame && !with_controls_ &&
!command_line->HasSwitch(switches::kHideOverlays);
const bool hide_toolbar = !show_overlays && !with_controls_;
const bool show_window_buttons =
command_line->HasSwitch(switches::kShowWindowButtons);
accepts_first_mouse_ = command_line->HasSwitch(switches::kAcceptsFirstMouse);
@ -1075,7 +1075,7 @@ ViewsWindow::ViewsWindow(WindowType type,
frameless_ = hide_frame;
// With an overlay that mimics window controls.
with_overlay_controls_ = hide_frame && !hide_overlays && !with_controls_;
with_overlay_controls_ = show_overlays;
// If window has frame or flag passed explicitly
with_standard_buttons_ = !frameless_ || show_window_buttons;

View File

@ -117,7 +117,13 @@ def move_directory(source, target, allow_overwrite=False):
if os.path.exists(source):
msg("Moving directory %s to %s" % (source, target))
if not options.dryrun:
shutil.move(source, target)
try:
# This will fail if |source| and |target| are on different filesystems,
# or if files in |source| are currently locked.
os.rename(source, target)
except OSError:
msg('ERROR Failed to move directory %s to %s' % (source, target))
raise
def is_git_checkout(path):

View File

@ -1514,6 +1514,7 @@ class obj_argument:
if self.type.is_result_vector():
# all vector types must be passed by reference
if not self.type.is_byref():
print('ERROR: Invalid (vector not byref) type')
return 'invalid'
if self.type.is_result_vector_string():
@ -1549,6 +1550,8 @@ class obj_argument:
# string single map type
if self.type.is_result_map_single():
if not self.type.is_byref():
print('ERROR: Invalid (single map not byref) type for %s' %
self.type.get_name())
return 'invalid'
if self.type.is_const():
return 'string_map_single_byref_const'
@ -1557,11 +1560,14 @@ class obj_argument:
# string multi map type
if self.type.is_result_map_multi():
if not self.type.is_byref():
print('ERROR: Invalid (multi map not byref) type for %s' %
self.type.get_name())
return 'invalid'
if self.type.is_const():
return 'string_map_multi_byref_const'
return 'string_map_multi_byref'
print('ERROR: Invalid (unknown) type for %s' % self.type.get_name())
return 'invalid'
def get_retval_type(self):
@ -1569,9 +1575,19 @@ class obj_argument:
if self.type.has_name():
raise Exception('Cannot be called for argument types')
# special case for void* return value (may also be const)
if self.type.get_type() == 'void' and self.type.is_byaddr():
return 'simple_byaddr'
# unsupported modifiers
if self.type.is_const() or self.type.is_byref() or \
self.type.is_byaddr():
if self.type.is_const():
print('ERROR: Invalid (const) type for retval')
return 'invalid'
if self.type.is_byref():
print('ERROR: Invalid (byref) type for retval')
return 'invalid'
if self.type.is_byaddr():
print('ERROR: Invalid (byaddr) type for retval')
return 'invalid'
# void types don't have a return value
@ -1596,6 +1612,7 @@ class obj_argument:
else:
return prefix + 'ptr_diff'
print('ERROR: Invalid (unknown) type for retval')
return 'invalid'
def get_retval_default(self, for_capi):
@ -1615,6 +1632,10 @@ class obj_argument:
type = self.get_retval_type()
if type == 'simple':
return self.get_type().get_result_simple_default()
elif type == 'simple_byaddr':
if for_capi:
return 'NULL'
return 'nullptr'
elif type == 'bool':
if for_capi:
return '0'

View File

@ -325,7 +325,7 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped):
if retval_type != 'none':
# has a return value
if retval_type == 'simple':
if retval_type == 'simple' or retval_type == 'simple_byaddr':
result += retval.get_type().get_result_simple_type()
else:
result += retval.get_type().get_type()
@ -446,7 +446,7 @@ def make_cpptoc_function_impl_new(cls, name, func, defined_names, base_scoped):
if retval_type != 'none':
# has a return value
result += '\n // Return type: ' + retval_type
if retval_type == 'simple' or retval_type == 'bool':
if retval_type == 'simple' or retval_type == 'simple_byaddr' or retval_type == 'bool':
result += '\n return _retval;'
elif retval_type == 'string':
result += '\n return _retval.DetachToUserFree();'

View File

@ -342,6 +342,8 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped):
# has a return value
if retval_type == 'simple' or retval_type == 'bool':
result += retval.get_type().get_result_simple_type_root()
elif retval_type == 'simple_byaddr':
result += retval.get_type().get_result_simple_type()
elif retval_type == 'string':
result += 'cef_string_userfree_t'
elif retval_type == 'refptr_same' or retval_type == 'refptr_diff' or \
@ -485,7 +487,7 @@ def make_ctocpp_function_impl_new(clsname, name, func, base_scoped):
if retval_type != 'none':
# has a return value
result += '\n // Return type: ' + retval_type
if retval_type == 'simple':
if retval_type == 'simple' or retval_type == 'simple_byaddr':
result += '\n return _retval;'
elif retval_type == 'bool':
result += '\n return _retval?true:false;'