Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
8becf442
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,发现更多精彩内容 >>
未验证
提交
8becf442
编写于
8月 08, 2019
作者:
C
Chinmay Garde
提交者:
GitHub
8月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wire up a concurrent message loop backed SkExecutor for Skia. (#10788)
Fixes
https://github.com/flutter/flutter/issues/37885
上级
9d2a2888
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
75 addition
and
0 deletion
+75
-0
ci/licenses_golden/licenses_flutter
ci/licenses_golden/licenses_flutter
+2
-0
runtime/BUILD.gn
runtime/BUILD.gn
+2
-0
runtime/dart_vm.cc
runtime/dart_vm.cc
+12
-0
runtime/dart_vm.h
runtime/dart_vm.h
+2
-0
runtime/skia_concurrent_executor.cc
runtime/skia_concurrent_executor.cc
+26
-0
runtime/skia_concurrent_executor.h
runtime/skia_concurrent_executor.h
+31
-0
未找到文件。
ci/licenses_golden/licenses_flutter
浏览文件 @
8becf442
...
...
@@ -466,6 +466,8 @@ FILE: ../../../flutter/runtime/runtime_test.cc
FILE: ../../../flutter/runtime/runtime_test.h
FILE: ../../../flutter/runtime/service_protocol.cc
FILE: ../../../flutter/runtime/service_protocol.h
FILE: ../../../flutter/runtime/skia_concurrent_executor.cc
FILE: ../../../flutter/runtime/skia_concurrent_executor.h
FILE: ../../../flutter/runtime/start_up.cc
FILE: ../../../flutter/runtime/start_up.h
FILE: ../../../flutter/runtime/test_font_data.cc
...
...
runtime/BUILD.gn
浏览文件 @
8becf442
...
...
@@ -66,6 +66,8 @@ source_set("runtime") {
"runtime_delegate.h",
"service_protocol.cc",
"service_protocol.h",
"skia_concurrent_executor.cc",
"skia_concurrent_executor.h",
"start_up.cc",
"start_up.h",
]
...
...
runtime/dart_vm.cc
浏览文件 @
8becf442
...
...
@@ -27,6 +27,7 @@
#include "flutter/runtime/ptrace_ios.h"
#include "flutter/runtime/start_up.h"
#include "third_party/dart/runtime/include/bin/dart_io_api.h"
#include "third_party/skia/include/core/SkExecutor.h"
#include "third_party/tonic/converter/dart_converter.h"
#include "third_party/tonic/dart_class_library.h"
#include "third_party/tonic/dart_class_provider.h"
...
...
@@ -255,6 +256,9 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
std
::
shared_ptr
<
IsolateNameServer
>
isolate_name_server
)
:
settings_
(
vm_data
->
GetSettings
()),
concurrent_message_loop_
(
fml
::
ConcurrentMessageLoop
::
Create
()),
skia_concurrent_executor_
(
[
runner
=
concurrent_message_loop_
->
GetTaskRunner
()](
fml
::
closure
work
)
{
runner
->
PostTask
(
work
);
}),
vm_data_
(
vm_data
),
isolate_name_server_
(
std
::
move
(
isolate_name_server
)),
service_protocol_
(
std
::
make_shared
<
ServiceProtocol
>
())
{
...
...
@@ -262,6 +266,10 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
gVMLaunchCount
++
;
// Setting the executor is not thread safe but Dart VM initialization is. So
// this call is thread-safe.
SkExecutor
::
SetDefault
(
&
skia_concurrent_executor_
);
FML_DCHECK
(
vm_data_
);
FML_DCHECK
(
isolate_name_server_
);
FML_DCHECK
(
service_protocol_
);
...
...
@@ -425,6 +433,10 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
}
DartVM
::~
DartVM
()
{
// Setting the executor is not thread safe but Dart VM shutdown is. So
// this call is thread-safe.
SkExecutor
::
SetDefault
(
nullptr
);
if
(
Dart_CurrentIsolate
()
!=
nullptr
)
{
Dart_ExitIsolate
();
}
...
...
runtime/dart_vm.h
浏览文件 @
8becf442
...
...
@@ -21,6 +21,7 @@
#include "flutter/runtime/dart_snapshot.h"
#include "flutter/runtime/dart_vm_data.h"
#include "flutter/runtime/service_protocol.h"
#include "flutter/runtime/skia_concurrent_executor.h"
#include "third_party/dart/runtime/include/dart_api.h"
namespace
flutter
{
...
...
@@ -47,6 +48,7 @@ class DartVM {
private:
const
Settings
settings_
;
std
::
shared_ptr
<
fml
::
ConcurrentMessageLoop
>
concurrent_message_loop_
;
SkiaConcurrentExecutor
skia_concurrent_executor_
;
std
::
shared_ptr
<
const
DartVMData
>
vm_data_
;
const
std
::
shared_ptr
<
IsolateNameServer
>
isolate_name_server_
;
const
std
::
shared_ptr
<
ServiceProtocol
>
service_protocol_
;
...
...
runtime/skia_concurrent_executor.cc
0 → 100644
浏览文件 @
8becf442
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/runtime/skia_concurrent_executor.h"
#include "flutter/fml/trace_event.h"
namespace
flutter
{
SkiaConcurrentExecutor
::
SkiaConcurrentExecutor
(
OnWorkCallback
on_work
)
:
on_work_
(
on_work
)
{}
SkiaConcurrentExecutor
::~
SkiaConcurrentExecutor
()
=
default
;
void
SkiaConcurrentExecutor
::
add
(
fml
::
closure
work
)
{
if
(
!
work
)
{
return
;
}
on_work_
([
work
]()
{
TRACE_EVENT0
(
"flutter"
,
"SkiaExecutor"
);
work
();
});
}
}
// namespace flutter
runtime/skia_concurrent_executor.h
0 → 100644
浏览文件 @
8becf442
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_RUNTIME_SKIA_CONCURRENT_EXECUTOR_H_
#define FLUTTER_RUNTIME_SKIA_CONCURRENT_EXECUTOR_H_
#include "flutter/fml/closure.h"
#include "flutter/fml/macros.h"
#include "third_party/skia/include/core/SkExecutor.h"
namespace
flutter
{
class
SkiaConcurrentExecutor
:
public
SkExecutor
{
public:
using
OnWorkCallback
=
std
::
function
<
void
(
fml
::
closure
work
)
>
;
SkiaConcurrentExecutor
(
OnWorkCallback
on_work
);
~
SkiaConcurrentExecutor
()
override
;
void
add
(
fml
::
closure
work
)
override
;
private:
OnWorkCallback
on_work_
;
FML_DISALLOW_COPY_AND_ASSIGN
(
SkiaConcurrentExecutor
);
};
}
// namespace flutter
#endif // FLUTTER_RUNTIME_SKIA_CONCURRENT_EXECUTOR_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录