mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update source files for bracket style
This commit is contained in:
@ -65,16 +65,18 @@ class CefCToCppRefCounted : public BaseName {
|
||||
void UnderlyingAddRef() const {
|
||||
cef_base_ref_counted_t* base =
|
||||
reinterpret_cast<cef_base_ref_counted_t*>(GetStruct());
|
||||
if (base->add_ref)
|
||||
if (base->add_ref) {
|
||||
base->add_ref(base);
|
||||
}
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool UnderlyingRelease() const {
|
||||
cef_base_ref_counted_t* base =
|
||||
reinterpret_cast<cef_base_ref_counted_t*>(GetStruct());
|
||||
if (!base->release)
|
||||
if (!base->release) {
|
||||
return false;
|
||||
}
|
||||
return base->release(base) ? true : false;
|
||||
}
|
||||
|
||||
@ -82,8 +84,9 @@ class CefCToCppRefCounted : public BaseName {
|
||||
bool UnderlyingHasOneRef() const {
|
||||
cef_base_ref_counted_t* base =
|
||||
reinterpret_cast<cef_base_ref_counted_t*>(GetStruct());
|
||||
if (!base->has_one_ref)
|
||||
if (!base->has_one_ref) {
|
||||
return false;
|
||||
}
|
||||
return base->has_one_ref(base) ? true : false;
|
||||
}
|
||||
|
||||
@ -91,8 +94,9 @@ class CefCToCppRefCounted : public BaseName {
|
||||
bool UnderlyingHasAtLeastOneRef() const {
|
||||
cef_base_ref_counted_t* base =
|
||||
reinterpret_cast<cef_base_ref_counted_t*>(GetStruct());
|
||||
if (!base->has_at_least_one_ref)
|
||||
if (!base->has_at_least_one_ref) {
|
||||
return false;
|
||||
}
|
||||
return base->has_at_least_one_ref(base) ? true : false;
|
||||
}
|
||||
|
||||
@ -111,8 +115,9 @@ struct CefCToCppRefCounted<ClassName, BaseName, StructName>::WrapperStruct {
|
||||
template <class ClassName, class BaseName, class StructName>
|
||||
CefRefPtr<BaseName> CefCToCppRefCounted<ClassName, BaseName, StructName>::Wrap(
|
||||
StructName* s) {
|
||||
if (!s)
|
||||
if (!s) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Wrap their structure with the CefCToCppRefCounted object.
|
||||
WrapperStruct* wrapperStruct = new WrapperStruct;
|
||||
@ -131,15 +136,17 @@ CefRefPtr<BaseName> CefCToCppRefCounted<ClassName, BaseName, StructName>::Wrap(
|
||||
template <class ClassName, class BaseName, class StructName>
|
||||
StructName* CefCToCppRefCounted<ClassName, BaseName, StructName>::Unwrap(
|
||||
CefRefPtr<BaseName> c) {
|
||||
if (!c.get())
|
||||
if (!c.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WrapperStruct* wrapperStruct = GetWrapperStruct(c.get());
|
||||
|
||||
// If the type does not match this object then we need to unwrap as the
|
||||
// derived type.
|
||||
if (wrapperStruct->type_ != kWrapperType)
|
||||
if (wrapperStruct->type_ != kWrapperType) {
|
||||
return UnwrapDerived(wrapperStruct->type_, c.get());
|
||||
}
|
||||
|
||||
// Add a reference to the CefCppToC wrapper object on the other side that
|
||||
// will be released once the structure is received.
|
||||
|
@ -106,8 +106,9 @@ struct CefCToCppScoped<ClassName, BaseName, StructName>::WrapperStruct {
|
||||
template <class ClassName, class BaseName, class StructName>
|
||||
CefOwnPtr<BaseName> CefCToCppScoped<ClassName, BaseName, StructName>::Wrap(
|
||||
StructName* s) {
|
||||
if (!s)
|
||||
if (!s) {
|
||||
return CefOwnPtr<BaseName>();
|
||||
}
|
||||
|
||||
// Wrap their structure with the CefCToCpp object.
|
||||
WrapperStruct* wrapperStruct = new WrapperStruct;
|
||||
@ -120,15 +121,17 @@ CefOwnPtr<BaseName> CefCToCppScoped<ClassName, BaseName, StructName>::Wrap(
|
||||
template <class ClassName, class BaseName, class StructName>
|
||||
StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapOwn(
|
||||
CefOwnPtr<BaseName> c) {
|
||||
if (!c.get())
|
||||
if (!c.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WrapperStruct* wrapperStruct = GetWrapperStruct(c.get());
|
||||
|
||||
// If the type does not match this object then we need to unwrap as the
|
||||
// derived type.
|
||||
if (wrapperStruct->type_ != kWrapperType)
|
||||
if (wrapperStruct->type_ != kWrapperType) {
|
||||
return UnwrapDerivedOwn(wrapperStruct->type_, std::move(c));
|
||||
}
|
||||
|
||||
StructName* orig_struct = wrapperStruct->struct_;
|
||||
|
||||
@ -149,15 +152,17 @@ StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapOwn(
|
||||
template <class ClassName, class BaseName, class StructName>
|
||||
StructName* CefCToCppScoped<ClassName, BaseName, StructName>::UnwrapRaw(
|
||||
CefRawPtr<BaseName> c) {
|
||||
if (!c)
|
||||
if (!c) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WrapperStruct* wrapperStruct = GetWrapperStruct(c);
|
||||
|
||||
// If the type does not match this object then we need to unwrap as the
|
||||
// derived type.
|
||||
if (wrapperStruct->type_ != kWrapperType)
|
||||
if (wrapperStruct->type_ != kWrapperType) {
|
||||
return UnwrapDerivedRaw(wrapperStruct->type_, c);
|
||||
}
|
||||
|
||||
// Return the original structure.
|
||||
return wrapperStruct->struct_;
|
||||
@ -177,8 +182,9 @@ void CefCToCppScoped<ClassName, BaseName, StructName>::operator delete(
|
||||
|
||||
// If we own the object (base->del != NULL) then notify the other side that
|
||||
// the object has been deleted.
|
||||
if (base && base->del)
|
||||
if (base && base->del) {
|
||||
base->del(base);
|
||||
}
|
||||
|
||||
// Delete the wrapper structure without executing ~CefCToCppScoped() an
|
||||
// additional time.
|
||||
|
Reference in New Issue
Block a user