Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
68ae872e
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
68ae872e
编写于
7月 18, 2019
作者:
G
gaaclarke
提交者:
GitHub
7月 18, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Made the persistent cache's directory a const pointer. (#9815)
上级
8720043d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
18 addition
and
6 deletion
+18
-6
shell/common/persistent_cache.cc
shell/common/persistent_cache.cc
+15
-4
shell/common/persistent_cache.h
shell/common/persistent_cache.h
+3
-2
未找到文件。
shell/common/persistent_cache.cc
浏览文件 @
68ae872e
...
@@ -51,22 +51,33 @@ void PersistentCache::SetCacheDirectoryPath(std::string path) {
...
@@ -51,22 +51,33 @@ void PersistentCache::SetCacheDirectoryPath(std::string path) {
cache_base_path_
=
path
;
cache_base_path_
=
path
;
}
}
PersistentCache
::
PersistentCache
(
bool
read_only
)
:
is_read_only_
(
read_only
)
{
namespace
{
std
::
shared_ptr
<
fml
::
UniqueFD
>
MakeCacheDirectory
(
const
std
::
string
&
global_cache_base_path
,
bool
read_only
)
{
fml
::
UniqueFD
cache_base_dir
;
fml
::
UniqueFD
cache_base_dir
;
if
(
cache_base_path_
.
length
())
{
if
(
global_cache_base_path
.
length
())
{
cache_base_dir
=
fml
::
OpenDirectory
(
cache_base_path_
.
c_str
(),
false
,
cache_base_dir
=
fml
::
OpenDirectory
(
global_cache_base_path
.
c_str
(),
false
,
fml
::
FilePermission
::
kRead
);
fml
::
FilePermission
::
kRead
);
}
else
{
}
else
{
cache_base_dir
=
fml
::
paths
::
GetCachesDirectory
();
cache_base_dir
=
fml
::
paths
::
GetCachesDirectory
();
}
}
if
(
cache_base_dir
.
is_valid
())
{
if
(
cache_base_dir
.
is_valid
())
{
cache_directory_
=
std
::
make_shared
<
fml
::
UniqueFD
>
(
CreateDirectory
(
return
std
::
make_shared
<
fml
::
UniqueFD
>
(
CreateDirectory
(
cache_base_dir
,
cache_base_dir
,
{
"flutter_engine"
,
GetFlutterEngineVersion
(),
"skia"
,
GetSkiaVersion
()},
{
"flutter_engine"
,
GetFlutterEngineVersion
(),
"skia"
,
GetSkiaVersion
()},
read_only
?
fml
::
FilePermission
::
kRead
read_only
?
fml
::
FilePermission
::
kRead
:
fml
::
FilePermission
::
kReadWrite
));
:
fml
::
FilePermission
::
kReadWrite
));
}
else
{
return
std
::
make_shared
<
fml
::
UniqueFD
>
();
}
}
}
}
// namespace
PersistentCache
::
PersistentCache
(
bool
read_only
)
:
is_read_only_
(
read_only
),
cache_directory_
(
MakeCacheDirectory
(
cache_base_path_
,
read_only
))
{
if
(
!
IsValid
())
{
if
(
!
IsValid
())
{
FML_LOG
(
WARNING
)
<<
"Could not acquire the persistent cache directory. "
FML_LOG
(
WARNING
)
<<
"Could not acquire the persistent cache directory. "
"Caching of GPU resources on disk is disabled."
;
"Caching of GPU resources on disk is disabled."
;
...
...
shell/common/persistent_cache.h
浏览文件 @
68ae872e
...
@@ -19,7 +19,8 @@ namespace flutter {
...
@@ -19,7 +19,8 @@ namespace flutter {
/// A cache of SkData that gets stored to disk.
/// A cache of SkData that gets stored to disk.
///
///
/// This is mainly used for Shaders but is also written to by Dart.
/// This is mainly used for Shaders but is also written to by Dart. It is
/// thread-safe for reading and writing from multiple threads.
class
PersistentCache
:
public
GrContextOptions
::
PersistentCache
{
class
PersistentCache
:
public
GrContextOptions
::
PersistentCache
{
public:
public:
// Mutable static switch that can be set before GetCacheForProcess. If true,
// Mutable static switch that can be set before GetCacheForProcess. If true,
...
@@ -52,7 +53,7 @@ class PersistentCache : public GrContextOptions::PersistentCache {
...
@@ -52,7 +53,7 @@ class PersistentCache : public GrContextOptions::PersistentCache {
static
std
::
string
cache_base_path_
;
static
std
::
string
cache_base_path_
;
const
bool
is_read_only_
;
const
bool
is_read_only_
;
std
::
shared_ptr
<
fml
::
UniqueFD
>
cache_directory_
;
const
std
::
shared_ptr
<
fml
::
UniqueFD
>
cache_directory_
;
mutable
std
::
mutex
worker_task_runners_mutex_
;
mutable
std
::
mutex
worker_task_runners_mutex_
;
std
::
multiset
<
fml
::
RefPtr
<
fml
::
TaskRunner
>>
worker_task_runners_
std
::
multiset
<
fml
::
RefPtr
<
fml
::
TaskRunner
>>
worker_task_runners_
FML_GUARDED_BY
(
worker_task_runners_mutex_
);
FML_GUARDED_BY
(
worker_task_runners_mutex_
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录