Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
39e1d00f
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
未验证
提交
39e1d00f
编写于
4月 09, 2019
作者:
C
Chinmay Garde
提交者:
GitHub
4月 09, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove redundant specification of the |flutter| namespace in the engine. (#8523)
上级
56052c70
变更
45
显示空白变更内容
内联
并排
Showing
45 changed file
with
350 addition
and
389 deletion
+350
-389
assets/asset_manager.cc
assets/asset_manager.cc
+2
-2
assets/asset_manager.h
assets/asset_manager.h
+2
-2
assets/directory_asset_bundle.cc
assets/directory_asset_bundle.cc
+2
-2
assets/directory_asset_bundle.h
assets/directory_asset_bundle.h
+2
-2
assets/zip_asset_store.cc
assets/zip_asset_store.cc
+2
-2
assets/zip_asset_store.h
assets/zip_asset_store.h
+2
-2
lib/ui/compositing/scene_host.cc
lib/ui/compositing/scene_host.cc
+4
-4
lib/ui/painting/rrect.cc
lib/ui/painting/rrect.cc
+4
-4
lib/ui/text/asset_manager_font_provider.cc
lib/ui/text/asset_manager_font_provider.cc
+2
-2
lib/ui/text/asset_manager_font_provider.h
lib/ui/text/asset_manager_font_provider.h
+3
-5
lib/ui/text/paragraph_impl_txt.cc
lib/ui/text/paragraph_impl_txt.cc
+1
-2
lib/ui/text/text_box.cc
lib/ui/text/text_box.cc
+3
-2
lib/ui/window/window.h
lib/ui/window/window.h
+1
-1
runtime/dart_isolate.cc
runtime/dart_isolate.cc
+4
-5
runtime/dart_isolate_unittests.cc
runtime/dart_isolate_unittests.cc
+3
-3
runtime/dart_vm.cc
runtime/dart_vm.cc
+8
-9
runtime/embedder_resources.cc
runtime/embedder_resources.cc
+1
-1
runtime/embedder_resources.h
runtime/embedder_resources.h
+3
-3
runtime/runtime_controller.h
runtime/runtime_controller.h
+7
-7
runtime/runtime_delegate.h
runtime/runtime_delegate.h
+2
-3
shell/common/animator.cc
shell/common/animator.cc
+1
-1
shell/common/animator.h
shell/common/animator.h
+5
-5
shell/common/engine.cc
shell/common/engine.cc
+27
-32
shell/common/engine.h
shell/common/engine.h
+36
-40
shell/common/isolate_configuration.cc
shell/common/isolate_configuration.cc
+11
-11
shell/common/isolate_configuration.h
shell/common/isolate_configuration.h
+4
-4
shell/common/persistent_cache.cc
shell/common/persistent_cache.cc
+5
-6
shell/common/platform_view.cc
shell/common/platform_view.cc
+8
-11
shell/common/platform_view.h
shell/common/platform_view.h
+13
-16
shell/common/rasterizer.cc
shell/common/rasterizer.cc
+6
-8
shell/common/rasterizer.h
shell/common/rasterizer.h
+7
-7
shell/common/run_configuration.cc
shell/common/run_configuration.cc
+8
-9
shell/common/run_configuration.h
shell/common/run_configuration.h
+5
-5
shell/common/shell.cc
shell/common/shell.cc
+65
-73
shell/common/shell.h
shell/common/shell.h
+43
-46
shell/common/shell_benchmarks.cc
shell/common/shell_benchmarks.cc
+6
-6
shell/common/shell_test.cc
shell/common/shell_test.cc
+6
-6
shell/common/shell_test.h
shell/common/shell_test.h
+3
-3
shell/common/shell_unittests.cc
shell/common/shell_unittests.cc
+22
-24
shell/common/switches.cc
shell/common/switches.cc
+5
-7
shell/common/switches.h
shell/common/switches.h
+1
-1
shell/common/vsync_waiter.cc
shell/common/vsync_waiter.cc
+1
-1
shell/common/vsync_waiter.h
shell/common/vsync_waiter.h
+2
-2
shell/common/vsync_waiter_fallback.cc
shell/common/vsync_waiter_fallback.cc
+1
-1
shell/common/vsync_waiter_fallback.h
shell/common/vsync_waiter_fallback.h
+1
-1
未找到文件。
assets/asset_manager.cc
浏览文件 @
39e1d00f
...
...
@@ -29,7 +29,7 @@ void AssetManager::PushBack(std::unique_ptr<AssetResolver> resolver) {
resolvers_
.
push_back
(
std
::
move
(
resolver
));
}
// |
flutter::
AssetResolver|
// |AssetResolver|
std
::
unique_ptr
<
fml
::
Mapping
>
AssetManager
::
GetAsMapping
(
const
std
::
string
&
asset_name
)
const
{
if
(
asset_name
.
size
()
==
0
)
{
...
...
@@ -47,7 +47,7 @@ std::unique_ptr<fml::Mapping> AssetManager::GetAsMapping(
return
nullptr
;
}
// |
flutter::
AssetResolver|
// |AssetResolver|
bool
AssetManager
::
IsValid
()
const
{
return
resolvers_
.
size
()
>
0
;
}
...
...
assets/asset_manager.h
浏览文件 @
39e1d00f
...
...
@@ -25,10 +25,10 @@ class AssetManager final : public AssetResolver {
void
PushBack
(
std
::
unique_ptr
<
AssetResolver
>
resolver
);
// |
flutter::
AssetResolver|
// |AssetResolver|
bool
IsValid
()
const
override
;
// |
flutter::
AssetResolver|
// |AssetResolver|
std
::
unique_ptr
<
fml
::
Mapping
>
GetAsMapping
(
const
std
::
string
&
asset_name
)
const
override
;
...
...
assets/directory_asset_bundle.cc
浏览文件 @
39e1d00f
...
...
@@ -22,12 +22,12 @@ DirectoryAssetBundle::DirectoryAssetBundle(fml::UniqueFD descriptor)
DirectoryAssetBundle
::~
DirectoryAssetBundle
()
=
default
;
// |
flutter::
AssetResolver|
// |AssetResolver|
bool
DirectoryAssetBundle
::
IsValid
()
const
{
return
is_valid_
;
}
// |
flutter::
AssetResolver|
// |AssetResolver|
std
::
unique_ptr
<
fml
::
Mapping
>
DirectoryAssetBundle
::
GetAsMapping
(
const
std
::
string
&
asset_name
)
const
{
if
(
!
is_valid_
)
{
...
...
assets/directory_asset_bundle.h
浏览文件 @
39e1d00f
...
...
@@ -22,10 +22,10 @@ class DirectoryAssetBundle : public AssetResolver {
const
fml
::
UniqueFD
descriptor_
;
bool
is_valid_
=
false
;
// |
flutter::
AssetResolver|
// |AssetResolver|
bool
IsValid
()
const
override
;
// |
flutter::
AssetResolver|
// |AssetResolver|
std
::
unique_ptr
<
fml
::
Mapping
>
GetAsMapping
(
const
std
::
string
&
asset_name
)
const
override
;
...
...
assets/zip_asset_store.cc
浏览文件 @
39e1d00f
...
...
@@ -33,12 +33,12 @@ UniqueUnzipper ZipAssetStore::CreateUnzipper() const {
return
UniqueUnzipper
{
::
unzOpen2
(
file_path_
.
c_str
(),
nullptr
)};
}
// |
flutter::
AssetResolver|
// |AssetResolver|
bool
ZipAssetStore
::
IsValid
()
const
{
return
stat_cache_
.
size
()
>
0
;
}
// |
flutter::
AssetResolver|
// |AssetResolver|
std
::
unique_ptr
<
fml
::
Mapping
>
ZipAssetStore
::
GetAsMapping
(
const
std
::
string
&
asset_name
)
const
{
TRACE_EVENT1
(
"flutter"
,
"ZipAssetStore::GetAsMapping"
,
"name"
,
...
...
assets/zip_asset_store.h
浏览文件 @
39e1d00f
...
...
@@ -40,10 +40,10 @@ class ZipAssetStore final : public AssetResolver {
mutable
std
::
map
<
std
::
string
,
CacheEntry
>
stat_cache_
;
// |
flutter::
AssetResolver|
// |AssetResolver|
bool
IsValid
()
const
override
;
// |
flutter::
AssetResolver|
// |AssetResolver|
std
::
unique_ptr
<
fml
::
Mapping
>
GetAsMapping
(
const
std
::
string
&
asset_name
)
const
override
;
...
...
lib/ui/compositing/scene_host.cc
浏览文件 @
39e1d00f
...
...
@@ -18,14 +18,14 @@
namespace
{
using
SceneHostBindings
=
std
::
unordered_map
<
zx_koid_t
,
flutter
::
SceneHost
*>
;
using
SceneHostBindings
=
std
::
unordered_map
<
zx_koid_t
,
SceneHost
*>
;
FML_THREAD_LOCAL
fml
::
ThreadLocal
tls_scene_host_bindings
([](
intptr_t
value
)
{
delete
reinterpret_cast
<
SceneHostBindings
*>
(
value
);
});
void
SceneHost_constructor
(
Dart_NativeArguments
args
)
{
tonic
::
DartCallConstructor
(
&
flutter
::
SceneHost
::
Create
,
args
);
tonic
::
DartCallConstructor
(
&
SceneHost
::
Create
,
args
);
}
void
SceneHost_constructorViewHolderToken
(
Dart_NativeArguments
args
)
{
...
...
@@ -36,10 +36,10 @@ void SceneHost_constructorViewHolderToken(Dart_NativeArguments args) {
reinterpret_cast
<
intptr_t
>
(
new
SceneHostBindings
()));
}
tonic
::
DartCallConstructor
(
&
flutter
::
SceneHost
::
CreateViewHolder
,
args
);
tonic
::
DartCallConstructor
(
&
SceneHost
::
CreateViewHolder
,
args
);
}
flutter
::
SceneHost
*
GetSceneHost
(
scenic
::
ResourceId
id
)
{
SceneHost
*
GetSceneHost
(
scenic
::
ResourceId
id
)
{
auto
*
bindings
=
reinterpret_cast
<
SceneHostBindings
*>
(
tls_scene_host_bindings
.
Get
());
FML_DCHECK
(
bindings
);
...
...
lib/ui/painting/rrect.cc
浏览文件 @
39e1d00f
...
...
@@ -15,7 +15,7 @@ namespace tonic {
// Construct an SkRRect from a Dart RRect object.
// The Dart RRect is a Float32List containing
// [left, top, right, bottom, xRadius, yRadius]
RRect
DartConverter
<
RRect
>::
FromDart
(
Dart_Handle
value
)
{
RRect
DartConverter
<
flutter
::
RRect
>::
FromDart
(
Dart_Handle
value
)
{
Float32List
buffer
(
value
);
RRect
result
;
...
...
@@ -35,7 +35,7 @@ RRect DartConverter<RRect>::FromDart(Dart_Handle value) {
return
result
;
}
RRect
DartConverter
<
RRect
>::
FromArguments
(
Dart_NativeArguments
args
,
RRect
DartConverter
<
flutter
::
RRect
>::
FromArguments
(
Dart_NativeArguments
args
,
int
index
,
Dart_Handle
&
exception
)
{
Dart_Handle
value
=
Dart_GetNativeArgument
(
args
,
index
);
...
...
lib/ui/text/asset_manager_font_provider.cc
浏览文件 @
39e1d00f
...
...
@@ -21,7 +21,7 @@ void MappingReleaseProc(const void* ptr, void* context) {
}
// anonymous namespace
AssetManagerFontProvider
::
AssetManagerFontProvider
(
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
)
std
::
shared_ptr
<
AssetManager
>
asset_manager
)
:
asset_manager_
(
asset_manager
)
{}
AssetManagerFontProvider
::~
AssetManagerFontProvider
()
=
default
;
...
...
@@ -65,7 +65,7 @@ void AssetManagerFontProvider::RegisterAsset(std::string family_name,
}
AssetManagerFontStyleSet
::
AssetManagerFontStyleSet
(
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
)
std
::
shared_ptr
<
AssetManager
>
asset_manager
)
:
asset_manager_
(
asset_manager
)
{}
AssetManagerFontStyleSet
::~
AssetManagerFontStyleSet
()
=
default
;
...
...
lib/ui/text/asset_manager_font_provider.h
浏览文件 @
39e1d00f
...
...
@@ -20,8 +20,7 @@ namespace flutter {
class
AssetManagerFontStyleSet
:
public
SkFontStyleSet
{
public:
AssetManagerFontStyleSet
(
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
);
AssetManagerFontStyleSet
(
std
::
shared_ptr
<
AssetManager
>
asset_manager
);
~
AssetManagerFontStyleSet
()
override
;
...
...
@@ -40,7 +39,7 @@ class AssetManagerFontStyleSet : public SkFontStyleSet {
SkTypeface
*
matchStyle
(
const
SkFontStyle
&
pattern
)
override
;
private:
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager_
;
std
::
shared_ptr
<
AssetManager
>
asset_manager_
;
struct
TypefaceAsset
{
TypefaceAsset
(
std
::
string
a
);
...
...
@@ -59,8 +58,7 @@ class AssetManagerFontStyleSet : public SkFontStyleSet {
class
AssetManagerFontProvider
:
public
txt
::
FontAssetProvider
{
public:
AssetManagerFontProvider
(
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
);
AssetManagerFontProvider
(
std
::
shared_ptr
<
AssetManager
>
asset_manager
);
~
AssetManagerFontProvider
()
override
;
...
...
lib/ui/text/paragraph_impl_txt.cc
浏览文件 @
39e1d00f
...
...
@@ -70,8 +70,7 @@ std::vector<TextBox> ParagraphImplTxt::getRectsForRange(
std
::
vector
<
txt
::
Paragraph
::
TextBox
>
boxes
=
m_paragraph
->
GetRectsForRange
(
start
,
end
,
rect_height_style
,
rect_width_style
);
for
(
const
txt
::
Paragraph
::
TextBox
&
box
:
boxes
)
{
result
.
emplace_back
(
box
.
rect
,
static_cast
<
flutter
::
TextDirection
>
(
box
.
direction
));
result
.
emplace_back
(
box
.
rect
,
static_cast
<
TextDirection
>
(
box
.
direction
));
}
return
result
;
}
...
...
lib/ui/text/text_box.cc
浏览文件 @
39e1d00f
...
...
@@ -25,7 +25,8 @@ Dart_Handle GetTextBoxType() {
}
// anonymous namespace
Dart_Handle
DartConverter
<
TextBox
>::
ToDart
(
const
TextBox
&
val
)
{
Dart_Handle
DartConverter
<
flutter
::
TextBox
>::
ToDart
(
const
flutter
::
TextBox
&
val
)
{
constexpr
int
argc
=
5
;
Dart_Handle
argv
[
argc
]
=
{
tonic
::
ToDart
(
val
.
rect
.
fLeft
),
...
...
@@ -37,7 +38,7 @@ Dart_Handle DartConverter<TextBox>::ToDart(const TextBox& val) {
return
Dart_New
(
GetTextBoxType
(),
tonic
::
ToDart
(
"_"
),
argc
,
argv
);
}
Dart_Handle
DartListFactory
<
TextBox
>::
NewList
(
intptr_t
length
)
{
Dart_Handle
DartListFactory
<
flutter
::
TextBox
>::
NewList
(
intptr_t
length
)
{
return
Dart_NewListOfType
(
GetTextBoxType
(),
length
);
}
...
...
lib/ui/window/window.h
浏览文件 @
39e1d00f
...
...
@@ -88,7 +88,7 @@ class Window final {
// We use id 0 to mean that no response is expected.
int
next_response_id_
=
1
;
std
::
unordered_map
<
int
,
fml
::
RefPtr
<
flutter
::
PlatformMessageResponse
>>
std
::
unordered_map
<
int
,
fml
::
RefPtr
<
PlatformMessageResponse
>>
pending_responses_
;
};
...
...
runtime/dart_isolate.cc
浏览文件 @
39e1d00f
...
...
@@ -547,9 +547,8 @@ Dart_Isolate DartIsolate::DartCreateAndStartServiceIsolate(
return
nullptr
;
}
flutter
::
TaskRunners
null_task_runners
(
"io.flutter."
DART_VM_SERVICE_ISOLATE_NAME
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
TaskRunners
null_task_runners
(
"io.flutter."
DART_VM_SERVICE_ISOLATE_NAME
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
flags
->
load_vmservice_library
=
true
;
...
...
@@ -659,8 +658,8 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
if
(
!
is_root_isolate
)
{
auto
*
raw_embedder_isolate
=
embedder_isolate
.
release
();
flutter
::
TaskRunners
null_task_runners
(
advisory_script_uri
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
TaskRunners
null_task_runners
(
advisory_script_uri
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
embedder_isolate
=
std
::
make_unique
<
std
::
shared_ptr
<
DartIsolate
>>
(
std
::
make_shared
<
DartIsolate
>
(
...
...
runtime/dart_isolate_unittests.cc
浏览文件 @
39e1d00f
...
...
@@ -88,7 +88,7 @@ class AutoIsolateShutdown {
public:
AutoIsolateShutdown
()
=
default
;
AutoIsolateShutdown
(
std
::
shared_ptr
<
flutter
::
DartIsolate
>
isolate
,
AutoIsolateShutdown
(
std
::
shared_ptr
<
DartIsolate
>
isolate
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
runner
)
:
isolate_
(
std
::
move
(
isolate
)),
runner_
(
std
::
move
(
runner
))
{}
...
...
@@ -131,13 +131,13 @@ class AutoIsolateShutdown {
return
true
;
}
flutter
::
DartIsolate
*
get
()
{
DartIsolate
*
get
()
{
FML_CHECK
(
isolate_
);
return
isolate_
.
get
();
}
private:
std
::
shared_ptr
<
flutter
::
DartIsolate
>
isolate_
;
std
::
shared_ptr
<
DartIsolate
>
isolate_
;
fml
::
RefPtr
<
fml
::
TaskRunner
>
runner_
;
FML_DISALLOW_COPY_AND_ASSIGN
(
AutoIsolateShutdown
);
...
...
runtime/dart_vm.cc
浏览文件 @
39e1d00f
...
...
@@ -385,11 +385,10 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
// the very first frame gives us a good idea about Flutter's startup time.
// Use a duration event so about:tracing will consider this event when
// deciding the earliest event to use as time 0.
if
(
flutter
::
engine_main_enter_ts
!=
0
)
{
Dart_TimelineEvent
(
"FlutterEngineMainEnter"
,
// label
flutter
::
engine_main_enter_ts
,
// timestamp0
flutter
::
engine_main_enter_ts
,
// timestamp1_or_async_id
if
(
engine_main_enter_ts
!=
0
)
{
Dart_TimelineEvent
(
"FlutterEngineMainEnter"
,
// label
engine_main_enter_ts
,
// timestamp0
engine_main_enter_ts
,
// timestamp1_or_async_id
Dart_Timeline_Event_Duration
,
// event type
0
,
// argument_count
nullptr
,
// argument_names
...
...
runtime/embedder_resources.cc
浏览文件 @
39e1d00f
...
...
@@ -10,7 +10,7 @@
namespace
flutter
{
using
flutter
::
runtime
::
ResourcesEntry
;
using
runtime
::
ResourcesEntry
;
EmbedderResources
::
EmbedderResources
(
ResourcesEntry
*
resources_table
)
:
resources_table_
(
resources_table
)
{}
...
...
runtime/embedder_resources.h
浏览文件 @
39e1d00f
...
...
@@ -21,7 +21,7 @@ namespace flutter {
class
EmbedderResources
{
public:
EmbedderResources
(
flutter
::
runtime
::
ResourcesEntry
*
resources_table
);
EmbedderResources
(
runtime
::
ResourcesEntry
*
resources_table
);
static
const
int
kNoSuchInstance
;
...
...
@@ -29,9 +29,9 @@ class EmbedderResources {
const
char
*
Path
(
int
idx
);
private:
flutter
::
runtime
::
ResourcesEntry
*
At
(
int
idx
);
runtime
::
ResourcesEntry
*
At
(
int
idx
);
flutter
::
runtime
::
ResourcesEntry
*
resources_table_
;
runtime
::
ResourcesEntry
*
resources_table_
;
};
}
// namespace flutter
...
...
runtime/runtime_controller.h
浏览文件 @
39e1d00f
...
...
@@ -149,25 +149,25 @@ class RuntimeController final : public WindowClient {
bool
FlushRuntimeStateToIsolate
();
// |
flutter::
WindowClient|
// |WindowClient|
std
::
string
DefaultRouteName
()
override
;
// |
flutter::
WindowClient|
// |WindowClient|
void
ScheduleFrame
()
override
;
// |
flutter::
WindowClient|
// |WindowClient|
void
Render
(
Scene
*
scene
)
override
;
// |
flutter::
WindowClient|
// |WindowClient|
void
UpdateSemantics
(
SemanticsUpdate
*
update
)
override
;
// |
flutter::
WindowClient|
// |WindowClient|
void
HandlePlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
override
;
// |
flutter::
WindowClient|
// |WindowClient|
FontCollection
&
GetFontCollection
()
override
;
// |
flutter::
WindowClient|
// |WindowClient|
void
UpdateIsolateDescription
(
const
std
::
string
isolate_name
,
int64_t
isolate_port
)
override
;
...
...
runtime/runtime_delegate.h
浏览文件 @
39e1d00f
...
...
@@ -25,9 +25,8 @@ class RuntimeDelegate {
virtual
void
Render
(
std
::
unique_ptr
<
flow
::
LayerTree
>
layer_tree
)
=
0
;
virtual
void
UpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
=
0
;
virtual
void
UpdateSemantics
(
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
=
0
;
virtual
void
HandlePlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
=
0
;
...
...
shell/common/animator.cc
浏览文件 @
39e1d00f
...
...
@@ -20,7 +20,7 @@ constexpr fml::TimeDelta kNotifyIdleTaskWaitTime =
}
// namespace
Animator
::
Animator
(
Delegate
&
delegate
,
flutter
::
TaskRunners
task_runners
,
TaskRunners
task_runners
,
std
::
unique_ptr
<
VsyncWaiter
>
waiter
)
:
delegate_
(
delegate
),
task_runners_
(
std
::
move
(
task_runners
)),
...
...
shell/common/animator.h
浏览文件 @
39e1d00f
...
...
@@ -27,13 +27,13 @@ class Animator final {
virtual
void
OnAnimatorNotifyIdle
(
int64_t
deadline
)
=
0
;
virtual
void
OnAnimatorDraw
(
fml
::
RefPtr
<
flutter
::
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
=
0
;
fml
::
RefPtr
<
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
=
0
;
virtual
void
OnAnimatorDrawLastLayerTree
()
=
0
;
};
Animator
(
Delegate
&
delegate
,
flutter
::
TaskRunners
task_runners
,
TaskRunners
task_runners
,
std
::
unique_ptr
<
VsyncWaiter
>
waiter
);
~
Animator
();
...
...
@@ -55,7 +55,7 @@ class Animator final {
void
EnqueueTraceFlowId
(
uint64_t
trace_flow_id
);
private:
using
LayerTreePipeline
=
flutter
::
Pipeline
<
flow
::
LayerTree
>
;
using
LayerTreePipeline
=
Pipeline
<
flow
::
LayerTree
>
;
void
BeginFrame
(
fml
::
TimePoint
frame_start_time
,
fml
::
TimePoint
frame_target_time
);
...
...
@@ -68,13 +68,13 @@ class Animator final {
const
char
*
FrameParity
();
Delegate
&
delegate_
;
flutter
::
TaskRunners
task_runners_
;
TaskRunners
task_runners_
;
std
::
shared_ptr
<
VsyncWaiter
>
waiter_
;
fml
::
TimePoint
last_begin_frame_time_
;
int64_t
dart_frame_deadline_
;
fml
::
RefPtr
<
LayerTreePipeline
>
layer_tree_pipeline_
;
flutter
::
Semaphore
pending_frame_semaphore_
;
Semaphore
pending_frame_semaphore_
;
LayerTreePipeline
::
ProducerContinuation
producer_continuation_
;
int64_t
frame_number_
;
bool
paused_
;
...
...
shell/common/engine.cc
浏览文件 @
39e1d00f
...
...
@@ -36,14 +36,14 @@ static constexpr char kLocalizationChannel[] = "flutter/localization";
static
constexpr
char
kSettingsChannel
[]
=
"flutter/settings"
;
Engine
::
Engine
(
Delegate
&
delegate
,
flutter
::
DartVM
&
vm
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
shared_snapshot
,
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
DartVM
&
vm
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
Settings
settings
,
std
::
unique_ptr
<
Animator
>
animator
,
fml
::
WeakPtr
<
flutter
::
SnapshotDelegate
>
snapshot_delegate
,
fml
::
WeakPtr
<
flutter
::
IOManager
>
io_manager
)
fml
::
WeakPtr
<
SnapshotDelegate
>
snapshot_delegate
,
fml
::
WeakPtr
<
IOManager
>
io_manager
)
:
delegate_
(
delegate
),
settings_
(
std
::
move
(
settings
)),
animator_
(
std
::
move
(
animator
)),
...
...
@@ -53,7 +53,7 @@ Engine::Engine(Delegate& delegate,
// Runtime controller is initialized here because it takes a reference to this
// object as its delegate. The delegate may be called in the constructor and
// we want to be fully initilazed by that point.
runtime_controller_
=
std
::
make_unique
<
flutter
::
RuntimeController
>
(
runtime_controller_
=
std
::
make_unique
<
RuntimeController
>
(
*
this
,
// runtime delegate
&
vm
,
// VM
std
::
move
(
isolate_snapshot
),
// isolate snapshot
...
...
@@ -78,7 +78,7 @@ fml::WeakPtr<Engine> Engine::GetWeakPtr() const {
}
bool
Engine
::
UpdateAssetManager
(
std
::
shared_ptr
<
flutter
::
AssetManager
>
new_asset_manager
)
{
std
::
shared_ptr
<
AssetManager
>
new_asset_manager
)
{
if
(
asset_manager_
==
new_asset_manager
)
{
return
false
;
}
...
...
@@ -127,11 +127,11 @@ Engine::RunStatus Engine::Run(RunConfiguration configuration) {
return
isolate_launch_status
;
}
std
::
shared_ptr
<
flutter
::
DartIsolate
>
isolate
=
std
::
shared_ptr
<
DartIsolate
>
isolate
=
runtime_controller_
->
GetRootIsolate
().
lock
();
bool
isolate_running
=
isolate
&&
isolate
->
GetPhase
()
==
flutter
::
DartIsolate
::
Phase
::
Running
;
isolate
&&
isolate
->
GetPhase
()
==
DartIsolate
::
Phase
::
Running
;
if
(
isolate_running
)
{
tonic
::
DartState
::
Scope
scope
(
isolate
.
get
());
...
...
@@ -158,7 +158,7 @@ Engine::RunStatus Engine::PrepareAndLaunchIsolate(
auto
isolate_configuration
=
configuration
.
TakeIsolateConfiguration
();
std
::
shared_ptr
<
flutter
::
DartIsolate
>
isolate
=
std
::
shared_ptr
<
DartIsolate
>
isolate
=
runtime_controller_
->
GetRootIsolate
().
lock
();
if
(
!
isolate
)
{
...
...
@@ -167,7 +167,7 @@ Engine::RunStatus Engine::PrepareAndLaunchIsolate(
// This can happen on iOS after a plugin shows a native window and returns to
// the Flutter ViewController.
if
(
isolate
->
GetPhase
()
==
flutter
::
DartIsolate
::
Phase
::
Running
)
{
if
(
isolate
->
GetPhase
()
==
DartIsolate
::
Phase
::
Running
)
{
FML_DLOG
(
WARNING
)
<<
"Isolate was already running!"
;
return
RunStatus
::
FailureAlreadyRunning
;
}
...
...
@@ -235,7 +235,7 @@ void Engine::OnOutputSurfaceDestroyed() {
StopAnimator
();
}
void
Engine
::
SetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
)
{
void
Engine
::
SetViewportMetrics
(
const
ViewportMetrics
&
metrics
)
{
bool
dimensions_changed
=
viewport_metrics_
.
physical_height
!=
metrics
.
physical_height
||
viewport_metrics_
.
physical_width
!=
metrics
.
physical_width
;
...
...
@@ -249,8 +249,7 @@ void Engine::SetViewportMetrics(const flutter::ViewportMetrics& metrics) {
}
}
void
Engine
::
DispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
void
Engine
::
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
if
(
message
->
channel
()
==
kLifecycleChannel
)
{
if
(
HandleLifecyclePlatformMessage
(
message
.
get
()))
return
;
...
...
@@ -272,7 +271,7 @@ void Engine::DispatchPlatformMessage(
HandleNavigationPlatformMessage
(
std
::
move
(
message
));
}
bool
Engine
::
HandleLifecyclePlatformMessage
(
flutter
::
PlatformMessage
*
message
)
{
bool
Engine
::
HandleLifecyclePlatformMessage
(
PlatformMessage
*
message
)
{
const
auto
&
data
=
message
->
data
();
std
::
string
state
(
reinterpret_cast
<
const
char
*>
(
data
.
data
()),
data
.
size
());
if
(
state
==
"AppLifecycleState.paused"
||
...
...
@@ -297,7 +296,7 @@ bool Engine::HandleLifecyclePlatformMessage(flutter::PlatformMessage* message) {
}
bool
Engine
::
HandleNavigationPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
const
auto
&
data
=
message
->
data
();
rapidjson
::
Document
document
;
...
...
@@ -313,8 +312,7 @@ bool Engine::HandleNavigationPlatformMessage(
return
true
;
}
bool
Engine
::
HandleLocalizationPlatformMessage
(
flutter
::
PlatformMessage
*
message
)
{
bool
Engine
::
HandleLocalizationPlatformMessage
(
PlatformMessage
*
message
)
{
const
auto
&
data
=
message
->
data
();
rapidjson
::
Document
document
;
...
...
@@ -348,7 +346,7 @@ bool Engine::HandleLocalizationPlatformMessage(
return
runtime_controller_
->
SetLocales
(
locale_data
);
}
void
Engine
::
HandleSettingsPlatformMessage
(
flutter
::
PlatformMessage
*
message
)
{
void
Engine
::
HandleSettingsPlatformMessage
(
PlatformMessage
*
message
)
{
const
auto
&
data
=
message
->
data
();
std
::
string
jsonData
(
reinterpret_cast
<
const
char
*>
(
data
.
data
()),
data
.
size
());
if
(
runtime_controller_
->
SetUserSettingsData
(
std
::
move
(
jsonData
))
&&
...
...
@@ -357,7 +355,7 @@ void Engine::HandleSettingsPlatformMessage(flutter::PlatformMessage* message) {
}
}
void
Engine
::
DispatchPointerDataPacket
(
const
flutter
::
PointerDataPacket
&
packet
,
void
Engine
::
DispatchPointerDataPacket
(
const
PointerDataPacket
&
packet
,
uint64_t
trace_flow_id
)
{
TRACE_EVENT0
(
"flutter"
,
"Engine::DispatchPointerDataPacket"
);
TRACE_FLOW_STEP
(
"flutter"
,
"PointerEvent"
,
trace_flow_id
);
...
...
@@ -366,7 +364,7 @@ void Engine::DispatchPointerDataPacket(const flutter::PointerDataPacket& packet,
}
void
Engine
::
DispatchSemanticsAction
(
int
id
,
flutter
::
SemanticsAction
action
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
)
{
runtime_controller_
->
DispatchSemanticsAction
(
id
,
action
,
std
::
move
(
args
));
}
...
...
@@ -412,14 +410,12 @@ void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
animator_
->
Render
(
std
::
move
(
layer_tree
));
}
void
Engine
::
UpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
{
void
Engine
::
UpdateSemantics
(
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
{
delegate_
.
OnEngineUpdateSemantics
(
std
::
move
(
update
),
std
::
move
(
actions
));
}
void
Engine
::
HandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
void
Engine
::
HandlePlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
if
(
message
->
channel
()
==
kAssetChannel
)
{
HandleAssetPlatformMessage
(
std
::
move
(
message
));
}
else
{
...
...
@@ -432,13 +428,12 @@ void Engine::UpdateIsolateDescription(const std::string isolate_name,
delegate_
.
UpdateIsolateDescription
(
isolate_name
,
isolate_port
);
}
flutter
::
FontCollection
&
Engine
::
GetFontCollection
()
{
FontCollection
&
Engine
::
GetFontCollection
()
{
return
font_collection_
;
}
void
Engine
::
HandleAssetPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
fml
::
RefPtr
<
flutter
::
PlatformMessageResponse
>
response
=
message
->
response
();
void
Engine
::
HandleAssetPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
fml
::
RefPtr
<
PlatformMessageResponse
>
response
=
message
->
response
();
if
(
!
response
)
{
return
;
}
...
...
shell/common/engine.h
浏览文件 @
39e1d00f
...
...
@@ -29,7 +29,7 @@
namespace
flutter
{
class
Engine
final
:
public
flutter
::
RuntimeDelegate
{
class
Engine
final
:
public
RuntimeDelegate
{
public:
// Used by Engine::Run
enum
class
RunStatus
{
...
...
@@ -42,11 +42,11 @@ class Engine final : public flutter::RuntimeDelegate {
class
Delegate
{
public:
virtual
void
OnEngineUpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
=
0
;
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
=
0
;
virtual
void
OnEngineHandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
=
0
;
fml
::
RefPtr
<
PlatformMessage
>
message
)
=
0
;
virtual
void
OnPreEngineRestart
()
=
0
;
...
...
@@ -55,14 +55,14 @@ class Engine final : public flutter::RuntimeDelegate {
};
Engine
(
Delegate
&
delegate
,
flutter
::
DartVM
&
vm
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
shared_snapshot
,
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
DartVM
&
vm
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
Settings
settings
,
std
::
unique_ptr
<
Animator
>
animator
,
fml
::
WeakPtr
<
flutter
::
SnapshotDelegate
>
snapshot_delegate
,
fml
::
WeakPtr
<
flutter
::
IOManager
>
io_manager
);
fml
::
WeakPtr
<
SnapshotDelegate
>
snapshot_delegate
,
fml
::
WeakPtr
<
IOManager
>
io_manager
);
~
Engine
()
override
;
...
...
@@ -80,7 +80,7 @@ class Engine final : public flutter::RuntimeDelegate {
FML_WARN_UNUSED_RESULT
bool
Restart
(
RunConfiguration
configuration
);
bool
UpdateAssetManager
(
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
);
bool
UpdateAssetManager
(
std
::
shared_ptr
<
AssetManager
>
asset_manager
);
void
BeginFrame
(
fml
::
TimePoint
frame_time
);
...
...
@@ -100,15 +100,15 @@ class Engine final : public flutter::RuntimeDelegate {
void
OnOutputSurfaceDestroyed
();
void
SetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
);
void
SetViewportMetrics
(
const
ViewportMetrics
&
metrics
);
void
DispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
);
void
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
void
DispatchPointerDataPacket
(
const
flutter
::
PointerDataPacket
&
packet
,
void
DispatchPointerDataPacket
(
const
PointerDataPacket
&
packet
,
uint64_t
trace_flow_id
);
void
DispatchSemanticsAction
(
int
id
,
flutter
::
SemanticsAction
action
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
);
void
SetSemanticsEnabled
(
bool
enabled
);
...
...
@@ -117,38 +117,36 @@ class Engine final : public flutter::RuntimeDelegate {
void
ScheduleFrame
(
bool
regenerate_layer_tree
=
true
)
override
;
// |
flutter::
RuntimeDelegate|
flutter
::
FontCollection
&
GetFontCollection
()
override
;
// |RuntimeDelegate|
FontCollection
&
GetFontCollection
()
override
;
private:
Engine
::
Delegate
&
delegate_
;
const
flutter
::
Settings
settings_
;
const
Settings
settings_
;
std
::
unique_ptr
<
Animator
>
animator_
;
std
::
unique_ptr
<
flutter
::
RuntimeController
>
runtime_controller_
;
std
::
unique_ptr
<
RuntimeController
>
runtime_controller_
;
std
::
string
initial_route_
;
flutter
::
ViewportMetrics
viewport_metrics_
;
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager_
;
ViewportMetrics
viewport_metrics_
;
std
::
shared_ptr
<
AssetManager
>
asset_manager_
;
bool
activity_running_
;
bool
have_surface_
;
flutter
::
FontCollection
font_collection_
;
FontCollection
font_collection_
;
fml
::
WeakPtrFactory
<
Engine
>
weak_factory_
;
// |
flutter::
RuntimeDelegate|
// |RuntimeDelegate|
std
::
string
DefaultRouteName
()
override
;
// |
flutter::
RuntimeDelegate|
// |RuntimeDelegate|
void
Render
(
std
::
unique_ptr
<
flow
::
LayerTree
>
layer_tree
)
override
;
// |flutter::RuntimeDelegate|
void
UpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
override
;
// |RuntimeDelegate|
void
UpdateSemantics
(
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
override
;
// |flutter::RuntimeDelegate|
void
HandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
override
;
// |RuntimeDelegate|
void
HandlePlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
override
;
// |
flutter::
RuntimeDelegate|
// |RuntimeDelegate|
void
UpdateIsolateDescription
(
const
std
::
string
isolate_name
,
int64_t
isolate_port
)
override
;
...
...
@@ -156,17 +154,15 @@ class Engine final : public flutter::RuntimeDelegate {
void
StartAnimatorIfPossible
();
bool
HandleLifecyclePlatformMessage
(
flutter
::
PlatformMessage
*
message
);
bool
HandleLifecyclePlatformMessage
(
PlatformMessage
*
message
);
bool
HandleNavigationPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
);
bool
HandleNavigationPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
bool
HandleLocalizationPlatformMessage
(
flutter
::
PlatformMessage
*
message
);
bool
HandleLocalizationPlatformMessage
(
PlatformMessage
*
message
);
void
HandleSettingsPlatformMessage
(
flutter
::
PlatformMessage
*
message
);
void
HandleSettingsPlatformMessage
(
PlatformMessage
*
message
);
void
HandleAssetPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
);
void
HandleAssetPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
bool
GetAssetAsBuffer
(
const
std
::
string
&
name
,
std
::
vector
<
uint8_t
>*
data
);
...
...
shell/common/isolate_configuration.cc
浏览文件 @
39e1d00f
...
...
@@ -13,8 +13,8 @@ IsolateConfiguration::IsolateConfiguration() = default;
IsolateConfiguration
::~
IsolateConfiguration
()
=
default
;
bool
IsolateConfiguration
::
PrepareIsolate
(
flutter
::
DartIsolate
&
isolate
)
{
if
(
isolate
.
GetPhase
()
!=
flutter
::
DartIsolate
::
Phase
::
LibrariesSetup
)
{
bool
IsolateConfiguration
::
PrepareIsolate
(
DartIsolate
&
isolate
)
{
if
(
isolate
.
GetPhase
()
!=
DartIsolate
::
Phase
::
LibrariesSetup
)
{
FML_DLOG
(
ERROR
)
<<
"Isolate was in incorrect phase to be prepared for running."
;
return
false
;
...
...
@@ -28,7 +28,7 @@ class AppSnapshotIsolateConfiguration final : public IsolateConfiguration {
AppSnapshotIsolateConfiguration
()
=
default
;
// |IsolateConfiguration|
bool
DoPrepareIsolate
(
flutter
::
DartIsolate
&
isolate
)
override
{
bool
DoPrepareIsolate
(
DartIsolate
&
isolate
)
override
{
return
isolate
.
PrepareForRunningFromPrecompiledCode
();
}
...
...
@@ -42,8 +42,8 @@ class KernelIsolateConfiguration : public IsolateConfiguration {
:
kernel_
(
std
::
move
(
kernel
))
{}
// |IsolateConfiguration|
bool
DoPrepareIsolate
(
flutter
::
DartIsolate
&
isolate
)
override
{
if
(
flutter
::
DartVM
::
IsRunningPrecompiledCode
())
{
bool
DoPrepareIsolate
(
DartIsolate
&
isolate
)
override
{
if
(
DartVM
::
IsRunningPrecompiledCode
())
{
return
false
;
}
return
isolate
.
PrepareForRunningFromKernel
(
std
::
move
(
kernel_
));
...
...
@@ -63,8 +63,8 @@ class KernelListIsolateConfiguration final : public IsolateConfiguration {
:
kernel_pieces_
(
std
::
move
(
kernel_pieces
))
{}
// |IsolateConfiguration|
bool
DoPrepareIsolate
(
flutter
::
DartIsolate
&
isolate
)
override
{
if
(
flutter
::
DartVM
::
IsRunningPrecompiledCode
())
{
bool
DoPrepareIsolate
(
DartIsolate
&
isolate
)
override
{
if
(
DartVM
::
IsRunningPrecompiledCode
())
{
return
false
;
}
...
...
@@ -115,7 +115,7 @@ static std::vector<std::string> ParseKernelListPaths(
static
std
::
vector
<
std
::
future
<
std
::
unique_ptr
<
const
fml
::
Mapping
>>>
PrepareKernelMappings
(
std
::
vector
<
std
::
string
>
kernel_pieces_paths
,
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
,
std
::
shared_ptr
<
AssetManager
>
asset_manager
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
io_worker
)
{
FML_DCHECK
(
asset_manager
);
std
::
vector
<
std
::
future
<
std
::
unique_ptr
<
const
fml
::
Mapping
>>>
fetch_futures
;
...
...
@@ -142,11 +142,11 @@ PrepareKernelMappings(std::vector<std::string> kernel_pieces_paths,
}
std
::
unique_ptr
<
IsolateConfiguration
>
IsolateConfiguration
::
InferFromSettings
(
const
flutter
::
Settings
&
settings
,
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
,
const
Settings
&
settings
,
std
::
shared_ptr
<
AssetManager
>
asset_manager
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
io_worker
)
{
// Running in AOT mode.
if
(
flutter
::
DartVM
::
IsRunningPrecompiledCode
())
{
if
(
DartVM
::
IsRunningPrecompiledCode
())
{
return
CreateForAppSnapshot
();
}
...
...
shell/common/isolate_configuration.h
浏览文件 @
39e1d00f
...
...
@@ -22,8 +22,8 @@ namespace flutter {
class
IsolateConfiguration
{
public:
static
std
::
unique_ptr
<
IsolateConfiguration
>
InferFromSettings
(
const
flutter
::
Settings
&
settings
,
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
,
const
Settings
&
settings
,
std
::
shared_ptr
<
AssetManager
>
asset_manager
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
io_worker
);
static
std
::
unique_ptr
<
IsolateConfiguration
>
CreateForAppSnapshot
();
...
...
@@ -42,10 +42,10 @@ class IsolateConfiguration {
virtual
~
IsolateConfiguration
();
bool
PrepareIsolate
(
flutter
::
DartIsolate
&
isolate
);
bool
PrepareIsolate
(
DartIsolate
&
isolate
);
protected:
virtual
bool
DoPrepareIsolate
(
flutter
::
DartIsolate
&
isolate
)
=
0
;
virtual
bool
DoPrepareIsolate
(
DartIsolate
&
isolate
)
=
0
;
private:
FML_DISALLOW_COPY_AND_ASSIGN
(
IsolateConfiguration
);
...
...
shell/common/persistent_cache.cc
浏览文件 @
39e1d00f
...
...
@@ -59,10 +59,9 @@ PersistentCache::PersistentCache(bool read_only) : is_read_only_(read_only) {
}
if
(
cache_base_dir
.
is_valid
())
{
cache_directory_
=
std
::
make_shared
<
fml
::
UniqueFD
>
(
CreateDirectory
(
cache_base_dir
,
{
"flutter_engine"
,
flutter
::
GetFlutterEngineVersion
(),
"skia"
,
flutter
::
GetSkiaVersion
()},
cache_directory_
=
std
::
make_shared
<
fml
::
UniqueFD
>
(
CreateDirectory
(
cache_base_dir
,
{
"flutter_engine"
,
GetFlutterEngineVersion
(),
"skia"
,
GetSkiaVersion
()},
read_only
?
fml
::
FilePermission
::
kRead
:
fml
::
FilePermission
::
kReadWrite
));
}
...
...
shell/common/platform_view.cc
浏览文件 @
39e1d00f
...
...
@@ -16,8 +16,7 @@
namespace
flutter
{
PlatformView
::
PlatformView
(
Delegate
&
delegate
,
flutter
::
TaskRunners
task_runners
)
PlatformView
::
PlatformView
(
Delegate
&
delegate
,
TaskRunners
task_runners
)
:
delegate_
(
delegate
),
task_runners_
(
std
::
move
(
task_runners
)),
size_
(
SkISize
::
Make
(
0
,
0
)),
...
...
@@ -33,17 +32,17 @@ std::unique_ptr<VsyncWaiter> PlatformView::CreateVSyncWaiter() {
}
void
PlatformView
::
DispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
delegate_
.
OnPlatformViewDispatchPlatformMessage
(
std
::
move
(
message
));
}
void
PlatformView
::
DispatchPointerDataPacket
(
std
::
unique_ptr
<
flutter
::
PointerDataPacket
>
packet
)
{
std
::
unique_ptr
<
PointerDataPacket
>
packet
)
{
delegate_
.
OnPlatformViewDispatchPointerDataPacket
(
std
::
move
(
packet
));
}
void
PlatformView
::
DispatchSemanticsAction
(
int32_t
id
,
flutter
::
SemanticsAction
action
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
)
{
delegate_
.
OnPlatformViewDispatchSemanticsAction
(
id
,
action
,
std
::
move
(
args
));
}
...
...
@@ -56,7 +55,7 @@ void PlatformView::SetAccessibilityFeatures(int32_t flags) {
delegate_
.
OnPlatformViewSetAccessibilityFeatures
(
flags
);
}
void
PlatformView
::
SetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
)
{
void
PlatformView
::
SetViewportMetrics
(
const
ViewportMetrics
&
metrics
)
{
delegate_
.
OnPlatformViewSetViewportMetrics
(
metrics
);
}
...
...
@@ -93,12 +92,10 @@ fml::WeakPtr<PlatformView> PlatformView::GetWeakPtr() const {
return
weak_factory_
.
GetWeakPtr
();
}
void
PlatformView
::
UpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
{}
void
PlatformView
::
UpdateSemantics
(
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
{}
void
PlatformView
::
HandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
void
PlatformView
::
HandlePlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
if
(
auto
response
=
message
->
response
())
response
->
CompleteEmpty
();
}
...
...
shell/common/platform_view.h
浏览文件 @
39e1d00f
...
...
@@ -36,17 +36,17 @@ class PlatformView {
virtual
void
OnPlatformViewSetNextFrameCallback
(
fml
::
closure
closure
)
=
0
;
virtual
void
OnPlatformViewSetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
)
=
0
;
const
ViewportMetrics
&
metrics
)
=
0
;
virtual
void
OnPlatformViewDispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
=
0
;
fml
::
RefPtr
<
PlatformMessage
>
message
)
=
0
;
virtual
void
OnPlatformViewDispatchPointerDataPacket
(
std
::
unique_ptr
<
flutter
::
PointerDataPacket
>
packet
)
=
0
;
std
::
unique_ptr
<
PointerDataPacket
>
packet
)
=
0
;
virtual
void
OnPlatformViewDispatchSemanticsAction
(
int32_t
id
,
flutter
::
SemanticsAction
action
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
)
=
0
;
virtual
void
OnPlatformViewSetSemanticsEnabled
(
bool
enabled
)
=
0
;
...
...
@@ -62,23 +62,23 @@ class PlatformView {
int64_t
texture_id
)
=
0
;
};
explicit
PlatformView
(
Delegate
&
delegate
,
flutter
::
TaskRunners
task_runners
);
explicit
PlatformView
(
Delegate
&
delegate
,
TaskRunners
task_runners
);
virtual
~
PlatformView
();
virtual
std
::
unique_ptr
<
VsyncWaiter
>
CreateVSyncWaiter
();
void
DispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
);
void
DispatchPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
void
DispatchSemanticsAction
(
int32_t
id
,
flutter
::
SemanticsAction
action
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
);
virtual
void
SetSemanticsEnabled
(
bool
enabled
);
virtual
void
SetAccessibilityFeatures
(
int32_t
flags
);
void
SetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
);
void
SetViewportMetrics
(
const
ViewportMetrics
&
metrics
);
void
NotifyCreated
();
...
...
@@ -94,19 +94,16 @@ class PlatformView {
fml
::
WeakPtr
<
PlatformView
>
GetWeakPtr
()
const
;
virtual
void
UpdateSemantics
(
flutter
::
SemanticsNodeUpdates
updates
,
flutter
::
CustomAccessibilityActionUpdates
actions
);
virtual
void
UpdateSemantics
(
SemanticsNodeUpdates
updates
,
CustomAccessibilityActionUpdates
actions
);
virtual
void
HandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
);
virtual
void
HandlePlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
virtual
void
OnPreEngineRestart
()
const
;
void
SetNextFrameCallback
(
fml
::
closure
closure
);
void
DispatchPointerDataPacket
(
std
::
unique_ptr
<
flutter
::
PointerDataPacket
>
packet
);
void
DispatchPointerDataPacket
(
std
::
unique_ptr
<
PointerDataPacket
>
packet
);
// Called once per texture, on the platform thread.
void
RegisterTexture
(
std
::
shared_ptr
<
flow
::
Texture
>
texture
);
...
...
@@ -119,7 +116,7 @@ class PlatformView {
protected:
PlatformView
::
Delegate
&
delegate_
;
const
flutter
::
TaskRunners
task_runners_
;
const
TaskRunners
task_runners_
;
SkISize
size_
;
fml
::
WeakPtrFactory
<
PlatformView
>
weak_factory_
;
...
...
shell/common/rasterizer.cc
浏览文件 @
39e1d00f
...
...
@@ -22,12 +22,12 @@ namespace flutter {
// used within this interval.
static
constexpr
std
::
chrono
::
milliseconds
kSkiaCleanupExpiration
(
15000
);
Rasterizer
::
Rasterizer
(
flutter
::
TaskRunners
task_runners
)
Rasterizer
::
Rasterizer
(
TaskRunners
task_runners
)
:
Rasterizer
(
std
::
move
(
task_runners
),
std
::
make_unique
<
flow
::
CompositorContext
>
())
{}
Rasterizer
::
Rasterizer
(
flutter
::
TaskRunners
task_runners
,
TaskRunners
task_runners
,
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context
)
:
task_runners_
(
std
::
move
(
task_runners
)),
compositor_context_
(
std
::
move
(
compositor_context
)),
...
...
@@ -41,8 +41,7 @@ fml::WeakPtr<Rasterizer> Rasterizer::GetWeakPtr() const {
return
weak_factory_
.
GetWeakPtr
();
}
fml
::
WeakPtr
<
flutter
::
SnapshotDelegate
>
Rasterizer
::
GetSnapshotDelegate
()
const
{
fml
::
WeakPtr
<
SnapshotDelegate
>
Rasterizer
::
GetSnapshotDelegate
()
const
{
return
weak_factory_
.
GetWeakPtr
();
}
...
...
@@ -72,17 +71,16 @@ void Rasterizer::DrawLastLayerTree() {
DrawToSurface
(
*
last_layer_tree_
);
}
void
Rasterizer
::
Draw
(
fml
::
RefPtr
<
flutter
::
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
{
void
Rasterizer
::
Draw
(
fml
::
RefPtr
<
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
{
TRACE_EVENT0
(
"flutter"
,
"GPURasterizer::Draw"
);
flutter
::
Pipeline
<
flow
::
LayerTree
>::
Consumer
consumer
=
Pipeline
<
flow
::
LayerTree
>::
Consumer
consumer
=
std
::
bind
(
&
Rasterizer
::
DoDraw
,
this
,
std
::
placeholders
::
_1
);
// Consume as many pipeline items as possible. But yield the event loop
// between successive tries.
switch
(
pipeline
->
Consume
(
consumer
))
{
case
flutter
::
PipelineConsumeResult
::
MoreAvailable
:
{
case
PipelineConsumeResult
::
MoreAvailable
:
{
task_runners_
.
GetGPUTaskRunner
()
->
PostTask
(
[
weak_this
=
weak_factory_
.
GetWeakPtr
(),
pipeline
]()
{
if
(
weak_this
)
{
...
...
shell/common/rasterizer.h
浏览文件 @
39e1d00f
...
...
@@ -19,11 +19,11 @@
namespace
flutter
{
class
Rasterizer
final
:
public
flutter
::
SnapshotDelegate
{
class
Rasterizer
final
:
public
SnapshotDelegate
{
public:
Rasterizer
(
flutter
::
TaskRunners
task_runners
);
Rasterizer
(
TaskRunners
task_runners
);
Rasterizer
(
flutter
::
TaskRunners
task_runners
,
Rasterizer
(
TaskRunners
task_runners
,
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context
);
~
Rasterizer
();
...
...
@@ -34,7 +34,7 @@ class Rasterizer final : public flutter::SnapshotDelegate {
fml
::
WeakPtr
<
Rasterizer
>
GetWeakPtr
()
const
;
fml
::
WeakPtr
<
flutter
::
SnapshotDelegate
>
GetSnapshotDelegate
()
const
;
fml
::
WeakPtr
<
SnapshotDelegate
>
GetSnapshotDelegate
()
const
;
flow
::
LayerTree
*
GetLastLayerTree
();
...
...
@@ -42,7 +42,7 @@ class Rasterizer final : public flutter::SnapshotDelegate {
flow
::
TextureRegistry
*
GetTextureRegistry
();
void
Draw
(
fml
::
RefPtr
<
flutter
::
Pipeline
<
flow
::
LayerTree
>>
pipeline
);
void
Draw
(
fml
::
RefPtr
<
Pipeline
<
flow
::
LayerTree
>>
pipeline
);
enum
class
ScreenshotType
{
SkiaPicture
,
...
...
@@ -76,14 +76,14 @@ class Rasterizer final : public flutter::SnapshotDelegate {
void
SetResourceCacheMaxBytes
(
int
max_bytes
);
private:
flutter
::
TaskRunners
task_runners_
;
TaskRunners
task_runners_
;
std
::
unique_ptr
<
Surface
>
surface_
;
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context_
;
std
::
unique_ptr
<
flow
::
LayerTree
>
last_layer_tree_
;
fml
::
closure
next_frame_callback_
;
fml
::
WeakPtrFactory
<
Rasterizer
>
weak_factory_
;
// |
flutter::
SnapshotDelegate|
// |SnapshotDelegate|
sk_sp
<
SkImage
>
MakeRasterSnapshot
(
sk_sp
<
SkPicture
>
picture
,
SkISize
picture_size
)
override
;
...
...
shell/common/run_configuration.cc
浏览文件 @
39e1d00f
...
...
@@ -13,15 +13,15 @@
namespace
flutter
{
RunConfiguration
RunConfiguration
::
InferFromSettings
(
const
flutter
::
Settings
&
settings
,
const
Settings
&
settings
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
io_worker
)
{
auto
asset_manager
=
std
::
make_shared
<
flutter
::
AssetManager
>
();
auto
asset_manager
=
std
::
make_shared
<
AssetManager
>
();
asset_manager
->
PushBack
(
std
::
make_unique
<
flutter
::
DirectoryAssetBundle
>
(
asset_manager
->
PushBack
(
std
::
make_unique
<
DirectoryAssetBundle
>
(
fml
::
Duplicate
(
settings
.
assets_dir
)));
asset_manager
->
PushBack
(
std
::
make_unique
<
flutter
::
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
std
::
make_unique
<
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
settings
.
assets_path
.
c_str
(),
false
,
fml
::
FilePermission
::
kRead
)));
return
{
IsolateConfiguration
::
InferFromSettings
(
settings
,
asset_manager
,
...
...
@@ -32,11 +32,11 @@ RunConfiguration RunConfiguration::InferFromSettings(
RunConfiguration
::
RunConfiguration
(
std
::
unique_ptr
<
IsolateConfiguration
>
configuration
)
:
RunConfiguration
(
std
::
move
(
configuration
),
std
::
make_shared
<
flutter
::
AssetManager
>
())
{}
std
::
make_shared
<
AssetManager
>
())
{}
RunConfiguration
::
RunConfiguration
(
std
::
unique_ptr
<
IsolateConfiguration
>
configuration
,
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
)
std
::
shared_ptr
<
AssetManager
>
asset_manager
)
:
isolate_configuration_
(
std
::
move
(
configuration
)),
asset_manager_
(
std
::
move
(
asset_manager
))
{}
...
...
@@ -49,7 +49,7 @@ bool RunConfiguration::IsValid() const {
}
bool
RunConfiguration
::
AddAssetResolver
(
std
::
unique_ptr
<
flutter
::
AssetResolver
>
resolver
)
{
std
::
unique_ptr
<
AssetResolver
>
resolver
)
{
if
(
!
resolver
||
!
resolver
->
IsValid
())
{
return
false
;
}
...
...
@@ -68,8 +68,7 @@ void RunConfiguration::SetEntrypointAndLibrary(std::string entrypoint,
entrypoint_library_
=
std
::
move
(
library
);
}
std
::
shared_ptr
<
flutter
::
AssetManager
>
RunConfiguration
::
GetAssetManager
()
const
{
std
::
shared_ptr
<
AssetManager
>
RunConfiguration
::
GetAssetManager
()
const
{
return
asset_manager_
;
}
...
...
shell/common/run_configuration.h
浏览文件 @
39e1d00f
...
...
@@ -21,13 +21,13 @@ namespace flutter {
class
RunConfiguration
{
public:
static
RunConfiguration
InferFromSettings
(
const
flutter
::
Settings
&
settings
,
const
Settings
&
settings
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
io_worker
=
nullptr
);
RunConfiguration
(
std
::
unique_ptr
<
IsolateConfiguration
>
configuration
);
RunConfiguration
(
std
::
unique_ptr
<
IsolateConfiguration
>
configuration
,
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager
);
std
::
shared_ptr
<
AssetManager
>
asset_manager
);
RunConfiguration
(
RunConfiguration
&&
);
...
...
@@ -35,13 +35,13 @@ class RunConfiguration {
bool
IsValid
()
const
;
bool
AddAssetResolver
(
std
::
unique_ptr
<
flutter
::
AssetResolver
>
resolver
);
bool
AddAssetResolver
(
std
::
unique_ptr
<
AssetResolver
>
resolver
);
void
SetEntrypoint
(
std
::
string
entrypoint
);
void
SetEntrypointAndLibrary
(
std
::
string
entrypoint
,
std
::
string
library
);
std
::
shared_ptr
<
flutter
::
AssetManager
>
GetAssetManager
()
const
;
std
::
shared_ptr
<
AssetManager
>
GetAssetManager
()
const
;
const
std
::
string
&
GetEntrypoint
()
const
;
...
...
@@ -51,7 +51,7 @@ class RunConfiguration {
private:
std
::
unique_ptr
<
IsolateConfiguration
>
isolate_configuration_
;
std
::
shared_ptr
<
flutter
::
AssetManager
>
asset_manager_
;
std
::
shared_ptr
<
AssetManager
>
asset_manager_
;
std
::
string
entrypoint_
=
"main"
;
std
::
string
entrypoint_library_
=
""
;
...
...
shell/common/shell.cc
浏览文件 @
39e1d00f
...
...
@@ -36,11 +36,11 @@ namespace flutter {
constexpr
char
kSkiaChannel
[]
=
"flutter/skia"
;
std
::
unique_ptr
<
Shell
>
Shell
::
CreateShellOnPlatformThread
(
flutter
::
DartVMRef
vm
,
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
shared_snapshot
,
DartVMRef
vm
,
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
DartSnapshot
>
shared_snapshot
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
)
{
if
(
!
task_runners
.
IsValid
())
{
...
...
@@ -88,7 +88,7 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
// Create the rasterizer on the GPU thread.
fml
::
AutoResetWaitableEvent
gpu_latch
;
std
::
unique_ptr
<
Rasterizer
>
rasterizer
;
fml
::
WeakPtr
<
flutter
::
SnapshotDelegate
>
snapshot_delegate
;
fml
::
WeakPtr
<
SnapshotDelegate
>
snapshot_delegate
;
fml
::
TaskRunner
::
RunNowOrPostTask
(
task_runners
.
GetGPUTaskRunner
(),
[
&
gpu_latch
,
//
&
rasterizer
,
//
...
...
@@ -157,8 +157,8 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
}
static
void
RecordStartupTimestamp
()
{
if
(
flutter
::
engine_main_enter_ts
==
0
)
{
flutter
::
engine_main_enter_ts
=
Dart_TimelineGetMicros
();
if
(
engine_main_enter_ts
==
0
)
{
engine_main_enter_ts
=
Dart_TimelineGetMicros
();
}
}
...
...
@@ -168,7 +168,7 @@ static void RecordStartupTimestamp() {
// TODO(chinmaygarde): The unfortunate side effect of this call is that settings
// that cause shell initialization failures will still lead to some of their
// settings being applied.
static
void
PerformInitializationTasks
(
const
flutter
::
Settings
&
settings
)
{
static
void
PerformInitializationTasks
(
const
Settings
&
settings
)
{
{
fml
::
LogSettings
log_settings
;
log_settings
.
min_log_level
=
...
...
@@ -206,15 +206,15 @@ static void PerformInitializationTasks(const flutter::Settings& settings) {
}
std
::
unique_ptr
<
Shell
>
Shell
::
Create
(
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
TaskRunners
task_runners
,
Settings
settings
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
)
{
PerformInitializationTasks
(
settings
);
TRACE_EVENT0
(
"flutter"
,
"Shell::Create"
);
auto
vm
=
flutter
::
DartVMRef
::
Create
(
settings
);
auto
vm
=
DartVMRef
::
Create
(
settings
);
FML_CHECK
(
vm
)
<<
"Must be able to initialize the VM."
;
auto
vm_data
=
vm
->
GetVMData
();
...
...
@@ -222,7 +222,7 @@ std::unique_ptr<Shell> Shell::Create(
return
Shell
::
Create
(
std
::
move
(
task_runners
),
//
std
::
move
(
settings
),
//
vm_data
->
GetIsolateSnapshot
(),
// isolate snapshot
flutter
::
DartSnapshot
::
Empty
(),
// shared snapshot
DartSnapshot
::
Empty
(),
// shared snapshot
std
::
move
(
on_create_platform_view
),
//
std
::
move
(
on_create_rasterizer
),
//
std
::
move
(
vm
)
//
...
...
@@ -230,13 +230,13 @@ std::unique_ptr<Shell> Shell::Create(
}
std
::
unique_ptr
<
Shell
>
Shell
::
Create
(
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
DartSnapshot
>
shared_snapshot
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
,
flutter
::
DartVMRef
vm
)
{
DartVMRef
vm
)
{
PerformInitializationTasks
(
settings
);
TRACE_EVENT0
(
"flutter"
,
"Shell::CreateWithSnapshots"
);
...
...
@@ -274,9 +274,7 @@ std::unique_ptr<Shell> Shell::Create(
return
shell
;
}
Shell
::
Shell
(
flutter
::
DartVMRef
vm
,
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
)
Shell
::
Shell
(
DartVMRef
vm
,
TaskRunners
task_runners
,
Settings
settings
)
:
task_runners_
(
std
::
move
(
task_runners
)),
settings_
(
std
::
move
(
settings
)),
vm_
(
std
::
move
(
vm
))
{
...
...
@@ -286,34 +284,33 @@ Shell::Shell(flutter::DartVMRef vm,
// Install service protocol handlers.
service_protocol_handlers_
[
flutter
::
ServiceProtocol
::
kScreenshotExtensionName
service_protocol_handlers_
[
ServiceProtocol
::
kScreenshotExtensionName
.
ToString
()]
=
{
task_runners_
.
GetGPUTaskRunner
(),
std
::
bind
(
&
Shell
::
OnServiceProtocolScreenshot
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)};
service_protocol_handlers_
[
flutter
::
ServiceProtocol
::
kScreenshotSkpExtensionName
.
ToString
()]
=
{
service_protocol_handlers_
[
ServiceProtocol
::
kScreenshotSkpExtensionName
.
ToString
()]
=
{
task_runners_
.
GetGPUTaskRunner
(),
std
::
bind
(
&
Shell
::
OnServiceProtocolScreenshotSKP
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)};
service_protocol_handlers_
[
flutter
::
ServiceProtocol
::
kRunInViewExtensionName
service_protocol_handlers_
[
ServiceProtocol
::
kRunInViewExtensionName
.
ToString
()]
=
{
task_runners_
.
GetUITaskRunner
(),
std
::
bind
(
&
Shell
::
OnServiceProtocolRunInView
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)};
service_protocol_handlers_
[
flutter
::
ServiceProtocol
::
kFlushUIThreadTasksExtensionName
.
ToString
()]
=
{
task_runners_
.
GetUITaskRunner
(),
service_protocol_handlers_
[
ServiceProtocol
::
kFlushUIThreadTasksExtensionName
.
ToString
()]
=
{
task_runners_
.
GetUITaskRunner
(),
std
::
bind
(
&
Shell
::
OnServiceProtocolFlushUIThreadTasks
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)};
service_protocol_handlers_
[
flutter
::
ServiceProtocol
::
kSetAssetBundlePathExtensionName
.
ToString
()]
=
{
task_runners_
.
GetUITaskRunner
(),
service_protocol_handlers_
[
ServiceProtocol
::
kSetAssetBundlePathExtensionName
.
ToString
()]
=
{
task_runners_
.
GetUITaskRunner
(),
std
::
bind
(
&
Shell
::
OnServiceProtocolSetAssetBundlePath
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)};
service_protocol_handlers_
[
flutter
::
ServiceProtocol
::
kGetDisplayRefreshRateExtensionName
.
ToString
()]
=
{
[
ServiceProtocol
::
kGetDisplayRefreshRateExtensionName
.
ToString
()]
=
{
task_runners_
.
GetUITaskRunner
(),
std
::
bind
(
&
Shell
::
OnServiceProtocolGetDisplayRefreshRate
,
this
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
)};
...
...
@@ -405,11 +402,11 @@ bool Shell::Setup(std::unique_ptr<PlatformView> platform_view,
return
true
;
}
const
flutter
::
Settings
&
Shell
::
GetSettings
()
const
{
const
Settings
&
Shell
::
GetSettings
()
const
{
return
settings_
;
}
const
flutter
::
TaskRunners
&
Shell
::
GetTaskRunners
()
const
{
const
TaskRunners
&
Shell
::
GetTaskRunners
()
const
{
return
task_runners_
;
}
...
...
@@ -428,7 +425,7 @@ fml::WeakPtr<PlatformView> Shell::GetPlatformView() {
return
platform_view_
->
GetWeakPtr
();
}
flutter
::
DartVM
*
Shell
::
GetDartVM
()
{
DartVM
*
Shell
::
GetDartVM
()
{
return
&
vm_
;
}
...
...
@@ -591,8 +588,7 @@ void Shell::OnPlatformViewDestroyed() {
}
// |PlatformView::Delegate|
void
Shell
::
OnPlatformViewSetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
)
{
void
Shell
::
OnPlatformViewSetViewportMetrics
(
const
ViewportMetrics
&
metrics
)
{
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetPlatformTaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -606,7 +602,7 @@ void Shell::OnPlatformViewSetViewportMetrics(
// |PlatformView::Delegate|
void
Shell
::
OnPlatformViewDispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetPlatformTaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -620,7 +616,7 @@ void Shell::OnPlatformViewDispatchPlatformMessage(
// |PlatformView::Delegate|
void
Shell
::
OnPlatformViewDispatchPointerDataPacket
(
std
::
unique_ptr
<
flutter
::
PointerDataPacket
>
packet
)
{
std
::
unique_ptr
<
PointerDataPacket
>
packet
)
{
TRACE_EVENT0
(
"flutter"
,
"Shell::OnPlatformViewDispatchPointerDataPacket"
);
TRACE_FLOW_BEGIN
(
"flutter"
,
"PointerEvent"
,
next_pointer_flow_id_
);
FML_DCHECK
(
is_setup_
);
...
...
@@ -636,9 +632,8 @@ void Shell::OnPlatformViewDispatchPointerDataPacket(
}
// |PlatformView::Delegate|
void
Shell
::
OnPlatformViewDispatchSemanticsAction
(
int32_t
id
,
flutter
::
SemanticsAction
action
,
void
Shell
::
OnPlatformViewDispatchSemanticsAction
(
int32_t
id
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
)
{
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetPlatformTaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -773,8 +768,7 @@ void Shell::OnAnimatorNotifyIdle(int64_t deadline) {
}
// |Animator::Delegate|
void
Shell
::
OnAnimatorDraw
(
fml
::
RefPtr
<
flutter
::
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
{
void
Shell
::
OnAnimatorDraw
(
fml
::
RefPtr
<
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
{
FML_DCHECK
(
is_setup_
);
task_runners_
.
GetGPUTaskRunner
()
->
PostTask
(
...
...
@@ -799,9 +793,8 @@ void Shell::OnAnimatorDrawLastLayerTree() {
}
// |Engine::Delegate|
void
Shell
::
OnEngineUpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
{
void
Shell
::
OnEngineUpdateSemantics
(
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
{
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -816,7 +809,7 @@ void Shell::OnEngineUpdateSemantics(
// |Engine::Delegate|
void
Shell
::
OnEngineHandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -833,8 +826,7 @@ void Shell::OnEngineHandlePlatformMessage(
});
}
void
Shell
::
HandleEngineSkiaMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
{
void
Shell
::
HandleEngineSkiaMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
const
auto
&
data
=
message
->
data
();
rapidjson
::
Document
document
;
...
...
@@ -884,7 +876,7 @@ void Shell::UpdateIsolateDescription(const std::string isolate_name,
vm_
->
GetServiceProtocol
()
->
SetHandlerDescription
(
this
,
description
);
}
// |
flutter::
ServiceProtocol::Handler|
// |ServiceProtocol::Handler|
fml
::
RefPtr
<
fml
::
TaskRunner
>
Shell
::
GetServiceProtocolHandlerTaskRunner
(
fml
::
StringView
method
)
const
{
FML_DCHECK
(
is_setup_
);
...
...
@@ -895,7 +887,7 @@ fml::RefPtr<fml::TaskRunner> Shell::GetServiceProtocolHandlerTaskRunner(
return
task_runners_
.
GetUITaskRunner
();
}
// |
flutter::
ServiceProtocol::Handler|
// |ServiceProtocol::Handler|
bool
Shell
::
HandleServiceProtocolMessage
(
fml
::
StringView
method
,
// one if the extension names specified above.
const
ServiceProtocolMap
&
params
,
...
...
@@ -907,9 +899,9 @@ bool Shell::HandleServiceProtocolMessage(
return
false
;
}
// |
flutter::
ServiceProtocol::Handler|
flutter
::
ServiceProtocol
::
Handler
::
Description
Shell
::
GetServiceProtocolDescription
()
const
{
// |ServiceProtocol::Handler|
ServiceProtocol
::
Handler
::
Description
Shell
::
GetServiceProtocolDescription
()
const
{
return
{
engine_
->
GetUIIsolateMainPort
(),
engine_
->
GetUIIsolateName
(),
...
...
@@ -941,7 +933,7 @@ static void ServiceProtocolFailureError(rapidjson::Document& response,
// Service protocol handler
bool
Shell
::
OnServiceProtocolScreenshot
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
{
FML_DCHECK
(
task_runners_
.
GetGPUTaskRunner
()
->
RunsTasksOnCurrentThread
());
auto
screenshot
=
rasterizer_
->
ScreenshotLastLayerTree
(
...
...
@@ -962,7 +954,7 @@ bool Shell::OnServiceProtocolScreenshot(
// Service protocol handler
bool
Shell
::
OnServiceProtocolScreenshotSKP
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
{
FML_DCHECK
(
task_runners_
.
GetGPUTaskRunner
()
->
RunsTasksOnCurrentThread
());
auto
screenshot
=
rasterizer_
->
ScreenshotLastLayerTree
(
...
...
@@ -983,7 +975,7 @@ bool Shell::OnServiceProtocolScreenshotSKP(
// Service protocol handler
bool
Shell
::
OnServiceProtocolRunInView
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
{
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -1026,7 +1018,7 @@ bool Shell::OnServiceProtocolRunInView(
RunConfiguration
configuration
(
std
::
move
(
isolate_configuration
));
configuration
.
AddAssetResolver
(
std
::
make_unique
<
flutter
::
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
std
::
make_unique
<
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
asset_directory_path
.
c_str
(),
false
,
fml
::
FilePermission
::
kRead
)));
auto
&
allocator
=
response
.
GetAllocator
();
...
...
@@ -1051,7 +1043,7 @@ bool Shell::OnServiceProtocolRunInView(
// Service protocol handler
bool
Shell
::
OnServiceProtocolFlushUIThreadTasks
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
{
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
// This API should not be invoked by production code.
...
...
@@ -1066,7 +1058,7 @@ bool Shell::OnServiceProtocolFlushUIThreadTasks(
}
bool
Shell
::
OnServiceProtocolGetDisplayRefreshRate
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
{
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
response
.
SetObject
();
...
...
@@ -1077,7 +1069,7 @@ bool Shell::OnServiceProtocolGetDisplayRefreshRate(
// Service protocol handler
bool
Shell
::
OnServiceProtocolSetAssetBundlePath
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
{
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
...
...
@@ -1090,9 +1082,9 @@ bool Shell::OnServiceProtocolSetAssetBundlePath(
auto
&
allocator
=
response
.
GetAllocator
();
response
.
SetObject
();
auto
asset_manager
=
std
::
make_shared
<
flutter
::
AssetManager
>
();
auto
asset_manager
=
std
::
make_shared
<
AssetManager
>
();
asset_manager
->
PushFront
(
std
::
make_unique
<
flutter
::
DirectoryAssetBundle
>
(
asset_manager
->
PushFront
(
std
::
make_unique
<
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
params
.
at
(
"assetDirectory"
).
ToString
().
c_str
(),
false
,
fml
::
FilePermission
::
kRead
)));
...
...
shell/common/shell.h
浏览文件 @
39e1d00f
...
...
@@ -37,7 +37,7 @@ namespace flutter {
class
Shell
final
:
public
PlatformView
::
Delegate
,
public
Animator
::
Delegate
,
public
Engine
::
Delegate
,
public
flutter
::
ServiceProtocol
::
Handler
{
public
ServiceProtocol
::
Handler
{
public:
template
<
class
T
>
using
CreateCallback
=
std
::
function
<
std
::
unique_ptr
<
T
>
(
Shell
&
)
>
;
...
...
@@ -45,27 +45,27 @@ class Shell final : public PlatformView::Delegate,
// Create a shell with the given task runners and settings. The isolate
// snapshot will be shared with the snapshot of the service isolate.
static
std
::
unique_ptr
<
Shell
>
Create
(
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
TaskRunners
task_runners
,
Settings
settings
,
CreateCallback
<
PlatformView
>
on_create_platform_view
,
CreateCallback
<
Rasterizer
>
on_create_rasterizer
);
// Creates a shell with the given task runners and settings. The isolate
// snapshot is specified upfront.
static
std
::
unique_ptr
<
Shell
>
Create
(
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
DartSnapshot
>
shared_snapshot
,
CreateCallback
<
PlatformView
>
on_create_platform_view
,
CreateCallback
<
Rasterizer
>
on_create_rasterizer
,
flutter
::
DartVMRef
vm
);
DartVMRef
vm
);
~
Shell
();
const
flutter
::
Settings
&
GetSettings
()
const
;
const
Settings
&
GetSettings
()
const
;
const
flutter
::
TaskRunners
&
GetTaskRunners
()
const
;
const
TaskRunners
&
GetTaskRunners
()
const
;
fml
::
WeakPtr
<
Rasterizer
>
GetRasterizer
();
...
...
@@ -73,7 +73,7 @@ class Shell final : public PlatformView::Delegate,
fml
::
WeakPtr
<
PlatformView
>
GetPlatformView
();
flutter
::
DartVM
*
GetDartVM
();
DartVM
*
GetDartVM
();
bool
IsSetup
()
const
;
...
...
@@ -81,13 +81,13 @@ class Shell final : public PlatformView::Delegate,
bool
base64_encode
);
private:
using
ServiceProtocolHandler
=
std
::
function
<
bool
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
,
using
ServiceProtocolHandler
=
std
::
function
<
bool
(
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
,
rapidjson
::
Document
&
)
>
;
const
flutter
::
TaskRunners
task_runners_
;
const
flutter
::
Settings
settings_
;
flutter
::
DartVMRef
vm_
;
const
TaskRunners
task_runners_
;
const
Settings
settings_
;
DartVMRef
vm_
;
std
::
unique_ptr
<
PlatformView
>
platform_view_
;
// on platform task runner
std
::
unique_ptr
<
Engine
>
engine_
;
// on UI task runner
std
::
unique_ptr
<
Rasterizer
>
rasterizer_
;
// on GPU task runner
...
...
@@ -102,17 +102,15 @@ class Shell final : public PlatformView::Delegate,
bool
is_setup_
=
false
;
uint64_t
next_pointer_flow_id_
=
0
;
Shell
(
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
);
Shell
(
flutter
::
DartVMRef
vm
,
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
);
Shell
(
TaskRunners
task_runners
,
Settings
settings
);
Shell
(
DartVMRef
vm
,
TaskRunners
task_runners
,
Settings
settings
);
static
std
::
unique_ptr
<
Shell
>
CreateShellOnPlatformThread
(
flutter
::
DartVMRef
vm
,
flutter
::
TaskRunners
task_runners
,
flutter
::
Settings
settings
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
flutter
::
DartSnapshot
>
shared_snapshot
,
DartVMRef
vm
,
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
fml
::
RefPtr
<
const
DartSnapshot
>
shared_snapshot
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
);
...
...
@@ -129,20 +127,20 @@ class Shell final : public PlatformView::Delegate,
// |PlatformView::Delegate|
void
OnPlatformViewSetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
)
override
;
const
ViewportMetrics
&
metrics
)
override
;
// |PlatformView::Delegate|
void
OnPlatformViewDispatchPlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
override
;
fml
::
RefPtr
<
PlatformMessage
>
message
)
override
;
// |PlatformView::Delegate|
void
OnPlatformViewDispatchPointerDataPacket
(
std
::
unique_ptr
<
flutter
::
PointerDataPacket
>
packet
)
override
;
std
::
unique_ptr
<
PointerDataPacket
>
packet
)
override
;
// |PlatformView::Delegate|
void
OnPlatformViewDispatchSemanticsAction
(
int32_t
id
,
flutter
::
SemanticsAction
action
,
SemanticsAction
action
,
std
::
vector
<
uint8_t
>
args
)
override
;
// |PlatformView::Delegate|
...
...
@@ -171,22 +169,21 @@ class Shell final : public PlatformView::Delegate,
void
OnAnimatorNotifyIdle
(
int64_t
deadline
)
override
;
// |Animator::Delegate|
void
OnAnimatorDraw
(
fml
::
RefPtr
<
flutter
::
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
override
;
void
OnAnimatorDraw
(
fml
::
RefPtr
<
Pipeline
<
flow
::
LayerTree
>>
pipeline
)
override
;
// |Animator::Delegate|
void
OnAnimatorDrawLastLayerTree
()
override
;
// |Engine::Delegate|
void
OnEngineUpdateSemantics
(
flutter
::
SemanticsNodeUpdates
update
,
flutter
::
CustomAccessibilityActionUpdates
actions
)
override
;
SemanticsNodeUpdates
update
,
CustomAccessibilityActionUpdates
actions
)
override
;
// |Engine::Delegate|
void
OnEngineHandlePlatformMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
)
override
;
fml
::
RefPtr
<
PlatformMessage
>
message
)
override
;
void
HandleEngineSkiaMessage
(
fml
::
RefPtr
<
flutter
::
PlatformMessage
>
message
);
void
HandleEngineSkiaMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
);
// |Engine::Delegate|
void
OnPreEngineRestart
()
override
;
...
...
@@ -195,48 +192,48 @@ class Shell final : public PlatformView::Delegate,
void
UpdateIsolateDescription
(
const
std
::
string
isolate_name
,
int64_t
isolate_port
)
override
;
// |
flutter::
ServiceProtocol::Handler|
// |ServiceProtocol::Handler|
fml
::
RefPtr
<
fml
::
TaskRunner
>
GetServiceProtocolHandlerTaskRunner
(
fml
::
StringView
method
)
const
override
;
// |
flutter::
ServiceProtocol::Handler|
// |ServiceProtocol::Handler|
bool
HandleServiceProtocolMessage
(
fml
::
StringView
method
,
// one if the extension names specified above.
const
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
)
override
;
// |
flutter::
ServiceProtocol::Handler|
flutter
::
ServiceProtocol
::
Handler
::
Description
GetServiceProtocolDescription
()
// |ServiceProtocol::Handler|
ServiceProtocol
::
Handler
::
Description
GetServiceProtocolDescription
()
const
override
;
// Service protocol handler
bool
OnServiceProtocolScreenshot
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
);
// Service protocol handler
bool
OnServiceProtocolScreenshotSKP
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
);
// Service protocol handler
bool
OnServiceProtocolRunInView
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
);
// Service protocol handler
bool
OnServiceProtocolFlushUIThreadTasks
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
);
// Service protocol handler
bool
OnServiceProtocolSetAssetBundlePath
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
);
// Service protocol handler
bool
OnServiceProtocolGetDisplayRefreshRate
(
const
flutter
::
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
const
ServiceProtocol
::
Handler
::
ServiceProtocolMap
&
params
,
rapidjson
::
Document
&
response
);
FML_DISALLOW_COPY_AND_ASSIGN
(
Shell
);
...
...
shell/common/shell_benchmarks.cc
浏览文件 @
39e1d00f
...
...
@@ -16,7 +16,7 @@ static void StartupAndShutdownShell(benchmark::State& state,
std
::
unique_ptr
<
ThreadHost
>
thread_host
;
{
benchmarking
::
ScopedPauseTiming
pause
(
state
,
!
measure_startup
);
flutter
::
Settings
settings
=
{};
Settings
settings
=
{};
settings
.
task_observer_add
=
[](
intptr_t
,
fml
::
closure
)
{};
settings
.
task_observer_remove
=
[](
intptr_t
)
{};
...
...
@@ -26,8 +26,8 @@ static void StartupAndShutdownShell(benchmark::State& state,
ThreadHost
::
Type
::
GPU
|
ThreadHost
::
Type
::
IO
|
ThreadHost
::
Type
::
UI
);
flutter
::
TaskRunners
task_runners
(
"test"
,
thread_host
->
platform_thread
->
GetTaskRunner
(),
TaskRunners
task_runners
(
"test"
,
thread_host
->
platform_thread
->
GetTaskRunner
(),
thread_host
->
gpu_thread
->
GetTaskRunner
(),
thread_host
->
ui_thread
->
GetTaskRunner
(),
thread_host
->
io_thread
->
GetTaskRunner
());
...
...
shell/common/shell_test.cc
浏览文件 @
39e1d00f
...
...
@@ -44,7 +44,7 @@ static std::unique_ptr<fml::Mapping> GetMapping(const fml::UniqueFD& directory,
return
mapping
;
}
void
ShellTest
::
SetSnapshotsAndAssets
(
flutter
::
Settings
&
settings
)
{
void
ShellTest
::
SetSnapshotsAndAssets
(
Settings
&
settings
)
{
if
(
!
assets_dir_
.
is_valid
())
{
return
;
}
...
...
@@ -53,7 +53,7 @@ void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) {
// In JIT execution, all snapshots are present within the binary itself and
// don't need to be explicitly suppiled by the embedder.
if
(
flutter
::
DartVM
::
IsRunningPrecompiledCode
())
{
if
(
DartVM
::
IsRunningPrecompiledCode
())
{
settings
.
vm_snapshot_data
=
[
this
]()
{
return
GetMapping
(
assets_dir_
,
"vm_snapshot_data"
,
false
);
};
...
...
@@ -62,7 +62,7 @@ void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) {
return
GetMapping
(
assets_dir_
,
"isolate_snapshot_data"
,
false
);
};
if
(
flutter
::
DartVM
::
IsRunningPrecompiledCode
())
{
if
(
DartVM
::
IsRunningPrecompiledCode
())
{
settings
.
vm_snapshot_instr
=
[
this
]()
{
return
GetMapping
(
assets_dir_
,
"vm_snapshot_instr"
,
true
);
};
...
...
@@ -81,8 +81,8 @@ void ShellTest::SetSnapshotsAndAssets(flutter::Settings& settings) {
}
}
flutter
::
Settings
ShellTest
::
CreateSettingsForFixture
()
{
flutter
::
Settings
settings
;
Settings
ShellTest
::
CreateSettingsForFixture
()
{
Settings
settings
;
settings
.
task_observer_add
=
[](
intptr_t
key
,
fml
::
closure
handler
)
{
fml
::
MessageLoop
::
GetCurrent
().
AddTaskObserver
(
key
,
handler
);
};
...
...
@@ -96,7 +96,7 @@ flutter::Settings ShellTest::CreateSettingsForFixture() {
return
settings
;
}
flutter
::
TaskRunners
ShellTest
::
GetTaskRunnersForFixture
()
{
TaskRunners
ShellTest
::
GetTaskRunnersForFixture
()
{
return
{
"test"
,
thread_host_
->
platform_thread
->
GetTaskRunner
(),
// platform
...
...
shell/common/shell_test.h
浏览文件 @
39e1d00f
...
...
@@ -23,9 +23,9 @@ class ShellTest : public ::testing::ThreadTest {
~
ShellTest
();
flutter
::
Settings
CreateSettingsForFixture
();
Settings
CreateSettingsForFixture
();
flutter
::
TaskRunners
GetTaskRunnersForFixture
();
TaskRunners
GetTaskRunnersForFixture
();
void
AddNativeCallback
(
std
::
string
name
,
Dart_NativeFunction
callback
);
...
...
@@ -41,7 +41,7 @@ class ShellTest : public ::testing::ThreadTest {
std
::
shared_ptr
<::
testing
::
TestDartNativeResolver
>
native_resolver_
;
std
::
unique_ptr
<
ThreadHost
>
thread_host_
;
void
SetSnapshotsAndAssets
(
flutter
::
Settings
&
settings
);
void
SetSnapshotsAndAssets
(
Settings
&
settings
);
};
}
// namespace testing
...
...
shell/common/shell_unittests.cc
浏览文件 @
39e1d00f
...
...
@@ -26,8 +26,7 @@ namespace testing {
class
TestPlatformView
:
public
PlatformView
,
public
GPUSurfaceSoftwareDelegate
{
public:
TestPlatformView
(
PlatformView
::
Delegate
&
delegate
,
flutter
::
TaskRunners
task_runners
)
TestPlatformView
(
PlatformView
::
Delegate
&
delegate
,
TaskRunners
task_runners
)
:
PlatformView
(
delegate
,
std
::
move
(
task_runners
))
{}
private:
...
...
@@ -84,8 +83,8 @@ static bool ValidateShell(Shell* shell) {
}
TEST_F
(
ShellTest
,
InitializeWithInvalidThreads
)
{
flutter
::
Settings
settings
=
CreateSettingsForFixture
();
flutter
::
TaskRunners
task_runners
(
"test"
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
Settings
settings
=
CreateSettingsForFixture
();
TaskRunners
task_runners
(
"test"
,
nullptr
,
nullptr
,
nullptr
,
nullptr
);
auto
shell
=
Shell
::
Create
(
std
::
move
(
task_runners
),
settings
,
[](
Shell
&
shell
)
{
...
...
@@ -99,13 +98,12 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) {
}
TEST_F
(
ShellTest
,
InitializeWithDifferentThreads
)
{
flutter
::
Settings
settings
=
CreateSettingsForFixture
();
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
ThreadHost
::
Type
::
Platform
|
ThreadHost
::
Type
::
GPU
|
ThreadHost
::
Type
::
IO
|
ThreadHost
::
Type
::
UI
);
flutter
::
TaskRunners
task_runners
(
"test"
,
thread_host
.
platform_thread
->
GetTaskRunner
(),
TaskRunners
task_runners
(
"test"
,
thread_host
.
platform_thread
->
GetTaskRunner
(),
thread_host
.
gpu_thread
->
GetTaskRunner
(),
thread_host
.
ui_thread
->
GetTaskRunner
(),
thread_host
.
io_thread
->
GetTaskRunner
());
...
...
@@ -122,13 +120,13 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) {
}
TEST_F
(
ShellTest
,
InitializeWithSingleThread
)
{
flutter
::
Settings
settings
=
CreateSettingsForFixture
();
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
ThreadHost
::
Type
::
Platform
);
auto
task_runner
=
thread_host
.
platform_thread
->
GetTaskRunner
();
flutter
::
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
auto
shell
=
Shell
::
Create
(
std
::
move
(
task_runners
),
settings
,
[](
Shell
&
shell
)
{
...
...
@@ -142,11 +140,11 @@ TEST_F(ShellTest, InitializeWithSingleThread) {
}
TEST_F
(
ShellTest
,
InitializeWithSingleThreadWhichIsTheCallingThread
)
{
flutter
::
Settings
settings
=
CreateSettingsForFixture
();
Settings
settings
=
CreateSettingsForFixture
();
fml
::
MessageLoop
::
EnsureInitializedForCurrentThread
();
auto
task_runner
=
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
();
flutter
::
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
auto
shell
=
Shell
::
Create
(
std
::
move
(
task_runners
),
settings
,
[](
Shell
&
shell
)
{
...
...
@@ -161,13 +159,13 @@ TEST_F(ShellTest, InitializeWithSingleThreadWhichIsTheCallingThread) {
TEST_F
(
ShellTest
,
InitializeWithMultipleThreadButCallingThreadAsPlatformThread
)
{
flutter
::
Settings
settings
=
CreateSettingsForFixture
();
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
ThreadHost
::
Type
::
GPU
|
ThreadHost
::
Type
::
IO
|
ThreadHost
::
Type
::
UI
);
fml
::
MessageLoop
::
EnsureInitializedForCurrentThread
();
flutter
::
TaskRunners
task_runners
(
"test"
,
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
(),
TaskRunners
task_runners
(
"test"
,
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
(),
thread_host
.
gpu_thread
->
GetTaskRunner
(),
thread_host
.
ui_thread
->
GetTaskRunner
(),
thread_host
.
io_thread
->
GetTaskRunner
());
...
...
@@ -184,11 +182,11 @@ TEST_F(ShellTest,
}
TEST_F
(
ShellTest
,
InitializeWithGPUAndPlatformThreadsTheSame
)
{
flutter
::
Settings
settings
=
CreateSettingsForFixture
();
Settings
settings
=
CreateSettingsForFixture
();
ThreadHost
thread_host
(
"io.flutter.test."
+
::
testing
::
GetCurrentTestName
()
+
"."
,
ThreadHost
::
Type
::
Platform
|
ThreadHost
::
Type
::
IO
|
ThreadHost
::
Type
::
UI
);
flutter
::
TaskRunners
task_runners
(
TaskRunners
task_runners
(
"test"
,
thread_host
.
platform_thread
->
GetTaskRunner
(),
// platform
thread_host
.
platform_thread
->
GetTaskRunner
(),
// gpu
...
...
shell/common/switches.cc
浏览文件 @
39e1d00f
...
...
@@ -46,12 +46,11 @@ void PrintUsage(const std::string& executable_name) {
std
::
cerr
<<
"Versions: "
<<
std
::
endl
<<
std
::
endl
;
std
::
cerr
<<
"Flutter Engine Version: "
<<
flutter
::
GetFlutterEngineVersion
()
std
::
cerr
<<
"Flutter Engine Version: "
<<
GetFlutterEngineVersion
()
<<
std
::
endl
;
std
::
cerr
<<
"Skia Version: "
<<
flutter
::
GetSkiaVersion
()
<<
std
::
endl
;
std
::
cerr
<<
"Skia Version: "
<<
GetSkiaVersion
()
<<
std
::
endl
;
std
::
cerr
<<
"Dart Version: "
<<
flutter
::
GetDartVersion
()
<<
std
::
endl
<<
std
::
endl
;
std
::
cerr
<<
"Dart Version: "
<<
GetDartVersion
()
<<
std
::
endl
<<
std
::
endl
;
std
::
cerr
<<
"Available Flags:"
<<
std
::
endl
;
...
...
@@ -150,9 +149,8 @@ std::unique_ptr<fml::Mapping> GetSymbolMapping(std::string symbol_prefix,
return
std
::
make_unique
<
fml
::
NonOwnedMapping
>
(
mapping
,
size
);
}
flutter
::
Settings
SettingsFromCommandLine
(
const
fml
::
CommandLine
&
command_line
)
{
flutter
::
Settings
settings
=
{};
Settings
SettingsFromCommandLine
(
const
fml
::
CommandLine
&
command_line
)
{
Settings
settings
=
{};
// Enable Observatory
settings
.
enable_observatory
=
...
...
shell/common/switches.h
浏览文件 @
39e1d00f
...
...
@@ -148,7 +148,7 @@ void PrintUsage(const std::string& executable_name);
const
fml
::
StringView
FlagForSwitch
(
Switch
swtch
);
flutter
::
Settings
SettingsFromCommandLine
(
const
fml
::
CommandLine
&
command_line
);
Settings
SettingsFromCommandLine
(
const
fml
::
CommandLine
&
command_line
);
}
// namespace flutter
...
...
shell/common/vsync_waiter.cc
浏览文件 @
39e1d00f
...
...
@@ -23,7 +23,7 @@ static constexpr const char* kVsyncTraceName = "VSYNC";
static
constexpr
const
char
*
kVsyncFlowName
=
"VsyncFlow"
;
VsyncWaiter
::
VsyncWaiter
(
flutter
::
TaskRunners
task_runners
)
VsyncWaiter
::
VsyncWaiter
(
TaskRunners
task_runners
)
:
task_runners_
(
std
::
move
(
task_runners
))
{}
VsyncWaiter
::~
VsyncWaiter
()
=
default
;
...
...
shell/common/vsync_waiter.h
浏览文件 @
39e1d00f
...
...
@@ -36,9 +36,9 @@ class VsyncWaiter : public std::enable_shared_from_this<VsyncWaiter> {
friend
class
VsyncWaiterAndroid
;
friend
class
VsyncWaiterEmbedder
;
const
flutter
::
TaskRunners
task_runners_
;
const
TaskRunners
task_runners_
;
VsyncWaiter
(
flutter
::
TaskRunners
task_runners
);
VsyncWaiter
(
TaskRunners
task_runners
);
// Implementations are meant to override this method and arm their vsync
// latches when in response to this invocation. On vsync, they are meant to
...
...
shell/common/vsync_waiter_fallback.cc
浏览文件 @
39e1d00f
...
...
@@ -20,7 +20,7 @@ static fml::TimePoint SnapToNextTick(fml::TimePoint value,
}
// namespace
VsyncWaiterFallback
::
VsyncWaiterFallback
(
flutter
::
TaskRunners
task_runners
)
VsyncWaiterFallback
::
VsyncWaiterFallback
(
TaskRunners
task_runners
)
:
VsyncWaiter
(
std
::
move
(
task_runners
)),
phase_
(
fml
::
TimePoint
::
Now
())
{}
VsyncWaiterFallback
::~
VsyncWaiterFallback
()
=
default
;
...
...
shell/common/vsync_waiter_fallback.h
浏览文件 @
39e1d00f
...
...
@@ -14,7 +14,7 @@ namespace flutter {
class
VsyncWaiterFallback
final
:
public
VsyncWaiter
{
public:
VsyncWaiterFallback
(
flutter
::
TaskRunners
task_runners
);
VsyncWaiterFallback
(
TaskRunners
task_runners
);
~
VsyncWaiterFallback
()
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录