Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
5442c0a7
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,发现更多精彩内容 >>
未验证
提交
5442c0a7
编写于
8月 06, 2018
作者:
A
Alexander Markov
提交者:
GitHub
8月 06, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Updated background execution implementation for Android" (#5949)
This reverts commit
bc885f31
.
上级
a5215ce5
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
115 addition
and
330 deletion
+115
-330
shell/platform/android/BUILD.gn
shell/platform/android/BUILD.gn
+0
-2
shell/platform/android/android_shell_holder.cc
shell/platform/android/android_shell_holder.cc
+23
-55
shell/platform/android/android_shell_holder.h
shell/platform/android/android_shell_holder.h
+1
-2
shell/platform/android/io/flutter/app/FlutterActivityDelegate.java
...tform/android/io/flutter/app/FlutterActivityDelegate.java
+14
-10
shell/platform/android/io/flutter/view/FlutterCallbackInformation.java
...m/android/io/flutter/view/FlutterCallbackInformation.java
+0
-34
shell/platform/android/io/flutter/view/FlutterNativeView.java
...l/platform/android/io/flutter/view/FlutterNativeView.java
+49
-70
shell/platform/android/io/flutter/view/FlutterRunArguments.java
...platform/android/io/flutter/view/FlutterRunArguments.java
+0
-16
shell/platform/android/io/flutter/view/FlutterView.java
shell/platform/android/io/flutter/view/FlutterView.java
+6
-27
shell/platform/android/platform_view_android.cc
shell/platform/android/platform_view_android.cc
+3
-24
shell/platform/android/platform_view_android.h
shell/platform/android/platform_view_android.h
+0
-7
shell/platform/android/platform_view_android_jni.cc
shell/platform/android/platform_view_android_jni.cc
+17
-79
shell/platform/darwin/ios/headless_platform_view_ios.h
shell/platform/darwin/ios/headless_platform_view_ios.h
+1
-1
shell/platform/darwin/ios/headless_platform_view_ios.mm
shell/platform/darwin/ios/headless_platform_view_ios.mm
+1
-1
travis/licenses_golden/licenses_flutter
travis/licenses_golden/licenses_flutter
+0
-2
未找到文件。
shell/platform/android/BUILD.gn
浏览文件 @
5442c0a7
...
...
@@ -133,10 +133,8 @@ java_library("flutter_shell_java") {
"io/flutter/util/PathUtils.java",
"io/flutter/util/Preconditions.java",
"io/flutter/view/AccessibilityBridge.java",
"io/flutter/view/FlutterCallbackInformation.java",
"io/flutter/view/FlutterMain.java",
"io/flutter/view/FlutterNativeView.java",
"io/flutter/view/FlutterRunArguments.java",
"io/flutter/view/FlutterView.java",
"io/flutter/view/ResourceCleaner.java",
"io/flutter/view/ResourceExtractor.java",
...
...
shell/platform/android/android_shell_holder.cc
浏览文件 @
5442c0a7
...
...
@@ -23,8 +23,7 @@ namespace shell {
AndroidShellHolder
::
AndroidShellHolder
(
blink
::
Settings
settings
,
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
,
bool
is_background_view
)
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
)
:
settings_
(
std
::
move
(
settings
)),
java_object_
(
java_object
)
{
static
size_t
shell_count
=
1
;
auto
thread_label
=
std
::
to_string
(
shell_count
++
);
...
...
@@ -32,42 +31,26 @@ AndroidShellHolder::AndroidShellHolder(
FML_CHECK
(
pthread_key_create
(
&
thread_destruct_key_
,
ThreadDestructCallback
)
==
0
);
if
(
is_background_view
)
{
thread_host_
=
{
thread_label
,
ThreadHost
::
Type
::
UI
};
}
else
{
thread_host_
=
{
thread_label
,
ThreadHost
::
Type
::
UI
|
ThreadHost
::
Type
::
GPU
|
ThreadHost
::
Type
::
IO
};
}
thread_host_
=
{
thread_label
,
ThreadHost
::
Type
::
UI
|
ThreadHost
::
Type
::
GPU
|
ThreadHost
::
Type
::
IO
};
// Detach from JNI when the UI and GPU threads exit.
auto
jni_exit_task
([
key
=
thread_destruct_key_
]()
{
FML_CHECK
(
pthread_setspecific
(
key
,
reinterpret_cast
<
void
*>
(
1
))
==
0
);
});
thread_host_
.
ui_thread
->
GetTaskRunner
()
->
PostTask
(
jni_exit_task
);
if
(
!
is_background_view
)
{
thread_host_
.
gpu_thread
->
GetTaskRunner
()
->
PostTask
(
jni_exit_task
);
}
thread_host_
.
gpu_thread
->
GetTaskRunner
()
->
PostTask
(
jni_exit_task
);
fml
::
WeakPtr
<
PlatformViewAndroid
>
weak_platform_view
;
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
=
[
is_background_view
,
java_object
,
&
weak_platform_view
](
Shell
&
shell
)
{
std
::
unique_ptr
<
PlatformViewAndroid
>
platform_view_android
;
if
(
is_background_view
)
{
platform_view_android
=
std
::
make_unique
<
PlatformViewAndroid
>
(
shell
,
// delegate
shell
.
GetTaskRunners
(),
// task runners
java_object
// java object handle for JNI interop
);
}
else
{
platform_view_android
=
std
::
make_unique
<
PlatformViewAndroid
>
(
shell
,
// delegate
shell
.
GetTaskRunners
(),
// task runners
java_object
,
// java object handle for JNI interop
shell
.
GetSettings
()
.
enable_software_rendering
// use software rendering
);
}
[
java_object
,
&
weak_platform_view
](
Shell
&
shell
)
{
auto
platform_view_android
=
std
::
make_unique
<
PlatformViewAndroid
>
(
shell
,
// delegate
shell
.
GetTaskRunners
(),
// task runners
java_object
,
// java object handle for JNI interop
shell
.
GetSettings
()
.
enable_software_rendering
// use software rendering
);
weak_platform_view
=
platform_view_android
->
GetWeakPtr
();
return
platform_view_android
;
};
...
...
@@ -79,26 +62,13 @@ AndroidShellHolder::AndroidShellHolder(
// The current thread will be used as the platform thread. Ensure that the
// message loop is initialized.
fml
::
MessageLoop
::
EnsureInitializedForCurrentThread
();
fml
::
RefPtr
<
fml
::
TaskRunner
>
gpu_runner
;
fml
::
RefPtr
<
fml
::
TaskRunner
>
ui_runner
;
fml
::
RefPtr
<
fml
::
TaskRunner
>
io_runner
;
fml
::
RefPtr
<
fml
::
TaskRunner
>
platform_runner
=
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
();
if
(
is_background_view
)
{
auto
single_task_runner
=
thread_host_
.
ui_thread
->
GetTaskRunner
();
gpu_runner
=
single_task_runner
;
ui_runner
=
single_task_runner
;
io_runner
=
single_task_runner
;
}
else
{
gpu_runner
=
thread_host_
.
gpu_thread
->
GetTaskRunner
();
ui_runner
=
thread_host_
.
ui_thread
->
GetTaskRunner
();
io_runner
=
thread_host_
.
io_thread
->
GetTaskRunner
();
}
blink
::
TaskRunners
task_runners
(
thread_label
,
// label
platform_runner
,
// platform
gpu_runner
,
// gpu
ui_runner
,
// ui
io_runner
// io
blink
::
TaskRunners
task_runners
(
thread_label
,
// label
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
(),
// platform
thread_host_
.
gpu_thread
->
GetTaskRunner
(),
// gpu
thread_host_
.
ui_thread
->
GetTaskRunner
(),
// ui
thread_host_
.
io_thread
->
GetTaskRunner
()
// io
);
shell_
=
...
...
@@ -161,12 +131,10 @@ void AndroidShellHolder::Launch(RunConfiguration config) {
fml
::
MakeCopyable
([
engine
=
shell_
->
GetEngine
(),
//
config
=
std
::
move
(
config
)
//
]()
mutable
{
FML_LOG
(
INFO
)
<<
"Attempting to launch engine configuration..."
;
if
(
!
engine
||
!
engine
->
Run
(
std
::
move
(
config
)))
{
FML_LOG
(
ERROR
)
<<
"Could not launch engine in configuration."
;
}
else
{
FML_LOG
(
INFO
)
<<
"Isolate for engine configuration successfully "
"started and run."
;
if
(
engine
)
{
if
(
!
engine
->
Run
(
std
::
move
(
config
)))
{
FML_LOG
(
ERROR
)
<<
"Could not launch engine in configuration."
;
}
}
}));
}
...
...
shell/platform/android/android_shell_holder.h
浏览文件 @
5442c0a7
...
...
@@ -21,8 +21,7 @@ namespace shell {
class
AndroidShellHolder
{
public:
AndroidShellHolder
(
blink
::
Settings
settings
,
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
,
bool
is_background_view
);
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
);
~
AndroidShellHolder
();
...
...
shell/platform/android/io/flutter/app/FlutterActivityDelegate.java
浏览文件 @
5442c0a7
...
...
@@ -30,7 +30,6 @@ import io.flutter.plugin.platform.PlatformPlugin;
import
io.flutter.util.Preconditions
;
import
io.flutter.view.FlutterMain
;
import
io.flutter.view.FlutterNativeView
;
import
io.flutter.view.FlutterRunArguments
;
import
io.flutter.view.FlutterView
;
import
java.util.ArrayList
;
...
...
@@ -163,16 +162,19 @@ public final class FlutterActivityDelegate
}
}
if
(
loadIntent
(
activity
.
getIntent
()))
{
// When an activity is created for the first time, we direct the
// FlutterView to re-use a pre-existing Isolate rather than create a new
// one. This is so that an Isolate coming in from the ViewFactory is
// used.
final
boolean
reuseIsolate
=
true
;
if
(
loadIntent
(
activity
.
getIntent
(),
reuseIsolate
))
{
return
;
}
if
(!
flutterView
.
getFlutterNativeView
().
isApplicationRunning
())
{
String
appBundlePath
=
FlutterMain
.
findAppBundlePath
(
activity
.
getApplicationContext
());
if
(
appBundlePath
!=
null
)
{
FlutterRunArguments
arguments
=
new
FlutterRunArguments
();
arguments
.
bundlePath
=
appBundlePath
;
arguments
.
entrypoint
=
"main"
;
flutterView
.
runFromBundle
(
arguments
);
flutterView
.
runFromBundle
(
appBundlePath
,
null
,
"main"
,
reuseIsolate
);
}
}
}
...
...
@@ -323,6 +325,11 @@ public final class FlutterActivityDelegate
}
private
boolean
loadIntent
(
Intent
intent
)
{
final
boolean
reuseIsolate
=
false
;
return
loadIntent
(
intent
,
reuseIsolate
);
}
private
boolean
loadIntent
(
Intent
intent
,
boolean
reuseIsolate
)
{
String
action
=
intent
.
getAction
();
if
(
Intent
.
ACTION_RUN
.
equals
(
action
))
{
String
route
=
intent
.
getStringExtra
(
"route"
);
...
...
@@ -336,10 +343,7 @@ public final class FlutterActivityDelegate
flutterView
.
setInitialRoute
(
route
);
}
if
(!
flutterView
.
getFlutterNativeView
().
isApplicationRunning
())
{
FlutterRunArguments
args
=
new
FlutterRunArguments
();
args
.
bundlePath
=
appBundlePath
;
args
.
entrypoint
=
"main"
;
flutterView
.
runFromBundle
(
args
);
flutterView
.
runFromBundle
(
appBundlePath
,
null
,
"main"
,
reuseIsolate
);
}
return
true
;
}
...
...
shell/platform/android/io/flutter/view/FlutterCallbackInformation.java
已删除
100644 → 0
浏览文件 @
a5215ce5
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package
io.flutter.view
;
/**
* A class representing information for a callback registered using
* `PluginUtilities` from `dart:ui`.
*/
public
final
class
FlutterCallbackInformation
{
final
public
String
callbackName
;
final
public
String
callbackClassName
;
final
public
String
callbackLibraryPath
;
/**
* Get callback information for a given handle.
* @param handle the handle for the callback, generated by
* `PluginUtilities.getCallbackHandle` in `dart:ui`.
* @return an instance of FlutterCallbackInformation for the provided handle.
*/
public
static
FlutterCallbackInformation
lookupCallbackInformation
(
long
handle
)
{
return
nativeLookupCallbackInformation
(
handle
);
}
private
FlutterCallbackInformation
(
String
callbackName
,
String
callbackClassName
,
String
callbackLibraryPath
)
{
this
.
callbackName
=
callbackName
;
this
.
callbackClassName
=
callbackClassName
;
this
.
callbackLibraryPath
=
callbackLibraryPath
;
}
private
static
native
FlutterCallbackInformation
nativeLookupCallbackInformation
(
long
handle
);
}
shell/platform/android/io/flutter/view/FlutterNativeView.java
浏览文件 @
5442c0a7
...
...
@@ -29,13 +29,9 @@ public class FlutterNativeView implements BinaryMessenger {
private
boolean
applicationIsRunning
;
public
FlutterNativeView
(
Context
context
)
{
this
(
context
,
false
);
}
public
FlutterNativeView
(
Context
context
,
boolean
isBackgroundView
)
{
mContext
=
context
;
mPluginRegistry
=
new
FlutterPluginRegistry
(
this
,
context
);
attach
(
this
,
isBackgroundView
);
attach
(
this
);
assertAttached
();
mMessageHandlers
=
new
HashMap
<>();
}
...
...
@@ -72,43 +68,22 @@ public class FlutterNativeView implements BinaryMessenger {
}
public
void
assertAttached
()
{
if
(!
isAttached
())
throw
new
AssertionError
(
"Platform view is not attached"
);
}
public
void
runFromBundle
(
FlutterRunArguments
args
)
{
if
(
args
.
bundlePath
==
null
)
{
throw
new
AssertionError
(
"A bundlePath must be specified"
);
}
else
if
(
args
.
entrypoint
==
null
)
{
throw
new
AssertionError
(
"An entrypoint must be specified"
);
}
runFromBundleInternal
(
args
.
bundlePath
,
args
.
entrypoint
,
args
.
libraryPath
,
null
);
}
/**
* @deprecated
* Please use runFromBundle with `FlutterRunArguments`. Parameters
* `snapshotOverride` and `reuseRuntimeController` have no effect.
*/
public
void
runFromBundle
(
String
bundlePath
,
String
snapshotOverride
,
String
entrypoint
,
boolean
reuseRuntimeController
)
{
runFromBundleInternal
(
bundlePath
,
entrypoint
,
null
,
null
);
if
(!
isAttached
())
throw
new
AssertionError
(
"Platform view is not attached"
);
}
private
void
runFromBundleInternal
(
String
bundlePath
,
String
entrypoint
,
String
libraryPath
,
String
snapshotOverride
)
{
public
void
runFromBundle
(
String
bundlePath
,
String
snapshotOverride
,
String
entrypoint
,
boolean
reuseRuntimeController
)
{
assertAttached
();
if
(
applicationIsRunning
)
throw
new
AssertionError
(
"This Flutter engine instance is already running an application"
);
nativeRunBundleAndSnapshotFromLibrary
(
mNativePlatformView
,
bundlePath
,
entrypoint
,
libraryPath
,
mContext
.
getResources
().
getAssets
());
throw
new
AssertionError
(
"This Flutter engine instance is already running an application"
);
nativeRunBundleAndSnapshot
(
mNativePlatformView
,
bundlePath
,
snapshotOverride
,
entrypoint
,
reuseRuntimeController
,
mContext
.
getResources
().
getAssets
());
applicationIsRunning
=
true
;
}
public
boolean
isApplicationRunning
()
{
return
applicationIsRunning
;
return
applicationIsRunning
;
}
public
static
String
getObservatoryUri
()
{
...
...
@@ -117,7 +92,7 @@ public class FlutterNativeView implements BinaryMessenger {
@Override
public
void
send
(
String
channel
,
ByteBuffer
message
)
{
send
(
channel
,
message
,
null
);
send
(
channel
,
message
,
null
);
}
@Override
...
...
@@ -135,8 +110,8 @@ public class FlutterNativeView implements BinaryMessenger {
if
(
message
==
null
)
{
nativeDispatchEmptyPlatformMessage
(
mNativePlatformView
,
channel
,
replyId
);
}
else
{
nativeDispatchPlatformMessage
(
mNativePlatformView
,
channel
,
message
,
message
.
position
(),
replyId
);
nativeDispatchPlatformMessage
(
mNativePlatformView
,
channel
,
message
,
message
.
position
(),
replyId
);
}
}
...
...
@@ -149,8 +124,8 @@ public class FlutterNativeView implements BinaryMessenger {
}
}
private
void
attach
(
FlutterNativeView
view
,
boolean
isBackgroundView
)
{
mNativePlatformView
=
nativeAttach
(
view
,
isBackgroundView
);
private
void
attach
(
FlutterNativeView
view
)
{
mNativePlatformView
=
nativeAttach
(
view
);
}
// Called by native to send us a platform message.
...
...
@@ -160,28 +135,27 @@ public class FlutterNativeView implements BinaryMessenger {
if
(
handler
!=
null
)
{
try
{
final
ByteBuffer
buffer
=
(
message
==
null
?
null
:
ByteBuffer
.
wrap
(
message
));
handler
.
onMessage
(
buffer
,
new
BinaryReply
()
{
private
final
AtomicBoolean
done
=
new
AtomicBoolean
(
false
);
@Override
public
void
reply
(
ByteBuffer
reply
)
{
if
(!
isAttached
())
{
Log
.
d
(
TAG
,
"handlePlatformMessage replying to a detached view, channel="
+
channel
);
return
;
}
if
(
done
.
getAndSet
(
true
))
{
throw
new
IllegalStateException
(
"Reply already submitted"
);
handler
.
onMessage
(
buffer
,
new
BinaryReply
()
{
private
final
AtomicBoolean
done
=
new
AtomicBoolean
(
false
);
@Override
public
void
reply
(
ByteBuffer
reply
)
{
if
(!
isAttached
())
{
Log
.
d
(
TAG
,
"handlePlatformMessage replying to a detached view, channel="
+
channel
);
return
;
}
if
(
done
.
getAndSet
(
true
))
{
throw
new
IllegalStateException
(
"Reply already submitted"
);
}
if
(
reply
==
null
)
{
nativeInvokePlatformMessageEmptyResponseCallback
(
mNativePlatformView
,
replyId
);
}
else
{
nativeInvokePlatformMessageResponseCallback
(
mNativePlatformView
,
replyId
,
reply
,
reply
.
position
());
}
}
if
(
reply
==
null
)
{
nativeInvokePlatformMessageEmptyResponseCallback
(
mNativePlatformView
,
replyId
);
}
else
{
nativeInvokePlatformMessageResponseCallback
(
mNativePlatformView
,
replyId
,
reply
,
reply
.
position
());
}
}
});
});
}
catch
(
Exception
ex
)
{
Log
.
e
(
TAG
,
"Uncaught exception in binary message listener"
,
ex
);
nativeInvokePlatformMessageEmptyResponseCallback
(
mNativePlatformView
,
replyId
);
...
...
@@ -205,7 +179,8 @@ public class FlutterNativeView implements BinaryMessenger {
// Called by native to update the semantics/accessibility tree.
private
void
updateSemantics
(
ByteBuffer
buffer
,
String
[]
strings
)
{
if
(
mFlutterView
==
null
)
return
;
if
(
mFlutterView
==
null
)
return
;
mFlutterView
.
updateSemantics
(
buffer
,
strings
);
}
...
...
@@ -218,7 +193,8 @@ public class FlutterNativeView implements BinaryMessenger {
// Called by native to notify first Flutter frame rendered.
private
void
onFirstFrame
()
{
if
(
mFlutterView
==
null
)
return
;
if
(
mFlutterView
==
null
)
return
;
mFlutterView
.
onFirstFrame
();
}
...
...
@@ -230,29 +206,32 @@ public class FlutterNativeView implements BinaryMessenger {
mPluginRegistry
.
onPreEngineRestart
();
}
private
static
native
long
nativeAttach
(
FlutterNativeView
view
,
boolean
isBackgroundView
);
private
static
native
long
nativeAttach
(
FlutterNativeView
view
);
private
static
native
void
nativeDestroy
(
long
nativePlatformViewAndroid
);
private
static
native
void
nativeDetach
(
long
nativePlatformViewAndroid
);
private
static
native
void
nativeRunBundleAndSnapshotFromLibrary
(
long
nativePlatformViewAndroid
,
String
bundlePath
,
String
entrypoint
,
String
libraryUrl
,
AssetManager
manager
);
private
static
native
void
nativeRunBundleAndSnapshot
(
long
nativePlatformViewAndroid
,
String
bundlePath
,
String
snapshotOverride
,
String
entrypoint
,
boolean
reuseRuntimeController
,
AssetManager
manager
);
private
static
native
String
nativeGetObservatoryUri
();
// Send an empty platform message to Dart.
private
static
native
void
nativeDispatchEmptyPlatformMessage
(
long
nativePlatformViewAndroid
,
String
channel
,
int
responseId
);
private
static
native
void
nativeDispatchEmptyPlatformMessage
(
long
nativePlatformViewAndroid
,
String
channel
,
int
responseId
);
// Send a data-carrying platform message to Dart.
private
static
native
void
nativeDispatchPlatformMessage
(
long
nativePlatformViewAndroid
,
String
channel
,
ByteBuffer
message
,
int
position
,
int
responseId
);
String
channel
,
ByteBuffer
message
,
int
position
,
int
responseId
);
// Send an empty response to a platform message received from Dart.
private
static
native
void
nativeInvokePlatformMessageEmptyResponseCallback
(
long
nativePlatformViewAndroid
,
int
responseId
);
long
nativePlatformViewAndroid
,
int
responseId
);
// Send a data-carrying response to a platform message received from Dart.
private
static
native
void
nativeInvokePlatformMessageResponseCallback
(
long
nativePlatformViewAndroid
,
int
responseId
,
ByteBuffer
message
,
int
position
);
long
nativePlatformViewAndroid
,
int
responseId
,
ByteBuffer
message
,
int
position
);
}
shell/platform/android/io/flutter/view/FlutterRunArguments.java
已删除
100644 → 0
浏览文件 @
a5215ce5
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package
io.flutter.view
;
/**
* A class containing arguments for entering a FlutterNativeView's isolate for
* the first time.
*/
public
class
FlutterRunArguments
{
public
String
bundlePath
;
public
String
entrypoint
;
public
String
libraryPath
;
public
String
snapshotOverride
;
}
shell/platform/android/io/flutter/view/FlutterView.java
浏览文件 @
5442c0a7
...
...
@@ -602,41 +602,20 @@ public class FlutterView extends SurfaceView
private
void
postRun
()
{
}
public
void
runFromBundle
(
FlutterRunArguments
args
)
{
assertAttached
();
preRun
();
mNativeView
.
runFromBundle
(
args
);
postRun
();
}
/**
* @deprecated
* Please use runFromBundle with `FlutterRunArguments`. Parameter
* `snapshotOverride` has no effect.
*/
public
void
runFromBundle
(
String
bundlePath
,
String
snapshotOverride
)
{
runFromBundle
(
bundlePath
,
snapshotOverride
,
"main"
,
false
);
}
/**
* @deprecated
* Please use runFromBundle with `FlutterRunArguments`. Parameter
* `snapshotOverride` has no effect.
*/
public
void
runFromBundle
(
String
bundlePath
,
String
snapshotOverride
,
String
entrypoint
)
{
runFromBundle
(
bundlePath
,
snapshotOverride
,
entrypoint
,
false
);
}
/**
* @deprecated
* Please use runFromBundle with `FlutterRunArguments`. Parameters
* `snapshotOverride` and `reuseRuntimeController` have no effect.
*/
public
void
runFromBundle
(
String
bundlePath
,
String
snapshotOverride
,
String
entrypoint
,
boolean
reuseRuntimeController
)
{
FlutterRunArguments
args
=
new
FlutterRunArguments
();
args
.
bundlePath
=
bundlePath
;
args
.
entrypoint
=
entrypoint
;
runFromBundle
(
args
);
public
void
runFromBundle
(
String
bundlePath
,
String
snapshotOverride
,
String
entrypoint
,
boolean
reuseRuntimeController
)
{
assertAttached
();
preRun
();
mNativeView
.
runFromBundle
(
bundlePath
,
snapshotOverride
,
entrypoint
,
reuseRuntimeController
);
postRun
();
}
/**
...
...
shell/platform/android/platform_view_android.cc
浏览文件 @
5442c0a7
...
...
@@ -30,36 +30,21 @@ PlatformViewAndroid::PlatformViewAndroid(
"rendering."
;
}
PlatformViewAndroid
::
PlatformViewAndroid
(
PlatformView
::
Delegate
&
delegate
,
blink
::
TaskRunners
task_runners
,
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
)
:
PlatformView
(
delegate
,
std
::
move
(
task_runners
)),
java_object_
(
java_object
),
android_surface_
(
nullptr
)
{}
PlatformViewAndroid
::~
PlatformViewAndroid
()
=
default
;
void
PlatformViewAndroid
::
NotifyCreated
(
fml
::
RefPtr
<
AndroidNativeWindow
>
native_window
)
{
if
(
android_surface_
)
{
InstallFirstFrameCallback
();
android_surface_
->
SetNativeWindow
(
native_window
);
}
InstallFirstFrameCallback
();
android_surface_
->
SetNativeWindow
(
native_window
);
PlatformView
::
NotifyCreated
();
}
void
PlatformViewAndroid
::
NotifyDestroyed
()
{
PlatformView
::
NotifyDestroyed
();
if
(
android_surface_
)
{
android_surface_
->
TeardownOnScreenContext
();
}
android_surface_
->
TeardownOnScreenContext
();
}
void
PlatformViewAndroid
::
NotifyChanged
(
const
SkISize
&
size
)
{
if
(
!
android_surface_
)
{
return
;
}
fml
::
AutoResetWaitableEvent
latch
;
fml
::
TaskRunner
::
RunNowOrPostTask
(
task_runners_
.
GetGPUTaskRunner
(),
//
...
...
@@ -360,17 +345,11 @@ std::unique_ptr<VsyncWaiter> PlatformViewAndroid::CreateVSyncWaiter() {
// |shell::PlatformView|
std
::
unique_ptr
<
Surface
>
PlatformViewAndroid
::
CreateRenderingSurface
()
{
if
(
!
android_surface_
)
{
return
nullptr
;
}
return
android_surface_
->
CreateGPUSurface
();
}
// |shell::PlatformView|
sk_sp
<
GrContext
>
PlatformViewAndroid
::
CreateResourceContext
()
const
{
if
(
!
android_surface_
)
{
return
nullptr
;
}
sk_sp
<
GrContext
>
resource_context
;
if
(
android_surface_
->
ResourceContextMakeCurrent
())
{
// TODO(chinmaygarde): Currently, this code depends on the fact that only
...
...
shell/platform/android/platform_view_android.h
浏览文件 @
5442c0a7
...
...
@@ -24,13 +24,6 @@ class PlatformViewAndroid final : public PlatformView {
public:
static
bool
Register
(
JNIEnv
*
env
);
// Creates a PlatformViewAndroid with no rendering surface for use with
// background execution.
PlatformViewAndroid
(
PlatformView
::
Delegate
&
delegate
,
blink
::
TaskRunners
task_runners
,
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
);
// Creates a PlatformViewAndroid with a rendering surface.
PlatformViewAndroid
(
PlatformView
::
Delegate
&
delegate
,
blink
::
TaskRunners
task_runners
,
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
,
...
...
shell/platform/android/platform_view_android_jni.cc
浏览文件 @
5442c0a7
...
...
@@ -16,7 +16,6 @@
#include "flutter/fml/platform/android/jni_util.h"
#include "flutter/fml/platform/android/jni_weak_ref.h"
#include "flutter/fml/platform/android/scoped_java_ref.h"
#include "flutter/lib/ui/plugins/callback_cache.h"
#include "flutter/runtime/dart_service_isolate.h"
#include "flutter/shell/common/run_configuration.h"
#include "flutter/shell/platform/android/android_external_texture_gl.h"
...
...
@@ -44,8 +43,6 @@ bool CheckException(JNIEnv* env) {
}
// anonymous namespace
static
fml
::
jni
::
ScopedJavaGlobalRef
<
jclass
>*
g_flutter_callback_info_class
=
nullptr
;
static
fml
::
jni
::
ScopedJavaGlobalRef
<
jclass
>*
g_flutter_view_class
=
nullptr
;
static
fml
::
jni
::
ScopedJavaGlobalRef
<
jclass
>*
g_flutter_native_view_class
=
nullptr
;
...
...
@@ -53,19 +50,6 @@ static fml::jni::ScopedJavaGlobalRef<jclass>* g_surface_texture_class = nullptr;
// Called By Native
static
jmethodID
g_flutter_callback_info_constructor
=
nullptr
;
jobject
CreateFlutterCallbackInformation
(
JNIEnv
*
env
,
const
std
::
string
&
callbackName
,
const
std
::
string
&
callbackClassName
,
const
std
::
string
&
callbackLibraryPath
)
{
return
env
->
NewObject
(
g_flutter_callback_info_class
->
obj
(),
g_flutter_callback_info_constructor
,
env
->
NewStringUTF
(
callbackName
.
c_str
()),
env
->
NewStringUTF
(
callbackClassName
.
c_str
()),
env
->
NewStringUTF
(
callbackLibraryPath
.
c_str
()));
}
static
jmethodID
g_handle_platform_message_method
=
nullptr
;
void
FlutterViewHandlePlatformMessage
(
JNIEnv
*
env
,
jobject
obj
,
...
...
@@ -146,13 +130,10 @@ void SurfaceTextureDetachFromGLContext(JNIEnv* env, jobject obj) {
// Called By Java
static
jlong
Attach
(
JNIEnv
*
env
,
jclass
clazz
,
jobject
flutterView
,
jboolean
is_background_view
)
{
static
jlong
Attach
(
JNIEnv
*
env
,
jclass
clazz
,
jobject
flutterView
)
{
fml
::
jni
::
JavaObjectWeakGlobalRef
java_object
(
env
,
flutterView
);
auto
shell_holder
=
std
::
make_unique
<
AndroidShellHolder
>
(
FlutterMain
::
Get
().
GetSettings
(),
java_object
,
is_background_view
);
FlutterMain
::
Get
().
GetSettings
(),
java_object
);
if
(
shell_holder
->
IsValid
())
{
return
reinterpret_cast
<
jlong
>
(
shell_holder
.
release
());
}
else
{
...
...
@@ -237,14 +218,15 @@ std::unique_ptr<IsolateConfiguration> CreateIsolateConfiguration(
return
IsolateConfiguration
::
CreateForAppSnapshot
();
}
static
void
RunBundleAndSnapshotFromLibrary
(
JNIEnv
*
env
,
jobject
jcaller
,
jlong
shell_holder
,
jstring
jbundlepath
,
jstring
jsnapshotOverride
,
jstring
jEntrypoint
,
jstring
jLibraryUrl
,
jobject
jAssetManager
)
{
static
void
RunBundleAndSnapshot
(
JNIEnv
*
env
,
jobject
jcaller
,
jlong
shell_holder
,
jstring
jbundlepath
,
jstring
jsnapshotOverride
,
jstring
jEntrypoint
,
jboolean
/* reuse runtime controller (unused) */
,
jobject
jAssetManager
)
{
auto
asset_manager
=
fml
::
MakeRefCounted
<
blink
::
AssetManager
>
();
const
auto
bundlepath
=
fml
::
jni
::
JavaStringToString
(
env
,
jbundlepath
);
...
...
@@ -293,12 +275,7 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env,
{
auto
entrypoint
=
fml
::
jni
::
JavaStringToString
(
env
,
jEntrypoint
);
auto
libraryUrl
=
fml
::
jni
::
JavaStringToString
(
env
,
jLibraryUrl
);
if
((
entrypoint
.
size
()
>
0
)
&&
(
libraryUrl
.
size
()
>
0
))
{
config
.
SetEntrypointAndLibrary
(
std
::
move
(
entrypoint
),
std
::
move
(
libraryUrl
));
}
else
if
(
entrypoint
.
size
()
>
0
)
{
if
(
entrypoint
.
size
()
>
0
)
{
config
.
SetEntrypoint
(
std
::
move
(
entrypoint
));
}
}
...
...
@@ -306,17 +283,6 @@ static void RunBundleAndSnapshotFromLibrary(JNIEnv* env,
ANDROID_SHELL_HOLDER
->
Launch
(
std
::
move
(
config
));
}
static
jobject
LookupCallbackInformation
(
JNIEnv
*
env
,
/* unused */
jobject
,
jlong
handle
)
{
auto
cbInfo
=
blink
::
DartCallbackCache
::
GetCallbackInformation
(
handle
);
if
(
cbInfo
==
nullptr
)
{
return
nullptr
;
}
return
CreateFlutterCallbackInformation
(
env
,
cbInfo
->
name
,
cbInfo
->
class_name
,
cbInfo
->
library_path
);
}
static
void
SetViewportMetrics
(
JNIEnv
*
env
,
jobject
jcaller
,
jlong
shell_holder
,
...
...
@@ -550,19 +516,6 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
return
false
;
}
g_flutter_callback_info_class
=
new
fml
::
jni
::
ScopedJavaGlobalRef
<
jclass
>
(
env
,
env
->
FindClass
(
"io/flutter/view/FlutterCallbackInformation"
));
if
(
g_flutter_callback_info_class
->
is_null
())
{
return
false
;
}
g_flutter_callback_info_constructor
=
env
->
GetMethodID
(
g_flutter_callback_info_class
->
obj
(),
"<init>"
,
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"
);
if
(
g_flutter_callback_info_constructor
==
nullptr
)
{
return
false
;
}
g_flutter_view_class
=
new
fml
::
jni
::
ScopedJavaGlobalRef
<
jclass
>
(
env
,
env
->
FindClass
(
"io/flutter/view/FlutterView"
));
if
(
g_flutter_view_class
->
is_null
())
{
...
...
@@ -584,7 +537,7 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
static
const
JNINativeMethod
native_view_methods
[]
=
{
{
.
name
=
"nativeAttach"
,
.
signature
=
"(Lio/flutter/view/FlutterNativeView;
Z
)J"
,
.
signature
=
"(Lio/flutter/view/FlutterNativeView;)J"
,
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
shell
::
Attach
),
},
{
...
...
@@ -593,11 +546,10 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
shell
::
Destroy
),
},
{
.
name
=
"nativeRunBundleAndSnapshotFromLibrary"
,
.
signature
=
"(JLjava/lang/String;Ljava/lang/String;"
"Ljava/lang/String;Landroid/content/res/AssetManager;)V"
,
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
shell
::
RunBundleAndSnapshotFromLibrary
),
.
name
=
"nativeRunBundleAndSnapshot"
,
.
signature
=
"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/"
"String;ZLandroid/content/res/AssetManager;)V"
,
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
shell
::
RunBundleAndSnapshot
),
},
{
.
name
=
"nativeDetach"
,
...
...
@@ -702,14 +654,6 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
},
};
static
const
JNINativeMethod
callback_info_methods
[]
=
{
{
.
name
=
"nativeLookupCallbackInformation"
,
.
signature
=
"(J)Lio/flutter/view/FlutterCallbackInformation;"
,
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
shell
::
LookupCallbackInformation
),
},
};
if
(
env
->
RegisterNatives
(
g_flutter_native_view_class
->
obj
(),
native_view_methods
,
arraysize
(
native_view_methods
))
!=
0
)
{
...
...
@@ -721,12 +665,6 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
return
false
;
}
if
(
env
->
RegisterNatives
(
g_flutter_callback_info_class
->
obj
(),
callback_info_methods
,
arraysize
(
callback_info_methods
))
!=
0
)
{
return
false
;
}
g_handle_platform_message_method
=
env
->
GetMethodID
(
g_flutter_native_view_class
->
obj
(),
"handlePlatformMessage"
,
"(Ljava/lang/String;[BI)V"
);
...
...
shell/platform/darwin/ios/headless_platform_view_ios.h
浏览文件 @
5442c0a7
...
...
@@ -35,4 +35,4 @@ class HeadlessPlatformViewIOS : public PlatformView {
}
// namespace shell
#endif // SHELL_PLATFORM_IOS_HEADLESS_PLATFORM_VIEW_IOS_H_
#endif // SHELL_PLATFORM_IOS_HEADLESS_PLATFORM_VIEW_IOS_H_
\ No newline at end of file
shell/platform/darwin/ios/headless_platform_view_ios.mm
浏览文件 @
5442c0a7
...
...
@@ -17,4 +17,4 @@ PlatformMessageRouter& HeadlessPlatformViewIOS::GetPlatformMessageRouter() {
void
HeadlessPlatformViewIOS
::
HandlePlatformMessage
(
fml
::
RefPtr
<
blink
::
PlatformMessage
>
message
)
{
platform_message_router_
.
HandlePlatformMessage
(
std
::
move
(
message
));
}
}
}
\ No newline at end of file
travis/licenses_golden/licenses_flutter
浏览文件 @
5442c0a7
...
...
@@ -500,8 +500,6 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/Platfor
FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java
FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java
FILE: ../../../flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterCallbackInformation.java
FILE: ../../../flutter/shell/platform/android/io/flutter/view/FlutterRunArguments.java
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterCallbackCache.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h
FILE: ../../../flutter/shell/platform/darwin/ios/framework/Source/FlutterCallbackCache.mm
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录