Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
079d6045
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,发现更多精彩内容 >>
未验证
提交
079d6045
编写于
12月 19, 2018
作者:
J
Jason Simmons
提交者:
GitHub
12月 19, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a system message channel for controlling the Skia resource cache size (#7257)
See
https://github.com/flutter/flutter/issues/25244
上级
41222d05
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
0 deletion
+45
-0
shell/common/rasterizer.cc
shell/common/rasterizer.cc
+9
-0
shell/common/rasterizer.h
shell/common/rasterizer.h
+2
-0
shell/common/shell.cc
shell/common/shell.cc
+32
-0
shell/common/shell.h
shell/common/shell.h
+2
-0
未找到文件。
shell/common/rasterizer.cc
浏览文件 @
079d6045
...
...
@@ -360,6 +360,15 @@ void Rasterizer::FireNextFrameCallbackIfPresent() {
callback
();
}
void
Rasterizer
::
SetResourceCacheMaxBytes
(
int
max_bytes
)
{
GrContext
*
context
=
surface_
->
GetContext
();
if
(
context
)
{
int
max_resources
;
context
->
getResourceCacheLimits
(
&
max_resources
,
nullptr
);
context
->
setResourceCacheLimits
(
max_resources
,
max_bytes
);
}
}
Rasterizer
::
Screenshot
::
Screenshot
()
{}
Rasterizer
::
Screenshot
::
Screenshot
(
sk_sp
<
SkData
>
p_data
,
SkISize
p_size
)
...
...
shell/common/rasterizer.h
浏览文件 @
079d6045
...
...
@@ -73,6 +73,8 @@ class Rasterizer final : public blink::SnapshotDelegate {
return
compositor_context_
.
get
();
}
void
SetResourceCacheMaxBytes
(
int
max_bytes
);
private:
blink
::
TaskRunners
task_runners_
;
std
::
unique_ptr
<
Surface
>
surface_
;
...
...
shell/common/shell.cc
浏览文件 @
079d6045
...
...
@@ -33,6 +33,8 @@
namespace
shell
{
constexpr
char
kSkiaChannel
[]
=
"flutter/skia"
;
std
::
unique_ptr
<
Shell
>
Shell
::
CreateShellOnPlatformThread
(
blink
::
TaskRunners
task_runners
,
blink
::
Settings
settings
,
...
...
@@ -727,6 +729,11 @@ void Shell::OnEngineHandlePlatformMessage(
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
if
(
message
->
channel
()
==
kSkiaChannel
)
{
HandleEngineSkiaMessage
(
std
::
move
(
message
));
return
;
}
task_runners_
.
GetPlatformTaskRunner
()
->
PostTask
(
[
view
=
platform_view_
->
GetWeakPtr
(),
message
=
std
::
move
(
message
)]()
{
if
(
view
)
{
...
...
@@ -735,6 +742,31 @@ void Shell::OnEngineHandlePlatformMessage(
});
}
void
Shell
::
HandleEngineSkiaMessage
(
fml
::
RefPtr
<
blink
::
PlatformMessage
>
message
)
{
const
auto
&
data
=
message
->
data
();
rapidjson
::
Document
document
;
document
.
Parse
(
reinterpret_cast
<
const
char
*>
(
data
.
data
()),
data
.
size
());
if
(
document
.
HasParseError
()
||
!
document
.
IsObject
())
return
;
auto
root
=
document
.
GetObject
();
auto
method
=
root
.
FindMember
(
"method"
);
if
(
method
->
value
!=
"Skia.setResourceCacheMaxBytes"
)
return
;
auto
args
=
root
.
FindMember
(
"args"
);
if
(
args
==
root
.
MemberEnd
()
||
!
args
->
value
.
IsInt
())
return
;
task_runners_
.
GetGPUTaskRunner
()
->
PostTask
(
[
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
max_bytes
=
args
->
value
.
GetInt
()]
{
if
(
rasterizer
)
{
rasterizer
->
SetResourceCacheMaxBytes
(
max_bytes
);
}
});
}
// |shell::Engine::Delegate|
void
Shell
::
OnPreEngineRestart
()
{
FML_DCHECK
(
is_setup_
);
...
...
shell/common/shell.h
浏览文件 @
079d6045
...
...
@@ -179,6 +179,8 @@ class Shell final : public PlatformView::Delegate,
void
OnEngineHandlePlatformMessage
(
fml
::
RefPtr
<
blink
::
PlatformMessage
>
message
)
override
;
void
HandleEngineSkiaMessage
(
fml
::
RefPtr
<
blink
::
PlatformMessage
>
message
);
// |shell::Engine::Delegate|
void
OnPreEngineRestart
()
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录