Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
9611d746
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,发现更多精彩内容 >>
提交
9611d746
编写于
12月 10, 2018
作者:
J
Jason Simmons
浏览文件
操作
浏览文件
下载
差异文件
Merge master branch into skia-master
上级
2b0687f1
3011c2b7
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
148 addition
and
271 deletion
+148
-271
DEPS
DEPS
+1
-1
ci/licenses_golden/licenses_flutter
ci/licenses_golden/licenses_flutter
+0
-2
common/settings.cc
common/settings.cc
+1
-3
common/settings.h
common/settings.h
+1
-4
lib/ui/compositing.dart
lib/ui/compositing.dart
+14
-1
runtime/dart_vm.cc
runtime/dart_vm.cc
+5
-5
shell/common/io_manager.cc
shell/common/io_manager.cc
+1
-0
shell/common/switches.cc
shell/common/switches.cc
+2
-8
shell/common/switches.h
shell/common/switches.h
+7
-9
shell/gpu/gpu_surface_gl.cc
shell/gpu/gpu_surface_gl.cc
+4
-0
shell/platform/android/io/flutter/view/FlutterNativeView.java
...l/platform/android/io/flutter/view/FlutterNativeView.java
+20
-12
shell/platform/android/io/flutter/view/FlutterRunArguments.java
...platform/android/io/flutter/view/FlutterRunArguments.java
+1
-0
shell/platform/android/platform_view_android_jni.cc
shell/platform/android/platform_view_android_jni.cc
+21
-27
shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm
...latform/darwin/ios/framework/Source/FlutterDartProject.mm
+0
-9
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
...form/darwin/ios/framework/Source/FlutterViewController.mm
+21
-4
shell/platform/embedder/embedder.cc
shell/platform/embedder/embedder.cc
+5
-11
shell/testing/tester_main.cc
shell/testing/tester_main.cc
+7
-7
third_party/txt/src/txt/paragraph.cc
third_party/txt/src/txt/paragraph.cc
+6
-2
vulkan/BUILD.gn
vulkan/BUILD.gn
+2
-9
vulkan/vulkan_device.cc
vulkan/vulkan_device.cc
+8
-1
vulkan/vulkan_interface.cc
vulkan/vulkan_interface.cc
+3
-23
vulkan/vulkan_interface.h
vulkan/vulkan_interface.h
+3
-0
vulkan/vulkan_native_surface_magma.cc
vulkan/vulkan_native_surface_magma.cc
+0
-66
vulkan/vulkan_native_surface_magma.h
vulkan/vulkan_native_surface_magma.h
+0
-43
vulkan/vulkan_proc_table.cc
vulkan/vulkan_proc_table.cc
+9
-16
vulkan/vulkan_proc_table.h
vulkan/vulkan_proc_table.h
+6
-8
未找到文件。
DEPS
浏览文件 @
9611d746
...
...
@@ -104,7 +104,7 @@ vars = {
# Build bot tooling for iOS
'ios_tools_revision': '69b7c1b160e7107a6a98d948363772dc9caea46f',
'buildtools_revision': '
5a9e1b3a0b84a2871f20f85fde665e54a894ba72
',
'buildtools_revision': '
bac220c15490dcf7b7d8136f75100bbc77e8d217
',
}
# Only these hosts are allowed for dependencies in this DEPS file.
...
...
ci/licenses_golden/licenses_flutter
浏览文件 @
9611d746
...
...
@@ -594,8 +594,6 @@ FILE: ../../../flutter/vulkan/vulkan_native_surface.cc
FILE: ../../../flutter/vulkan/vulkan_native_surface.h
FILE: ../../../flutter/vulkan/vulkan_native_surface_android.cc
FILE: ../../../flutter/vulkan/vulkan_native_surface_android.h
FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.cc
FILE: ../../../flutter/vulkan/vulkan_native_surface_magma.h
FILE: ../../../flutter/vulkan/vulkan_proc_table.cc
FILE: ../../../flutter/vulkan/vulkan_proc_table.h
FILE: ../../../flutter/vulkan/vulkan_provider.cc
...
...
common/settings.cc
浏览文件 @
9611d746
...
...
@@ -25,8 +25,6 @@ std::string Settings::ToString() const {
<<
std
::
endl
;
stream
<<
"application_library_path: "
<<
application_library_path
<<
std
::
endl
;
stream
<<
"main_dart_file_path: "
<<
main_dart_file_path
<<
std
::
endl
;
stream
<<
"packages_file_path: "
<<
packages_file_path
<<
std
::
endl
;
stream
<<
"temp_directory_path: "
<<
temp_directory_path
<<
std
::
endl
;
stream
<<
"dart_flags:"
<<
std
::
endl
;
for
(
const
auto
&
dart_flag
:
dart_flags
)
{
...
...
@@ -37,7 +35,7 @@ std::string Settings::ToString() const {
stream
<<
"trace_startup: "
<<
trace_startup
<<
std
::
endl
;
stream
<<
"endless_trace_buffer: "
<<
endless_trace_buffer
<<
std
::
endl
;
stream
<<
"enable_dart_profiling: "
<<
enable_dart_profiling
<<
std
::
endl
;
stream
<<
"d
art_non_checked_mode: "
<<
dart_non_checked_mode
<<
std
::
endl
;
stream
<<
"d
isable_dart_asserts: "
<<
disable_dart_asserts
<<
std
::
endl
;
stream
<<
"enable_observatory: "
<<
enable_observatory
<<
std
::
endl
;
stream
<<
"observatory_port: "
<<
observatory_port
<<
std
::
endl
;
stream
<<
"ipv6: "
<<
ipv6
<<
std
::
endl
;
...
...
common/settings.h
浏览文件 @
9611d746
...
...
@@ -38,9 +38,6 @@ struct Settings {
std
::
string
application_kernel_asset
;
std
::
string
application_kernel_list_asset
;
std
::
string
main_dart_file_path
;
std
::
string
packages_file_path
;
std
::
string
temp_directory_path
;
std
::
vector
<
std
::
string
>
dart_flags
;
...
...
@@ -50,7 +47,7 @@ struct Settings {
bool
trace_startup
=
false
;
bool
endless_trace_buffer
=
false
;
bool
enable_dart_profiling
=
false
;
bool
d
art_non_checked_mode
=
false
;
bool
d
isable_dart_asserts
=
false
;
// Used as the script URI in debug messages. Does not affect how the Dart code
// is executed.
std
::
string
advisory_script_uri
=
"main.dart"
;
...
...
lib/ui/compositing.dart
浏览文件 @
9611d746
...
...
@@ -274,7 +274,20 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
/// Adds a platform view (e.g an iOS UIView) to the scene.
///
/// This is work in progress and is not currently supported on any platform.
/// Only supported on iOS, this is currently a no-op on other platforms.
///
/// On iOS this layer splits the current output surface into two surfaces, one for the scene nodes
/// preceding the platform view, and one for the scene nodes following the platform view.
///
/// ## Performance impact
///
/// Adding an additional surface doubles the amount of graphics memory directly used by Flutter
/// for output buffers. Quartz might allocated extra buffers for compositing the Flutter surfaces
/// and the platform view.
///
/// With a platform view in the scene, Quartz has to composite the two Flutter surfaces and the
/// embedded UIView. In addition to that, on iOS versions greater than 9, the Flutter frames are
/// synchronized with the UIView frames adding additional performance overhead.
void
addPlatformView
(
int
viewId
,
{
Offset
offset:
Offset
.
zero
,
double
width:
0.0
,
double
height:
0.0
})
{
assert
(
offset
!=
null
,
'Offset argument was null'
);
_addPlatformView
(
offset
.
dx
,
offset
.
dy
,
width
,
height
,
viewId
);
...
...
runtime/dart_vm.cc
浏览文件 @
9611d746
...
...
@@ -325,18 +325,18 @@ DartVM::DartVM(const Settings& settings,
arraysize
(
kDartPrecompilationArgs
));
}
// Enable
checked mode
if we are not running precompiled code. We run non-
// Enable
Dart assertions
if we are not running precompiled code. We run non-
// precompiled code only in the debug product mode.
bool
use_checked_mode
=
!
settings
.
dart_non_checked_mode
;
bool
enable_asserts
=
!
settings
.
disable_dart_asserts
;
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_PROFILE || \
FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DYNAMIC_RELEASE
use_checked_mode
=
false
;
enable_asserts
=
false
;
#endif
#if !OS_FUCHSIA
if
(
IsRunningPrecompiledCode
())
{
use_checked_mode
=
false
;
enable_asserts
=
false
;
}
#endif // !OS_FUCHSIA
...
...
@@ -347,7 +347,7 @@ DartVM::DartVM(const Settings& settings,
arraysize
(
kDartWriteProtectCodeArgs
));
#endif
if
(
use_checked_mode
)
{
if
(
enable_asserts
)
{
PushBackAll
(
&
args
,
kDartAssertArgs
,
arraysize
(
kDartAssertArgs
));
}
...
...
shell/common/io_manager.cc
浏览文件 @
9611d746
...
...
@@ -24,6 +24,7 @@ sk_sp<GrContext> IOManager::CreateCompatibleResourceLoadingContext(
// thread. The necessary work isn't being flushed or synchronized with the
// other threads correctly, so the textures end up blank. For now, suppress
// that feature, which will cause texture uploads to do CPU YUV conversion.
// A similar work-around is also used in shell/gpu/gpu_surface_gl.cc.
options
.
fDisableGpuYUVConversion
=
true
;
// To get video playback on the widest range of devices, we limit Skia to
...
...
shell/common/switches.cc
浏览文件 @
9611d746
...
...
@@ -139,8 +139,8 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
}
// Checked mode overrides.
settings
.
d
art_non_checked_mode
=
command_line
.
HasOption
(
FlagForSwitch
(
Switch
::
D
artNonCheckedMode
));
settings
.
d
isable_dart_asserts
=
command_line
.
HasOption
(
FlagForSwitch
(
Switch
::
D
isableDartAsserts
));
settings
.
ipv6
=
command_line
.
HasOption
(
FlagForSwitch
(
Switch
::
IPv6
));
...
...
@@ -170,12 +170,6 @@ blink::Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
command_line
.
GetOptionValue
(
FlagForSwitch
(
Switch
::
FlutterAssetsDir
),
&
settings
.
assets_path
);
command_line
.
GetOptionValue
(
FlagForSwitch
(
Switch
::
MainDartFile
),
&
settings
.
main_dart_file_path
);
command_line
.
GetOptionValue
(
FlagForSwitch
(
Switch
::
Packages
),
&
settings
.
packages_file_path
);
std
::
string
aot_shared_library_path
;
command_line
.
GetOptionValue
(
FlagForSwitch
(
Switch
::
AotSharedLibraryPath
),
&
aot_shared_library_path
);
...
...
shell/common/switches.h
浏览文件 @
9611d746
...
...
@@ -92,8 +92,6 @@ DEF_SWITCH(FlutterAssetsDir,
"Path to the Flutter assets directory."
)
DEF_SWITCH
(
Help
,
"help"
,
"Display this help text."
)
DEF_SWITCH
(
LogTag
,
"log-tag"
,
"Tag associated with log messages."
)
DEF_SWITCH
(
MainDartFile
,
"dart-main"
,
"The path to the main Dart file."
)
DEF_SWITCH
(
Packages
,
"packages"
,
"Specify the path to the packages."
)
DEF_SWITCH
(
StartPaused
,
"start-paused"
,
"Start the application paused in the Dart debugger."
)
...
...
@@ -122,13 +120,13 @@ DEF_SWITCH(RunForever,
"run-forever"
,
"In non-interactive mode, keep the shell running after the Dart "
"script has completed."
)
DEF_SWITCH
(
D
artNonCheckedMode
,
"d
art-non-checked-mode
"
,
"Dart code runs
in checked mode when the runtime mode is debug. In
"
"
profile and release product modes, the application code is
"
"
precompiled and checked mode is unsupported. However, this flag
"
"
may be specified if the user wishes to run in the debug product
"
"
mode (i.e. with JIT or DBC) with checked mode off
."
)
DEF_SWITCH
(
D
isableDartAsserts
,
"d
isable-dart-asserts
"
,
"Dart code runs
with assertions enabled when the runtime mode is
"
"
debug. In profile and release product modes, assertions are
"
"
disabled. This flag may be specified if the user wishes to run
"
"
with assertions disabled in the debug product mode (i.e. with JIT
"
"
or DBC)
."
)
DEF_SWITCHES_END
void
PrintUsage
(
const
std
::
string
&
executable_name
);
...
...
shell/gpu/gpu_surface_gl.cc
浏览文件 @
9611d746
...
...
@@ -56,6 +56,10 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate)
// ES2 shading language when the ES3 external image extension is missing.
options
.
fPreferExternalImagesOverES3
=
true
;
// TODO(goderbauer): remove option when skbug.com/7523 is fixed.
// A similar work-around is also used in shell/common/io_manager.cc.
options
.
fDisableGpuYUVConversion
=
true
;
sk_sp
<
const
GrGLInterface
>
interface
;
if
(
proc_resolver_
==
nullptr
)
{
...
...
shell/platform/android/io/flutter/view/FlutterNativeView.java
浏览文件 @
9611d746
...
...
@@ -76,12 +76,21 @@ public class FlutterNativeView implements BinaryMessenger {
}
public
void
runFromBundle
(
FlutterRunArguments
args
)
{
if
(
args
.
bundlePath
==
null
)
{
throw
new
AssertionError
(
"A bundlePath must be specified"
);
boolean
hasBundlePaths
=
args
.
bundlePaths
!=
null
&&
args
.
bundlePaths
.
length
!=
0
;
if
(
args
.
bundlePath
==
null
&&
!
hasBundlePaths
)
{
throw
new
AssertionError
(
"Either bundlePath or bundlePaths must be specified"
);
}
else
if
((
args
.
bundlePath
!=
null
||
args
.
defaultPath
!=
null
)
&&
hasBundlePaths
)
{
throw
new
AssertionError
(
"Can't specify both bundlePath and bundlePaths"
);
}
else
if
(
args
.
entrypoint
==
null
)
{
throw
new
AssertionError
(
"An entrypoint must be specified"
);
throw
new
AssertionError
(
"An entrypoint must be specified"
);
}
if
(
hasBundlePaths
)
{
runFromBundleInternal
(
args
.
bundlePaths
,
args
.
entrypoint
,
args
.
libraryPath
);
}
else
{
runFromBundleInternal
(
new
String
[]
{
args
.
bundlePath
,
args
.
defaultPath
},
args
.
entrypoint
,
args
.
libraryPath
);
}
runFromBundleInternal
(
args
.
bundlePath
,
args
.
entrypoint
,
args
.
libraryPath
,
args
.
defaultPath
);
}
/**
...
...
@@ -92,17 +101,17 @@ public class FlutterNativeView implements BinaryMessenger {
@Deprecated
public
void
runFromBundle
(
String
bundlePath
,
String
defaultPath
,
String
entrypoint
,
boolean
reuseRuntimeController
)
{
runFromBundleInternal
(
bundlePath
,
entrypoint
,
null
,
defaultPath
);
runFromBundleInternal
(
new
String
[]
{
bundlePath
,
defaultPath
},
entrypoint
,
null
);
}
private
void
runFromBundleInternal
(
String
bundlePath
,
String
entrypoint
,
String
libraryPath
,
String
defaultPath
)
{
private
void
runFromBundleInternal
(
String
[]
bundlePaths
,
String
entrypoint
,
String
libraryPath
)
{
assertAttached
();
if
(
applicationIsRunning
)
throw
new
AssertionError
(
"This Flutter engine instance is already running an application"
);
nativeRunBundleAndSnapshotFromLibrary
(
mNativePlatformView
,
bundlePath
,
defaultPath
,
entrypoint
,
libraryPath
,
mContext
.
getResources
().
getAssets
());
nativeRunBundleAndSnapshotFromLibrary
(
mNativePlatformView
,
bundlePath
s
,
entrypoint
,
libraryPath
,
mContext
.
getResources
().
getAssets
());
applicationIsRunning
=
true
;
}
...
...
@@ -240,9 +249,8 @@ public class FlutterNativeView implements BinaryMessenger {
private
static
native
void
nativeDetach
(
long
nativePlatformViewAndroid
);
private
static
native
void
nativeRunBundleAndSnapshotFromLibrary
(
long
nativePlatformViewAndroid
,
String
bundlePath
,
String
defaultPath
,
String
entrypoint
,
String
libraryUrl
,
AssetManager
manager
);
long
nativePlatformViewAndroid
,
String
[]
bundlePaths
,
String
entrypoint
,
String
libraryUrl
,
AssetManager
manager
);
private
static
native
String
nativeGetObservatoryUri
();
...
...
shell/platform/android/io/flutter/view/FlutterRunArguments.java
浏览文件 @
9611d746
...
...
@@ -9,6 +9,7 @@ package io.flutter.view;
* the first time.
*/
public
class
FlutterRunArguments
{
public
String
[]
bundlePaths
;
public
String
bundlePath
;
public
String
entrypoint
;
public
String
libraryPath
;
...
...
shell/platform/android/platform_view_android_jni.cc
浏览文件 @
9611d746
...
...
@@ -236,15 +236,17 @@ std::unique_ptr<IsolateConfiguration> CreateIsolateConfiguration(
static
void
RunBundleAndSnapshotFromLibrary
(
JNIEnv
*
env
,
jobject
jcaller
,
jlong
shell_holder
,
jstring
jbundlepath
,
jstring
jdefaultPath
,
jobjectArray
jbundlepaths
,
jstring
jEntrypoint
,
jstring
jLibraryUrl
,
jobject
jAssetManager
)
{
auto
asset_manager
=
std
::
make_shared
<
blink
::
AssetManager
>
();
for
(
const
auto
&
bundlepath
:
fml
::
jni
::
StringArrayToVector
(
env
,
jbundlepaths
))
{
if
(
bundlepath
.
empty
())
{
continue
;
}
const
auto
bundlepath
=
fml
::
jni
::
JavaStringToString
(
env
,
jbundlepath
);
if
(
bundlepath
.
size
()
>
0
)
{
// If we got a bundle path, attempt to use that as a directory asset
// bundle or a zip asset bundle.
const
auto
file_ext_index
=
bundlepath
.
rfind
(
"."
);
...
...
@@ -255,30 +257,23 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env,
asset_manager
->
PushBack
(
std
::
make_unique
<
blink
::
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
bundlepath
.
c_str
(),
false
,
fml
::
FilePermission
::
kRead
)));
}
// Use the last path component of the bundle path to determine the
// directory in the APK assets.
const
auto
last_slash_index
=
bundlepath
.
rfind
(
"/"
,
bundlepath
.
size
());
if
(
last_slash_index
!=
std
::
string
::
npos
)
{
auto
apk_asset_dir
=
bundlepath
.
substr
(
last_slash_index
+
1
,
bundlepath
.
size
()
-
last_slash_index
);
asset_manager
->
PushBack
(
std
::
make_unique
<
blink
::
APKAssetProvider
>
(
env
,
// jni environment
jAssetManager
,
// asset manager
std
::
move
(
apk_asset_dir
))
// apk asset dir
);
// Use the last path component of the bundle path to determine the
// directory in the APK assets.
const
auto
last_slash_index
=
bundlepath
.
rfind
(
"/"
,
bundlepath
.
size
());
if
(
last_slash_index
!=
std
::
string
::
npos
)
{
auto
apk_asset_dir
=
bundlepath
.
substr
(
last_slash_index
+
1
,
bundlepath
.
size
()
-
last_slash_index
);
asset_manager
->
PushBack
(
std
::
make_unique
<
blink
::
APKAssetProvider
>
(
env
,
// jni environment
jAssetManager
,
// asset manager
std
::
move
(
apk_asset_dir
))
// apk asset dir
);
}
}
}
const
auto
defaultpath
=
fml
::
jni
::
JavaStringToString
(
env
,
jdefaultPath
);
if
(
defaultpath
.
size
()
>
0
)
{
asset_manager
->
PushBack
(
std
::
make_unique
<
blink
::
DirectoryAssetBundle
>
(
fml
::
OpenDirectory
(
defaultpath
.
c_str
(),
false
,
fml
::
FilePermission
::
kRead
)));
}
auto
isolate_configuration
=
CreateIsolateConfiguration
(
*
asset_manager
);
if
(
!
isolate_configuration
)
{
FML_DLOG
(
ERROR
)
...
...
@@ -591,9 +586,8 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
},
{
.
name
=
"nativeRunBundleAndSnapshotFromLibrary"
,
.
signature
=
"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;"
"Ljava/lang/String;Landroid/content/res/AssetManager;)V"
,
.
signature
=
"(J[Ljava/lang/String;Ljava/lang/String;"
"Ljava/lang/String;Landroid/content/res/AssetManager;)V"
,
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
shell
::
RunBundleAndSnapshotFromLibrary
),
},
...
...
shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm
浏览文件 @
9611d746
...
...
@@ -157,15 +157,6 @@ static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) {
if
(
self
)
{
_settings
=
DefaultSettingsForProcess
();
if
(
dartMainURL
!=
nil
&&
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:
dartMainURL
.
path
])
{
_settings
.
main_dart_file_path
=
dartMainURL
.
path
.
UTF8String
;
}
if
(
dartPackages
.
path
!=
nil
&&
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:
dartPackages
.
path
])
{
_settings
.
packages_file_path
=
dartPackages
.
path
.
UTF8String
;
}
}
return
self
;
...
...
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
浏览文件 @
9611d746
...
...
@@ -748,18 +748,35 @@ static blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* touch) {
-
(
void
)
onLocaleUpdated
:(
NSNotification
*
)
notification
{
NSArray
<
NSString
*>*
preferredLocales
=
[
NSLocale
preferredLanguages
];
NSMutableArray
<
NSString
*>*
data
=
[
NSMutableArray
new
];
NSMutableArray
<
NSString
*>*
data
=
[[
NSMutableArray
new
]
autorelease
];
// Force prepend the [NSLocale currentLocale] to the front of the list
// to ensure we are including the full default locale. preferredLocales
// is not guaranteed to include anything beyond the languageCode.
NSLocale
*
currentLocale
=
[
NSLocale
currentLocale
];
NSString
*
languageCode
=
[
currentLocale
objectForKey
:
NSLocaleLanguageCode
];
NSString
*
countryCode
=
[
currentLocale
objectForKey
:
NSLocaleCountryCode
];
NSString
*
scriptCode
=
[
currentLocale
objectForKey
:
NSLocaleScriptCode
];
NSString
*
variantCode
=
[
currentLocale
objectForKey
:
NSLocaleVariantCode
];
if
(
languageCode
)
{
[
data
addObject
:
languageCode
];
[
data
addObject
:(
countryCode
?
countryCode
:
@""
)];
[
data
addObject
:(
scriptCode
?
scriptCode
:
@""
)];
[
data
addObject
:(
variantCode
?
variantCode
:
@""
)];
}
// Add any secondary locales/languages to the list.
for
(
NSString
*
localeID
in
preferredLocales
)
{
NSLocale
*
currentLocale
=
[[
NSLocale
alloc
]
initWithLocaleIdentifier
:
localeID
];
NSLocale
*
currentLocale
=
[[
[
NSLocale
alloc
]
initWithLocaleIdentifier
:
localeID
]
autorelease
];
NSString
*
languageCode
=
[
currentLocale
objectForKey
:
NSLocaleLanguageCode
];
NSString
*
countryCode
=
[
currentLocale
objectForKey
:
NSLocaleCountryCode
];
NSString
*
scriptCode
=
[
currentLocale
objectForKey
:
NSLocaleScriptCode
];
NSString
*
variantCode
=
[
currentLocale
objectForKey
:
NSLocaleVariantCode
];
if
(
!
languageCode
||
!
countryCode
)
{
if
(
!
languageCode
)
{
continue
;
}
[
data
addObject
:
languageCode
];
[
data
addObject
:
countryCode
];
[
data
addObject
:
(
countryCode
?
countryCode
:
@""
)
];
[
data
addObject
:(
scriptCode
?
scriptCode
:
@""
)];
[
data
addObject
:(
variantCode
?
variantCode
:
@""
)];
}
...
...
shell/platform/embedder/embedder.cc
浏览文件 @
9611d746
...
...
@@ -266,9 +266,7 @@ FlutterResult FlutterEngineRun(size_t version,
return
kInvalidArguments
;
}
if
(
SAFE_ACCESS
(
args
,
assets_path
,
nullptr
)
==
nullptr
||
SAFE_ACCESS
(
args
,
main_path
,
nullptr
)
==
nullptr
||
SAFE_ACCESS
(
args
,
packages_path
,
nullptr
)
==
nullptr
)
{
if
(
SAFE_ACCESS
(
args
,
assets_path
,
nullptr
)
==
nullptr
)
{
return
kInvalidArguments
;
}
...
...
@@ -293,18 +291,14 @@ FlutterResult FlutterEngineRun(size_t version,
settings
.
icu_data_path
=
icu_data_path
;
settings
.
assets_path
=
args
->
assets_path
;
//
Check whether
the assets path contains Dart 2 kernel assets.
//
Verify
the assets path contains Dart 2 kernel assets.
const
std
::
string
kApplicationKernelSnapshotFileName
=
"kernel_blob.bin"
;
std
::
string
application_kernel_path
=
fml
::
paths
::
JoinPaths
(
{
settings
.
assets_path
,
kApplicationKernelSnapshotFileName
});
if
(
fml
::
IsFile
(
application_kernel_path
))
{
// Run from a kernel snapshot.
settings
.
application_kernel_asset
=
kApplicationKernelSnapshotFileName
;
}
else
{
// Run from a main Dart file.
settings
.
main_dart_file_path
=
args
->
main_path
;
settings
.
packages_file_path
=
args
->
packages_path
;
if
(
!
fml
::
IsFile
(
application_kernel_path
))
{
return
kInvalidArguments
;
}
settings
.
application_kernel_asset
=
kApplicationKernelSnapshotFileName
;
settings
.
task_observer_add
=
[](
intptr_t
key
,
fml
::
closure
callback
)
{
fml
::
MessageLoop
::
GetCurrent
().
AddTaskObserver
(
key
,
std
::
move
(
callback
));
...
...
shell/testing/tester_main.cc
浏览文件 @
9611d746
...
...
@@ -120,8 +120,8 @@ int RunTester(const blink::Settings& settings, bool run_forever) {
return
EXIT_FAILURE
;
}
if
(
settings
.
main_dart_file_path
.
empty
())
{
FML_LOG
(
ERROR
)
<<
"
Main dart
file not specified."
;
if
(
settings
.
application_kernel_asset
.
empty
())
{
FML_LOG
(
ERROR
)
<<
"
Dart kernel
file not specified."
;
return
EXIT_FAILURE
;
}
...
...
@@ -142,8 +142,8 @@ int RunTester(const blink::Settings& settings, bool run_forever) {
fml
::
FileMapping
::
Protection
::
kRead
};
auto
main_dart_file_mapping
=
std
::
make_unique
<
fml
::
FileMapping
>
(
fml
::
OpenFile
(
fml
::
paths
::
AbsolutePath
(
settings
.
main_dart_file_path
).
c_str
(),
false
,
fml
::
FilePermission
::
kRead
),
fml
::
paths
::
AbsolutePath
(
settings
.
application_kernel_asset
).
c_str
()
,
f
alse
,
f
ml
::
FilePermission
::
kRead
),
protection
);
auto
isolate_configuration
=
...
...
@@ -243,11 +243,11 @@ int main(int argc, char* argv[]) {
if
(
command_line
.
positional_args
().
size
()
>
0
)
{
// The tester may not use the switch for the main dart file path. Specifying
// it as a positional argument instead.
settings
.
main_dart_file_path
=
command_line
.
positional_args
()[
0
];
settings
.
application_kernel_asset
=
command_line
.
positional_args
()[
0
];
}
if
(
settings
.
main_dart_file_path
.
size
()
==
0
)
{
FML_LOG
(
ERROR
)
<<
"
Main dart file path
not specified."
;
if
(
settings
.
application_kernel_asset
.
size
()
==
0
)
{
FML_LOG
(
ERROR
)
<<
"
Dart kernel file
not specified."
;
return
EXIT_FAILURE
;
}
...
...
third_party/txt/src/txt/paragraph.cc
浏览文件 @
9611d746
...
...
@@ -479,8 +479,12 @@ void Paragraph::Layout(double width, bool force) {
}
}
// Exclude trailing whitespace from right-justified lines so the last
// visible character in the line will be flush with the right margin.
// TODO(garyq): Make GetRectsForRange return a zero-width box for the
// excluded whitespace such that the caret placement is correct regardless
// of the index being whitespace or not.
// Exclude trailing whitespace from right and center-justified lines so the
// last visible character in the line will be flush with the right margin.
size_t
line_end_index
=
(
paragraph_style_
.
effective_align
()
==
TextAlign
::
right
||
paragraph_style_
.
effective_align
()
==
TextAlign
::
center
)
...
...
vulkan/BUILD.gn
浏览文件 @
9611d746
...
...
@@ -35,8 +35,6 @@ source_set("vulkan") {
"vulkan_proc_table.h",
"vulkan_surface.cc",
"vulkan_surface.h",
"vulkan_swapchain.cc",
"vulkan_swapchain.h",
"vulkan_utilities.cc",
"vulkan_utilities.h",
"vulkan_window.cc",
...
...
@@ -47,13 +45,8 @@ source_set("vulkan") {
sources += [
"vulkan_native_surface_android.cc",
"vulkan_native_surface_android.h",
]
}
if (is_fuchsia) {
sources += [
"vulkan_native_surface_magma.cc",
"vulkan_native_surface_magma.h",
"vulkan_swapchain.cc",
"vulkan_swapchain.h",
]
}
...
...
vulkan/vulkan_device.cc
浏览文件 @
9611d746
...
...
@@ -58,7 +58,9 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
};
const
char
*
extensions
[]
=
{
#if OS_ANDROID
VK_KHR_SWAPCHAIN_EXTENSION_NAME
,
#endif
#if OS_FUCHSIA
VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME
,
VK_KHR_EXTERNAL_MEMORY_FUCHSIA_EXTENSION_NAME
,
...
...
@@ -177,6 +179,7 @@ uint32_t VulkanDevice::GetGraphicsQueueIndex() const {
bool
VulkanDevice
::
GetSurfaceCapabilities
(
const
VulkanSurface
&
surface
,
VkSurfaceCapabilitiesKHR
*
capabilities
)
const
{
#if OS_ANDROID
if
(
!
surface
.
IsValid
()
||
capabilities
==
nullptr
)
{
return
false
;
}
...
...
@@ -206,6 +209,9 @@ bool VulkanDevice::GetSurfaceCapabilities(
capabilities
->
currentExtent
.
width
=
size
.
width
();
capabilities
->
currentExtent
.
height
=
size
.
height
();
return
true
;
#else
return
false
;
#endif
}
bool
VulkanDevice
::
GetPhysicalDeviceFeatures
(
...
...
@@ -262,6 +268,7 @@ std::vector<VkQueueFamilyProperties> VulkanDevice::GetQueueFamilyProperties()
int
VulkanDevice
::
ChooseSurfaceFormat
(
const
VulkanSurface
&
surface
,
std
::
vector
<
VkFormat
>
desired_formats
,
VkSurfaceFormatKHR
*
format
)
const
{
#if OS_ANDROID
if
(
!
surface
.
IsValid
()
||
format
==
nullptr
)
{
return
-
1
;
}
...
...
@@ -297,7 +304,7 @@ int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface,
return
static_cast
<
int
>
(
i
);
}
}
#endif
return
-
1
;
}
...
...
vulkan/vulkan_interface.cc
浏览文件 @
9611d746
...
...
@@ -66,30 +66,10 @@ std::string VulkanResultToString(VkResult result) {
return
"VK_ERROR_INVALID_EXTERNAL_HANDLE"
;
case
VK_ERROR_OUT_OF_POOL_MEMORY
:
return
"VK_ERROR_OUT_OF_POOL_MEMORY"
;
#if VK_HEADER_VERSION >= 63
case
VK_ERROR_NOT_PERMITTED_EXT
:
return
"VK_ERROR_NOT_PERMITTED_EXT"
;
#endif
#if VK_HEADER_VERSION >= 72
case
VK_ERROR_FRAGMENTATION_EXT
:
return
"VK_ERROR_FRAGMENTATION_EXT"
;
#endif
#if OS_FUCHSIA
#if VK_KHR_external_memory
case
VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR
:
return
"VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR"
;
#elif VK_KHX_external_memory
case
VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX
:
return
"VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX"
;
#endif
case
VK_ERROR_OUT_OF_POOL_MEMORY_KHR
:
return
"VK_ERROR_OUT_OF_POOL_MEMORY_KHR"
;
#endif
default:
return
"Unknown Error"
;
}
return
"
Unknown Error
"
;
return
""
;
}
}
// namespace vulkan
vulkan/vulkan_interface.h
浏览文件 @
9611d746
...
...
@@ -22,6 +22,9 @@
#ifndef VK_USE_PLATFORM_MAGMA_KHR
#define VK_USE_PLATFORM_MAGMA_KHR 1
#endif // VK_USE_PLATFORM_MAGMA_KHR
#ifndef VK_USE_PLATFORM_FUCHSIA
#define VK_USE_PLATFORM_FUCHSIA 1
#endif // VK_USE_PLATFORM_FUCHSIA
#endif // OS_FUCHSIA
#if !VULKAN_LINK_STATICALLY
...
...
vulkan/vulkan_native_surface_magma.cc
已删除
100644 → 0
浏览文件 @
2b0687f1
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/vulkan/vulkan_native_surface_magma.h"
namespace
vulkan
{
VulkanNativeSurfaceMagma
::
VulkanNativeSurfaceMagma
()
=
default
;
VulkanNativeSurfaceMagma
::
VulkanNativeSurfaceMagma
(
int32_t
width
,
int32_t
height
)
{
size_
=
SkISize
::
Make
(
width
,
height
);
}
VulkanNativeSurfaceMagma
::~
VulkanNativeSurfaceMagma
()
=
default
;
const
char
*
VulkanNativeSurfaceMagma
::
GetExtensionName
()
const
{
return
VK_KHR_MAGMA_SURFACE_EXTENSION_NAME
;
}
uint32_t
VulkanNativeSurfaceMagma
::
GetSkiaExtensionName
()
const
{
// There is no counterpart in Skia that recognizes the Magma extension name.
// However, Flutter handles all setup anyway, so this is unnecessary.
return
0
;
}
VkSurfaceKHR
VulkanNativeSurfaceMagma
::
CreateSurfaceHandle
(
vulkan
::
VulkanProcTable
&
vk
,
const
vulkan
::
VulkanHandle
<
VkInstance
>&
instance
)
const
{
if
(
!
vk
.
IsValid
()
||
!
instance
)
{
return
VK_NULL_HANDLE
;
}
const
VkMagmaSurfaceCreateInfoKHR
create_info
=
{
.
sType
=
VK_STRUCTURE_TYPE_MAGMA_SURFACE_CREATE_INFO_KHR
,
.
pNext
=
nullptr
,
};
VkSurfaceKHR
surface
=
VK_NULL_HANDLE
;
if
(
VK_CALL_LOG_ERROR
(
vk
.
CreateMagmaSurfaceKHR
(
instance
,
&
create_info
,
nullptr
/* allocator */
,
&
surface
))
!=
VK_SUCCESS
)
{
return
VK_NULL_HANDLE
;
}
return
surface
;
}
bool
VulkanNativeSurfaceMagma
::
IsValid
()
const
{
// vkCreateMagmaSurfaceKHR doesn't actually take a native handle. So there is
// nothing to check the validity of.
return
true
;
}
SkISize
VulkanNativeSurfaceMagma
::
GetSize
()
const
{
if
(
size_
.
width
()
!=
0
&&
size_
.
height
()
!=
0
)
{
return
size_
;
}
else
{
// TODO: Don't hardcode this after we get a proper Fuchsia Display API.
return
SkISize
::
Make
(
2160
,
1440
);
}
}
}
// namespace vulkan
vulkan/vulkan_native_surface_magma.h
已删除
100644 → 0
浏览文件 @
2b0687f1
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_VULKAN_VULKAN_NATIVE_SURFACE_MAGMA_H_
#define FLUTTER_VULKAN_VULKAN_NATIVE_SURFACE_MAGMA_H_
#include "flutter/fml/macros.h"
#include "flutter/vulkan/vulkan_native_surface.h"
namespace
vulkan
{
class
VulkanNativeSurfaceMagma
:
public
vulkan
::
VulkanNativeSurface
{
public:
VulkanNativeSurfaceMagma
();
// Alternate constructor which allows the caller to specify the surface's
// width and height.
// TODO: Remove this once we have a Fuchsia Display API.
VulkanNativeSurfaceMagma
(
int32_t
surface_width
,
int32_t
surface_height
);
~
VulkanNativeSurfaceMagma
();
const
char
*
GetExtensionName
()
const
override
;
uint32_t
GetSkiaExtensionName
()
const
override
;
VkSurfaceKHR
CreateSurfaceHandle
(
vulkan
::
VulkanProcTable
&
vk
,
const
vulkan
::
VulkanHandle
<
VkInstance
>&
instance
)
const
override
;
bool
IsValid
()
const
override
;
SkISize
GetSize
()
const
override
;
private:
SkISize
size_
;
FML_DISALLOW_COPY_AND_ASSIGN
(
VulkanNativeSurfaceMagma
);
};
}
// namespace vulkan
#endif // FLUTTER_VULKAN_VULKAN_NATIVE_SURFACE_MAGMA_H_
vulkan/vulkan_proc_table.cc
浏览文件 @
9611d746
...
...
@@ -74,29 +74,20 @@ bool VulkanProcTable::SetupInstanceProcAddresses(
ACQUIRE_PROC
(
CreateDevice
,
handle
);
ACQUIRE_PROC
(
DestroyDevice
,
handle
);
ACQUIRE_PROC
(
DestroyInstance
,
handle
);
ACQUIRE_PROC
(
DestroySurfaceKHR
,
handle
);
ACQUIRE_PROC
(
EnumerateDeviceLayerProperties
,
handle
);
ACQUIRE_PROC
(
EnumeratePhysicalDevices
,
handle
);
ACQUIRE_PROC
(
GetDeviceProcAddr
,
handle
);
ACQUIRE_PROC
(
GetPhysicalDeviceFeatures
,
handle
);
ACQUIRE_PROC
(
GetPhysicalDeviceQueueFamilyProperties
,
handle
);
#if OS_ANDROID
ACQUIRE_PROC
(
GetPhysicalDeviceSurfaceCapabilitiesKHR
,
handle
);
ACQUIRE_PROC
(
GetPhysicalDeviceSurfaceFormatsKHR
,
handle
);
ACQUIRE_PROC
(
GetPhysicalDeviceSurfacePresentModesKHR
,
handle
);
ACQUIRE_PROC
(
GetPhysicalDeviceSurfaceSupportKHR
,
handle
);
#if OS_ANDROID
ACQUIRE_PROC
(
DestroySurfaceKHR
,
handle
);
ACQUIRE_PROC
(
CreateAndroidSurfaceKHR
,
handle
);
#endif // OS_ANDROID
#if OS_FUCHSIA
[
this
,
&
handle
]()
->
bool
{
ACQUIRE_PROC
(
CreateMagmaSurfaceKHR
,
handle
);
ACQUIRE_PROC
(
GetPhysicalDeviceMagmaPresentationSupportKHR
,
handle
);
return
true
;
}();
#endif // OS_FUCHSIA
// The debug report functions are optional. We don't want proc acquisition to
// fail here because the optional methods were not present (since ACQUIRE_PROC
// returns false on failure). Wrap the optional proc acquisitions in an
...
...
@@ -114,7 +105,6 @@ bool VulkanProcTable::SetupInstanceProcAddresses(
bool
VulkanProcTable
::
SetupDeviceProcAddresses
(
const
VulkanHandle
<
VkDevice
>&
handle
)
{
ACQUIRE_PROC
(
AcquireNextImageKHR
,
handle
);
ACQUIRE_PROC
(
AllocateCommandBuffers
,
handle
);
ACQUIRE_PROC
(
AllocateMemory
,
handle
);
ACQUIRE_PROC
(
BeginCommandBuffer
,
handle
);
...
...
@@ -124,25 +114,28 @@ bool VulkanProcTable::SetupDeviceProcAddresses(
ACQUIRE_PROC
(
CreateFence
,
handle
);
ACQUIRE_PROC
(
CreateImage
,
handle
);
ACQUIRE_PROC
(
CreateSemaphore
,
handle
);
ACQUIRE_PROC
(
CreateSwapchainKHR
,
handle
);
ACQUIRE_PROC
(
DestroyCommandPool
,
handle
);
ACQUIRE_PROC
(
DestroyFence
,
handle
);
ACQUIRE_PROC
(
DestroyImage
,
handle
);
ACQUIRE_PROC
(
DestroySemaphore
,
handle
);
ACQUIRE_PROC
(
DestroySwapchainKHR
,
handle
);
ACQUIRE_PROC
(
DeviceWaitIdle
,
handle
);
ACQUIRE_PROC
(
EndCommandBuffer
,
handle
);
ACQUIRE_PROC
(
FreeCommandBuffers
,
handle
);
ACQUIRE_PROC
(
FreeMemory
,
handle
);
ACQUIRE_PROC
(
GetDeviceQueue
,
handle
);
ACQUIRE_PROC
(
GetImageMemoryRequirements
,
handle
);
ACQUIRE_PROC
(
GetSwapchainImagesKHR
,
handle
);
ACQUIRE_PROC
(
QueuePresentKHR
,
handle
);
ACQUIRE_PROC
(
QueueSubmit
,
handle
);
ACQUIRE_PROC
(
QueueWaitIdle
,
handle
);
ACQUIRE_PROC
(
ResetCommandBuffer
,
handle
);
ACQUIRE_PROC
(
ResetFences
,
handle
);
ACQUIRE_PROC
(
WaitForFences
,
handle
);
#if OS_ANDROID
ACQUIRE_PROC
(
AcquireNextImageKHR
,
handle
);
ACQUIRE_PROC
(
CreateSwapchainKHR
,
handle
);
ACQUIRE_PROC
(
DestroySwapchainKHR
,
handle
);
ACQUIRE_PROC
(
GetSwapchainImagesKHR
,
handle
);
ACQUIRE_PROC
(
QueuePresentKHR
,
handle
);
#endif // OS_ANDROID
#if OS_FUCHSIA
ACQUIRE_PROC
(
GetMemoryFuchsiaHandleKHR
,
handle
);
ACQUIRE_PROC
(
ImportSemaphoreFuchsiaHandleKHR
,
handle
);
...
...
vulkan/vulkan_proc_table.h
浏览文件 @
9611d746
...
...
@@ -100,24 +100,22 @@ class VulkanProcTable : public fml::RefCountedThreadSafe<VulkanProcTable> {
DEFINE_PROC
(
GetInstanceProcAddr
);
DEFINE_PROC
(
GetPhysicalDeviceFeatures
);
DEFINE_PROC
(
GetPhysicalDeviceQueueFamilyProperties
);
DEFINE_PROC
(
GetPhysicalDeviceSurfaceCapabilitiesKHR
);
DEFINE_PROC
(
GetPhysicalDeviceSurfaceFormatsKHR
);
DEFINE_PROC
(
GetPhysicalDeviceSurfacePresentModesKHR
);
DEFINE_PROC
(
GetPhysicalDeviceSurfaceSupportKHR
);
DEFINE_PROC
(
GetSwapchainImagesKHR
);
DEFINE_PROC
(
QueuePresentKHR
);
DEFINE_PROC
(
QueueSubmit
);
DEFINE_PROC
(
QueueWaitIdle
);
DEFINE_PROC
(
ResetCommandBuffer
);
DEFINE_PROC
(
ResetFences
);
DEFINE_PROC
(
WaitForFences
);
#if OS_ANDROID
DEFINE_PROC
(
GetPhysicalDeviceSurfaceCapabilitiesKHR
);
DEFINE_PROC
(
GetPhysicalDeviceSurfaceFormatsKHR
);
DEFINE_PROC
(
GetPhysicalDeviceSurfacePresentModesKHR
);
DEFINE_PROC
(
GetPhysicalDeviceSurfaceSupportKHR
);
DEFINE_PROC
(
GetSwapchainImagesKHR
);
DEFINE_PROC
(
QueuePresentKHR
);
DEFINE_PROC
(
CreateAndroidSurfaceKHR
);
#endif // OS_ANDROID
#if OS_FUCHSIA
DEFINE_PROC
(
CreateMagmaSurfaceKHR
);
DEFINE_PROC
(
GetMemoryFuchsiaHandleKHR
);
DEFINE_PROC
(
GetPhysicalDeviceMagmaPresentationSupportKHR
);
DEFINE_PROC
(
ImportSemaphoreFuchsiaHandleKHR
);
#endif // OS_FUCHSIA
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录