Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
5e54c707
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,发现更多精彩内容 >>
未验证
提交
5e54c707
编写于
8月 31, 2020
作者:
E
Emmanuel Garcia
提交者:
GitHub
8月 31, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reland: Enable hybrid composition by default on Android (#20722) (#20864)
This reverts commit
4de62c7c
.
上级
165abef0
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
36 addition
and
100 deletion
+36
-100
common/settings.h
common/settings.h
+0
-9
flow/surface.cc
flow/surface.cc
+4
-0
flow/surface.h
flow/surface.h
+2
-0
shell/common/rasterizer.cc
shell/common/rasterizer.cc
+4
-0
shell/common/switches.cc
shell/common/switches.cc
+0
-3
shell/common/switches.h
shell/common/switches.h
+1
-9
shell/gpu/gpu_surface_gl.cc
shell/gpu/gpu_surface_gl.cc
+5
-0
shell/gpu/gpu_surface_gl.h
shell/gpu/gpu_surface_gl.h
+3
-0
shell/platform/android/android_shell_holder.cc
shell/platform/android/android_shell_holder.cc
+15
-43
shell/platform/android/android_shell_holder.h
shell/platform/android/android_shell_holder.h
+0
-8
shell/platform/android/android_surface_gl.cc
shell/platform/android/android_surface_gl.cc
+0
-3
shell/platform/android/android_surface_software.cc
shell/platform/android/android_surface_software.cc
+0
-3
shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java
...lutter/embedding/engine/loader/ApplicationInfoLoader.java
+1
-7
shell/platform/android/io/flutter/embedding/engine/loader/FlutterApplicationInfo.java
...utter/embedding/engine/loader/FlutterApplicationInfo.java
+1
-6
shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java
...oid/io/flutter/embedding/engine/loader/FlutterLoader.java
+0
-3
shell/platform/android/test/io/flutter/embedding/engine/loader/ApplicationInfoLoaderTest.java
...er/embedding/engine/loader/ApplicationInfoLoaderTest.java
+0
-3
testing/scenario_app/android/app/src/main/AndroidManifest.xml
...ing/scenario_app/android/app/src/main/AndroidManifest.xml
+0
-3
未找到文件。
common/settings.h
浏览文件 @
5e54c707
...
...
@@ -223,15 +223,6 @@ struct Settings {
/// to log a timeline event that tracks the latency of engine startup.
std
::
chrono
::
microseconds
engine_start_timestamp
=
{};
/// Whether the application claims that it uses the android embedded view for
/// platform views.
///
/// A `true` value will result the raster task runner always run on the
/// platform thread.
// TODO(cyanlaz): Remove this when dynamic thread merging is done.
// https://github.com/flutter/flutter/issues/59930
bool
use_embedded_view
=
false
;
std
::
string
ToString
()
const
;
};
...
...
flow/surface.cc
浏览文件 @
5e54c707
...
...
@@ -18,4 +18,8 @@ std::unique_ptr<GLContextResult> Surface::MakeRenderContextCurrent() {
return
std
::
make_unique
<
GLContextDefaultResult
>
(
true
);
}
bool
Surface
::
ClearRenderContext
()
{
return
false
;
}
}
// namespace flutter
flow/surface.h
浏览文件 @
5e54c707
...
...
@@ -33,6 +33,8 @@ class Surface {
virtual
std
::
unique_ptr
<
GLContextResult
>
MakeRenderContextCurrent
();
virtual
bool
ClearRenderContext
();
private:
FML_DISALLOW_COPY_AND_ASSIGN
(
Surface
);
};
...
...
shell/common/rasterizer.cc
浏览文件 @
5e54c707
...
...
@@ -178,6 +178,10 @@ void Rasterizer::Draw(fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline) {
consume_result
=
PipelineConsumeResult
::
MoreAvailable
;
}
if
(
surface_
!=
nullptr
)
{
surface_
->
ClearRenderContext
();
}
// Merging the thread as we know the next `Draw` should be run on the platform
// thread.
if
(
surface_
!=
nullptr
&&
surface_
->
GetExternalViewEmbedder
()
!=
nullptr
)
{
...
...
shell/common/switches.cc
浏览文件 @
5e54c707
...
...
@@ -229,9 +229,6 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
:
"127.0.0.1"
;
}
settings
.
use_embedded_view
=
command_line
.
HasOption
(
FlagForSwitch
(
Switch
::
UseEmbeddedView
));
// Set Observatory Port
if
(
command_line
.
HasOption
(
FlagForSwitch
(
Switch
::
DeviceObservatoryPort
)))
{
if
(
!
GetSwitchValue
(
command_line
,
Switch
::
DeviceObservatoryPort
,
...
...
shell/common/switches.h
浏览文件 @
5e54c707
...
...
@@ -196,15 +196,7 @@ DEF_SWITCH(
"Uses separate threads for the platform, UI, GPU and IO task runners. "
"By default, a single thread is used for all task runners. Only available "
"in the flutter_tester."
)
// TODO(cyanlaz): Remove this when dynamic thread merging is done.
// https://github.com/flutter/flutter/issues/59930
DEF_SWITCH
(
UseEmbeddedView
,
"use-embedded-view"
,
"Whether an android application uses embedded views."
"This is a temporary flag to make the raster task runner runs on "
"the platform thread."
"This flag should be removed once the dynamic thread merging is "
"enabled on android."
)
DEF_SWITCHES_END
void
PrintUsage
(
const
std
::
string
&
executable_name
);
...
...
shell/gpu/gpu_surface_gl.cc
浏览文件 @
5e54c707
...
...
@@ -346,4 +346,9 @@ std::unique_ptr<GLContextResult> GPUSurfaceGL::MakeRenderContextCurrent() {
return
delegate_
->
GLContextMakeCurrent
();
}
// |Surface|
bool
GPUSurfaceGL
::
ClearRenderContext
()
{
return
delegate_
->
GLContextClearCurrent
();
}
}
// namespace flutter
shell/gpu/gpu_surface_gl.h
浏览文件 @
5e54c707
...
...
@@ -48,6 +48,9 @@ class GPUSurfaceGL : public Surface {
// |Surface|
std
::
unique_ptr
<
GLContextResult
>
MakeRenderContextCurrent
()
override
;
// |Surface|
bool
ClearRenderContext
()
override
;
private:
GPUSurfaceGLDelegate
*
delegate_
;
sk_sp
<
GrDirectContext
>
context_
;
...
...
shell/platform/android/android_shell_holder.cc
浏览文件 @
5e54c707
...
...
@@ -28,8 +28,6 @@ static PlatformData GetDefaultPlatformData() {
return
platform_data
;
}
bool
AndroidShellHolder
::
use_embedded_view
;
AndroidShellHolder
::
AndroidShellHolder
(
flutter
::
Settings
settings
,
std
::
shared_ptr
<
PlatformViewAndroidJNI
>
jni_facade
,
...
...
@@ -102,47 +100,21 @@ AndroidShellHolder::AndroidShellHolder(
ui_runner
=
thread_host_
.
ui_thread
->
GetTaskRunner
();
io_runner
=
thread_host_
.
io_thread
->
GetTaskRunner
();
}
if
(
settings
.
use_embedded_view
)
{
use_embedded_view
=
true
;
// Embedded views requires the gpu and the platform views to be the same.
// The plan is to eventually dynamically merge the threads when there's a
// platform view in the layer tree.
// For now we use a fixed thread configuration with the same thread used as
// the gpu and platform task runner.
// TODO(amirh/chinmaygarde): remove this, and dynamically change the thread
// configuration. https://github.com/flutter/flutter/issues/23975
// https://github.com/flutter/flutter/issues/59930
flutter
::
TaskRunners
task_runners
(
thread_label
,
// label
platform_runner
,
// platform
platform_runner
,
// raster
ui_runner
,
// ui
io_runner
// io
);
shell_
=
Shell
::
Create
(
task_runners
,
// task runners
GetDefaultPlatformData
(),
// window data
settings_
,
// settings
on_create_platform_view
,
// platform view create callback
on_create_rasterizer
// rasterizer create callback
);
}
else
{
use_embedded_view
=
false
;
flutter
::
TaskRunners
task_runners
(
thread_label
,
// label
platform_runner
,
// platform
gpu_runner
,
// raster
ui_runner
,
// ui
io_runner
// io
);
shell_
=
Shell
::
Create
(
task_runners
,
// task runners
GetDefaultPlatformData
(),
// window data
settings_
,
// settings
on_create_platform_view
,
// platform view create callback
on_create_rasterizer
// rasterizer create callback
);
}
flutter
::
TaskRunners
task_runners
(
thread_label
,
// label
platform_runner
,
// platform
gpu_runner
,
// raster
ui_runner
,
// ui
io_runner
// io
);
shell_
=
Shell
::
Create
(
task_runners
,
// task runners
GetDefaultPlatformData
(),
// window data
settings_
,
// settings
on_create_platform_view
,
// platform view create callback
on_create_rasterizer
// rasterizer create callback
);
platform_view_
=
weak_platform_view
;
FML_DCHECK
(
platform_view_
);
...
...
shell/platform/android/android_shell_holder.h
浏览文件 @
5e54c707
...
...
@@ -21,14 +21,6 @@ namespace flutter {
class
AndroidShellHolder
{
public:
// Whether the application sets to use embedded_view view
// `io.flutter.embedded_views_preview` flag. This can be static because it is
// determined by the application and it is safe when there are multiple
// `AndroidSurface`s.
// TODO(cyanglaz): remove this when dynamic thread merging is enabled on
// android. https://github.com/flutter/flutter/issues/59930
static
bool
use_embedded_view
;
AndroidShellHolder
(
flutter
::
Settings
settings
,
std
::
shared_ptr
<
PlatformViewAndroidJNI
>
jni_facade
,
bool
is_background_view
);
...
...
shell/platform/android/android_surface_gl.cc
浏览文件 @
5e54c707
...
...
@@ -127,9 +127,6 @@ intptr_t AndroidSurfaceGL::GLContextFBO(GLFrameInfo frame_info) const {
// |GPUSurfaceGLDelegate|
ExternalViewEmbedder
*
AndroidSurfaceGL
::
GetExternalViewEmbedder
()
{
if
(
!
AndroidShellHolder
::
use_embedded_view
)
{
return
nullptr
;
}
return
external_view_embedder_
.
get
();
}
...
...
shell/platform/android/android_surface_software.cc
浏览文件 @
5e54c707
...
...
@@ -146,9 +146,6 @@ bool AndroidSurfaceSoftware::PresentBackingStore(
// |GPUSurfaceSoftwareDelegate|
ExternalViewEmbedder
*
AndroidSurfaceSoftware
::
GetExternalViewEmbedder
()
{
if
(
!
AndroidShellHolder
::
use_embedded_view
)
{
return
nullptr
;
}
return
external_view_embedder_
.
get
();
}
...
...
shell/platform/android/io/flutter/embedding/engine/loader/ApplicationInfoLoader.java
浏览文件 @
5e54c707
...
...
@@ -79,11 +79,6 @@ final class ApplicationInfoLoader {
return
output
.
toString
();
}
private
static
boolean
getUseEmbeddedView
(
ApplicationInfo
appInfo
)
{
Bundle
bundle
=
appInfo
.
metaData
;
return
bundle
!=
null
&&
bundle
.
getBoolean
(
"io.flutter.embedded_views_preview"
);
}
private
static
void
parseDomainConfig
(
XmlResourceParser
xrp
,
JSONArray
output
,
boolean
inheritedCleartextPermitted
)
throws
IOException
,
XmlPullParserException
{
...
...
@@ -155,7 +150,6 @@ final class ApplicationInfoLoader {
getString
(
appInfo
.
metaData
,
PUBLIC_FLUTTER_ASSETS_DIR_KEY
),
getNetworkPolicy
(
appInfo
,
applicationContext
),
appInfo
.
nativeLibraryDir
,
clearTextPermitted
,
getUseEmbeddedView
(
appInfo
));
clearTextPermitted
);
}
}
shell/platform/android/io/flutter/embedding/engine/loader/FlutterApplicationInfo.java
浏览文件 @
5e54c707
...
...
@@ -18,9 +18,6 @@ public final class FlutterApplicationInfo {
final
String
domainNetworkPolicy
;
final
String
nativeLibraryDir
;
final
boolean
clearTextPermitted
;
// TODO(cyanlaz): Remove this when dynamic thread merging is done.
// https://github.com/flutter/flutter/issues/59930
final
boolean
useEmbeddedView
;
public
FlutterApplicationInfo
(
String
aotSharedLibraryName
,
...
...
@@ -29,8 +26,7 @@ public final class FlutterApplicationInfo {
String
flutterAssetsDir
,
String
domainNetworkPolicy
,
String
nativeLibraryDir
,
boolean
clearTextPermitted
,
boolean
useEmbeddedView
)
{
boolean
clearTextPermitted
)
{
this
.
aotSharedLibraryName
=
aotSharedLibraryName
==
null
?
DEFAULT_AOT_SHARED_LIBRARY_NAME
:
aotSharedLibraryName
;
this
.
vmSnapshotData
=
vmSnapshotData
==
null
?
DEFAULT_VM_SNAPSHOT_DATA
:
vmSnapshotData
;
...
...
@@ -41,6 +37,5 @@ public final class FlutterApplicationInfo {
this
.
nativeLibraryDir
=
nativeLibraryDir
;
this
.
domainNetworkPolicy
=
domainNetworkPolicy
==
null
?
""
:
domainNetworkPolicy
;
this
.
clearTextPermitted
=
clearTextPermitted
;
this
.
useEmbeddedView
=
useEmbeddedView
;
}
}
shell/platform/android/io/flutter/embedding/engine/loader/FlutterLoader.java
浏览文件 @
5e54c707
...
...
@@ -221,9 +221,6 @@ public class FlutterLoader {
if
(
flutterApplicationInfo
.
domainNetworkPolicy
!=
null
)
{
shellArgs
.
add
(
"--domain-network-policy="
+
flutterApplicationInfo
.
domainNetworkPolicy
);
}
if
(
flutterApplicationInfo
.
useEmbeddedView
)
{
shellArgs
.
add
(
"--use-embedded-view"
);
}
if
(
settings
.
getLogTag
()
!=
null
)
{
shellArgs
.
add
(
"--log-tag="
+
settings
.
getLogTag
());
}
...
...
shell/platform/android/test/io/flutter/embedding/engine/loader/ApplicationInfoLoaderTest.java
浏览文件 @
5e54c707
...
...
@@ -47,7 +47,6 @@ public class ApplicationInfoLoaderTest {
assertEquals
(
""
,
info
.
domainNetworkPolicy
);
assertNull
(
info
.
nativeLibraryDir
);
assertEquals
(
true
,
info
.
clearTextPermitted
);
assertEquals
(
false
,
info
.
useEmbeddedView
);
}
@Config
(
shadows
=
{
ApplicationInfoLoaderTest
.
ShadowNetworkSecurityPolicy
.
class
})
...
...
@@ -92,7 +91,6 @@ public class ApplicationInfoLoaderTest {
bundle
.
putString
(
ApplicationInfoLoader
.
PUBLIC_VM_SNAPSHOT_DATA_KEY
,
"testvmsnapshot"
);
bundle
.
putString
(
ApplicationInfoLoader
.
PUBLIC_ISOLATE_SNAPSHOT_DATA_KEY
,
"testisolatesnapshot"
);
bundle
.
putString
(
ApplicationInfoLoader
.
PUBLIC_FLUTTER_ASSETS_DIR_KEY
,
"testassets"
);
bundle
.
putBoolean
(
"io.flutter.embedded_views_preview"
,
true
);
Context
context
=
generateMockContext
(
bundle
,
null
);
FlutterApplicationInfo
info
=
ApplicationInfoLoader
.
load
(
context
);
assertNotNull
(
info
);
...
...
@@ -102,7 +100,6 @@ public class ApplicationInfoLoaderTest {
assertEquals
(
"testassets"
,
info
.
flutterAssetsDir
);
assertNull
(
info
.
nativeLibraryDir
);
assertEquals
(
""
,
info
.
domainNetworkPolicy
);
assertEquals
(
true
,
info
.
useEmbeddedView
);
}
@Test
...
...
testing/scenario_app/android/app/src/main/AndroidManifest.xml
浏览文件 @
5e54c707
...
...
@@ -35,9 +35,6 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<meta-data
android:name=
"io.flutter.embedded_views_preview"
android:value=
"true"
/>
</application>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
</manifest>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录