Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
0a852d8a
E
engine
项目概览
qq_34031325
/
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,发现更多精彩内容 >>
未验证
提交
0a852d8a
编写于
6月 12, 2020
作者:
E
Emmanuel Garcia
提交者:
GitHub
6月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Call Shell::NotifyLowMemoryWarning on Android Trim and LowMemory events (#18979)" (#19023)
This reverts commit
f5ab179e
.
上级
00656462
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
3 addition
and
73 deletion
+3
-73
shell/platform/android/android_shell_holder.cc
shell/platform/android/android_shell_holder.cc
+0
-4
shell/platform/android/android_shell_holder.h
shell/platform/android/android_shell_holder.h
+0
-2
shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java
...embedding/android/FlutterActivityAndFragmentDelegate.java
+0
-4
shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java
...tform/android/io/flutter/embedding/engine/FlutterJNI.java
+0
-16
shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java
...ndroid/io/flutter/embedding/engine/dart/DartExecutor.java
+0
-13
shell/platform/android/io/flutter/view/FlutterView.java
shell/platform/android/io/flutter/view/FlutterView.java
+0
-1
shell/platform/android/platform_view_android_jni_impl.cc
shell/platform/android/platform_view_android_jni_impl.cc
+0
-11
shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
...dding/android/FlutterActivityAndFragmentDelegateTest.java
+3
-11
shell/platform/android/test/io/flutter/embedding/engine/dart/DartExecutorTest.java
...st/io/flutter/embedding/engine/dart/DartExecutorTest.java
+0
-11
未找到文件。
shell/platform/android/android_shell_holder.cc
浏览文件 @
0a852d8a
...
...
@@ -181,8 +181,4 @@ fml::WeakPtr<PlatformViewAndroid> AndroidShellHolder::GetPlatformView() {
return
platform_view_
;
}
void
AndroidShellHolder
::
NotifyLowMemoryWarning
()
{
FML_DCHECK
(
shell_
);
shell_
->
NotifyLowMemoryWarning
();
}
}
// namespace flutter
shell/platform/android/android_shell_holder.h
浏览文件 @
0a852d8a
...
...
@@ -40,8 +40,6 @@ class AndroidShellHolder {
void
UpdateAssetManager
(
fml
::
RefPtr
<
flutter
::
AssetManager
>
asset_manager
);
void
NotifyLowMemoryWarning
();
private:
const
flutter
::
Settings
settings_
;
const
std
::
shared_ptr
<
PlatformViewAndroidJNI
>
jni_facade_
;
...
...
shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java
浏览文件 @
0a852d8a
...
...
@@ -629,9 +629,6 @@ import java.util.Arrays;
void
onTrimMemory
(
int
level
)
{
ensureAlive
();
if
(
flutterEngine
!=
null
)
{
// This is always an indication that the Dart VM should collect memory
// and free any unneeded resources.
flutterEngine
.
getDartExecutor
().
notifyLowMemoryWarning
();
// Use a trim level delivered while the application is running so the
// framework has a chance to react to the notification.
if
(
level
==
TRIM_MEMORY_RUNNING_LOW
)
{
...
...
@@ -654,7 +651,6 @@ import java.util.Arrays;
void
onLowMemory
()
{
Log
.
v
(
TAG
,
"Forwarding onLowMemory() to FlutterEngine."
);
ensureAlive
();
flutterEngine
.
getDartExecutor
().
notifyLowMemoryWarning
();
flutterEngine
.
getSystemChannel
().
sendMemoryPressureWarning
();
}
...
...
shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java
浏览文件 @
0a852d8a
...
...
@@ -834,22 +834,6 @@ public class FlutterJNI {
// TODO(mattcarroll): determine if this is nonull or nullable
private
native
Bitmap
nativeGetBitmap
(
long
nativePlatformViewId
);
/**
* Notifies the Dart VM of a low memory event, or that the application is in a state such that now
* is an appropriate time to free resources, such as going to the background.
*
* <p>This is distinct from sending a SystemChannel message about low memory, which only notifies
* the running Flutter application.
*/
@UiThread
public
void
notifyLowMemoryWarning
()
{
ensureRunningOnMainThread
();
ensureAttachedToNative
();
nativeNotifyLowMemoryWarning
();
}
private
native
void
nativeNotifyLowMemoryWarning
();
private
void
ensureRunningOnMainThread
()
{
if
(
Looper
.
myLooper
()
!=
mainLooper
)
{
throw
new
RuntimeException
(
...
...
shell/platform/android/io/flutter/embedding/engine/dart/DartExecutor.java
浏览文件 @
0a852d8a
...
...
@@ -232,19 +232,6 @@ public class DartExecutor implements BinaryMessenger {
}
}
/**
* Notify the Dart VM of a low memory event, or that the application is in a state such that now
* is an appropriate time to free resources, such as going to the background.
*
* <p>This does not notify a Flutter application about memory pressure. For that, use the {@link
* SystemChannel#sendMemoryPressureWarning}.
*/
public
void
notifyLowMemoryWarning
()
{
if
(
flutterJNI
.
isAttached
())
{
flutterJNI
.
notifyLowMemoryWarning
();
}
}
/**
* Configuration options that specify which Dart entrypoint function is executed and where to find
* that entrypoint and other assets required for Dart execution.
...
...
shell/platform/android/io/flutter/view/FlutterView.java
浏览文件 @
0a852d8a
...
...
@@ -320,7 +320,6 @@ public class FlutterView extends SurfaceView
}
public
void
onMemoryPressure
()
{
mNativeView
.
getFlutterJNI
().
notifyLowMemoryWarning
();
systemChannel
.
sendMemoryPressureWarning
();
}
...
...
shell/platform/android/platform_view_android_jni_impl.cc
浏览文件 @
0a852d8a
...
...
@@ -436,12 +436,6 @@ static void InvokePlatformMessageEmptyResponseCallback(JNIEnv* env,
);
}
static
void
NotifyLowMemoryWarning
(
JNIEnv
*
env
,
jobject
obj
,
jlong
shell_holder
)
{
ANDROID_SHELL_HOLDER
->
NotifyLowMemoryWarning
();
}
static
jboolean
FlutterTextUtilsIsEmoji
(
JNIEnv
*
env
,
jobject
obj
,
jint
codePoint
)
{
...
...
@@ -512,11 +506,6 @@ bool RegisterApi(JNIEnv* env) {
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
InvokePlatformMessageEmptyResponseCallback
),
},
{
.
name
=
"nativeNotifyLowMemoryWarning"
,
.
signature
=
"()V"
,
.
fnPtr
=
reinterpret_cast
<
void
*>
(
&
NotifyLowMemoryWarning
),
},
// Start of methods from FlutterView
{
...
...
shell/platform/android/test/io/flutter/embedding/android/FlutterActivityAndFragmentDelegateTest.java
浏览文件 @
0a852d8a
package
io.flutter.embedding.android
;
import
static
android
.
content
.
ComponentCallbacks2
.
*
;
import
static
android
.
content
.
ComponentCallbacks2
.
TRIM_MEMORY_RUNNING_LOW
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
mockito
.
Matchers
.
any
;
...
...
@@ -442,7 +442,7 @@ public class FlutterActivityAndFragmentDelegateTest {
}
@Test
public
void
it
NotifiesDartExecutorAnd
SendsMessageOverSystemChannelWhenToldToTrimMemory
()
{
public
void
itSendsMessageOverSystemChannelWhenToldToTrimMemory
()
{
// Create the real object that we're testing.
FlutterActivityAndFragmentDelegate
delegate
=
new
FlutterActivityAndFragmentDelegate
(
mockHost
);
...
...
@@ -451,21 +451,14 @@ public class FlutterActivityAndFragmentDelegateTest {
delegate
.
onAttach
(
RuntimeEnvironment
.
application
);
// Emulate the host and call the method that we expect to be forwarded.
delegate
.
onTrimMemory
(
TRIM_MEMORY_RUNNING_MODERATE
);
delegate
.
onTrimMemory
(
TRIM_MEMORY_RUNNING_LOW
);
delegate
.
onTrimMemory
(
TRIM_MEMORY_RUNNING_CRITICAL
);
delegate
.
onTrimMemory
(
TRIM_MEMORY_BACKGROUND
);
delegate
.
onTrimMemory
(
TRIM_MEMORY_COMPLETE
);
delegate
.
onTrimMemory
(
TRIM_MEMORY_MODERATE
);
delegate
.
onTrimMemory
(
TRIM_MEMORY_UI_HIDDEN
);
// Verify that the call was forwarded to the engine.
verify
(
mockFlutterEngine
.
getDartExecutor
(),
times
(
7
)).
notifyLowMemoryWarning
();
verify
(
mockFlutterEngine
.
getSystemChannel
(),
times
(
1
)).
sendMemoryPressureWarning
();
}
@Test
public
void
it
NotifiesDartExecutorAnd
SendsMessageOverSystemChannelWhenInformedOfLowMemory
()
{
public
void
itSendsMessageOverSystemChannelWhenInformedOfLowMemory
()
{
// Create the real object that we're testing.
FlutterActivityAndFragmentDelegate
delegate
=
new
FlutterActivityAndFragmentDelegate
(
mockHost
);
...
...
@@ -477,7 +470,6 @@ public class FlutterActivityAndFragmentDelegateTest {
delegate
.
onLowMemory
();
// Verify that the call was forwarded to the engine.
verify
(
mockFlutterEngine
.
getDartExecutor
(),
times
(
1
)).
notifyLowMemoryWarning
();
verify
(
mockFlutterEngine
.
getSystemChannel
(),
times
(
1
)).
sendMemoryPressureWarning
();
}
...
...
shell/platform/android/test/io/flutter/embedding/engine/dart/DartExecutorTest.java
浏览文件 @
0a852d8a
...
...
@@ -6,7 +6,6 @@ import static org.mockito.Matchers.eq;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
times
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
android.content.res.AssetManager
;
import
io.flutter.embedding.engine.FlutterJNI
;
...
...
@@ -39,14 +38,4 @@ public class DartExecutorTest {
verify
(
fakeFlutterJni
,
times
(
1
))
.
dispatchPlatformMessage
(
eq
(
"fake_channel"
),
eq
(
fakeMessage
),
anyInt
(),
anyInt
());
}
@Test
public
void
itNotifiesLowMemoryWarning
()
{
FlutterJNI
mockFlutterJNI
=
mock
(
FlutterJNI
.
class
);
when
(
mockFlutterJNI
.
isAttached
()).
thenReturn
(
true
);
DartExecutor
dartExecutor
=
new
DartExecutor
(
mockFlutterJNI
,
mock
(
AssetManager
.
class
));
dartExecutor
.
notifyLowMemoryWarning
();
verify
(
mockFlutterJNI
,
times
(
1
)).
notifyLowMemoryWarning
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录