Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
53442be1
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
53442be1
编写于
8月 12, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[lazy] Use for ft_library
上级
7a8d4803
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
36 deletion
+35
-36
src/hb-ft.cc
src/hb-ft.cc
+30
-31
src/hb-glib.cc
src/hb-glib.cc
+1
-1
src/hb-icu.cc
src/hb-icu.cc
+1
-1
src/hb-machinery-private.hh
src/hb-machinery-private.hh
+1
-1
src/hb-ot-font.cc
src/hb-ot-font.cc
+1
-1
src/hb-ucdn.cc
src/hb-ucdn.cc
+1
-1
未找到文件。
src/hb-ft.cc
浏览文件 @
53442be1
...
@@ -461,7 +461,7 @@ void free_static_ft_funcs (void)
...
@@ -461,7 +461,7 @@ void free_static_ft_funcs (void)
static
hb_font_funcs_t
*
static
hb_font_funcs_t
*
_hb_ft_get_font_funcs
(
void
)
_hb_ft_get_font_funcs
(
void
)
{
{
return
const_cast
<
hb_font_funcs_t
*>
(
static_ft_funcs
.
get
()
);
return
static_ft_funcs
.
get_unconst
(
);
}
}
static
void
static
void
...
@@ -683,47 +683,46 @@ hb_ft_font_create_referenced (FT_Face ft_face)
...
@@ -683,47 +683,46 @@ hb_ft_font_create_referenced (FT_Face ft_face)
}
}
/* Thread-safe, lock-free, FT_Library */
static
void
free_static_ft_library
(
void
);
static
hb_atomic_ptr_t
<
FT_Library
>
ft_library
;
static
struct
hb_ft_library_lazy_loader_t
:
hb_lazy_loader_t
<
hb_ft_library_lazy_loader_t
,
void
,
0
,
hb_remove_ptr_t
<
FT_Library
>::
value
>
{
static
inline
FT_Library
create
(
void
)
{
FT_Library
l
;
if
(
FT_Init_FreeType
(
&
l
))
return
nullptr
;
#ifdef HB_USE_ATEXIT
atexit
(
free_static_ft_library
);
#endif
return
l
;
}
static
inline
void
destroy
(
FT_Library
l
)
{
FT_Done_FreeType
(
l
);
}
static
inline
const
FT_Library
get_null
(
void
)
{
return
nullptr
;
}
}
static_ft_library
;
#ifdef HB_USE_ATEXIT
#ifdef HB_USE_ATEXIT
static
static
void
free_ft_library
(
void
)
void
free_
static_
ft_library
(
void
)
{
{
retry:
static_ft_library
.
free
();
FT_Library
library
=
ft_library
.
get
();
if
(
unlikely
(
!
ft_library
.
cmpexch
(
library
,
nullptr
)))
goto
retry
;
FT_Done_FreeType
(
library
);
}
}
#endif
#endif
static
FT_Library
static
FT_Library
get_ft_library
(
void
)
get_ft_library
(
void
)
{
{
retry:
return
static_ft_library
.
get_unconst
();
FT_Library
library
=
ft_library
.
get
();
if
(
unlikely
(
!
library
))
{
/* Not found; allocate one. */
if
(
FT_Init_FreeType
(
&
library
))
return
nullptr
;
if
(
unlikely
(
!
ft_library
.
cmpexch
(
nullptr
,
library
)))
{
FT_Done_FreeType
(
library
);
goto
retry
;
}
#ifdef HB_USE_ATEXIT
atexit
(
free_ft_library
);
/* First person registers atexit() callback. */
#endif
}
return
library
;
}
}
static
void
static
void
...
...
src/hb-glib.cc
浏览文件 @
53442be1
...
@@ -401,7 +401,7 @@ void free_static_glib_funcs (void)
...
@@ -401,7 +401,7 @@ void free_static_glib_funcs (void)
hb_unicode_funcs_t
*
hb_unicode_funcs_t
*
hb_glib_get_unicode_funcs
(
void
)
hb_glib_get_unicode_funcs
(
void
)
{
{
return
hb_unicode_funcs_reference
(
const_cast
<
hb_unicode_funcs_t
*>
(
static_glib_funcs
.
get
()
));
return
hb_unicode_funcs_reference
(
static_glib_funcs
.
get_unconst
(
));
}
}
...
...
src/hb-icu.cc
浏览文件 @
53442be1
...
@@ -380,5 +380,5 @@ void free_static_icu_funcs (void)
...
@@ -380,5 +380,5 @@ void free_static_icu_funcs (void)
hb_unicode_funcs_t
*
hb_unicode_funcs_t
*
hb_icu_get_unicode_funcs
(
void
)
hb_icu_get_unicode_funcs
(
void
)
{
{
return
hb_unicode_funcs_reference
(
const_cast
<
hb_unicode_funcs_t
*>
(
static_icu_funcs
.
get
()
));
return
hb_unicode_funcs_reference
(
static_icu_funcs
.
get_unconst
(
));
}
}
src/hb-machinery-private.hh
浏览文件 @
53442be1
...
@@ -667,7 +667,6 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
...
@@ -667,7 +667,6 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
if
(
unlikely
(
!
p
))
if
(
unlikely
(
!
p
))
{
{
p
=
do_create
();
p
=
do_create
();
assert
(
p
);
if
(
unlikely
(
!
this
->
instance
.
cmpexch
(
nullptr
,
p
)))
if
(
unlikely
(
!
this
->
instance
.
cmpexch
(
nullptr
,
p
)))
{
{
do_destroy
(
p
);
do_destroy
(
p
);
...
@@ -689,6 +688,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
...
@@ -689,6 +688,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
}
}
inline
const
Returned
*
get
(
void
)
const
{
return
Subclass
::
convert
(
get_stored
());
}
inline
const
Returned
*
get
(
void
)
const
{
return
Subclass
::
convert
(
get_stored
());
}
inline
Returned
*
get_unconst
(
void
)
const
{
return
const_cast
<
Returned
*>
(
Subclass
::
convert
(
get_stored
()));
}
/* To be possibly overloaded by subclasses. */
/* To be possibly overloaded by subclasses. */
static
inline
const
Returned
*
convert
(
const
Stored
*
p
)
{
return
p
;
}
static
inline
const
Returned
*
convert
(
const
Stored
*
p
)
{
return
p
;
}
...
...
src/hb-ot-font.cc
浏览文件 @
53442be1
...
@@ -271,7 +271,7 @@ void free_static_ot_funcs (void)
...
@@ -271,7 +271,7 @@ void free_static_ot_funcs (void)
static
hb_font_funcs_t
*
static
hb_font_funcs_t
*
_hb_ot_get_font_funcs
(
void
)
_hb_ot_get_font_funcs
(
void
)
{
{
return
const_cast
<
hb_font_funcs_t
*>
(
static_ot_funcs
.
get
()
);
return
static_ot_funcs
.
get_unconst
(
);
}
}
...
...
src/hb-ucdn.cc
浏览文件 @
53442be1
...
@@ -275,5 +275,5 @@ extern "C" HB_INTERNAL
...
@@ -275,5 +275,5 @@ extern "C" HB_INTERNAL
hb_unicode_funcs_t
*
hb_unicode_funcs_t
*
hb_ucdn_get_unicode_funcs
(
void
)
hb_ucdn_get_unicode_funcs
(
void
)
{
{
return
hb_unicode_funcs_reference
(
const_cast
<
hb_unicode_funcs_t
*>
(
static_ucdn_funcs
.
get
()
));
return
hb_unicode_funcs_reference
(
static_ucdn_funcs
.
get_unconst
(
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录