mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 15:21:54 +00:00
[vm] Rename Dart_NotifyDetach to Dart_NotifyDestroyed.
To reflect its expected usage. TEST=ci Bug: https://github.com/flutter/flutter/issues/108601 Change-Id: I898e400d4a6c112130663a03354844cd82ed778c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264561 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
d2a43581a3
commit
30de5494d5
|
@ -1277,7 +1277,7 @@ DART_EXPORT void Dart_NotifyIdle(int64_t deadline);
|
|||
*
|
||||
* Requires there to be a current isolate.
|
||||
*/
|
||||
DART_EXPORT void Dart_NotifyDetach(void);
|
||||
DART_EXPORT void Dart_NotifyDestroyed(void);
|
||||
|
||||
/**
|
||||
* Notifies the VM that the system is running low on memory.
|
||||
|
|
|
@ -1818,12 +1818,12 @@ DART_EXPORT void Dart_NotifyIdle(int64_t deadline) {
|
|||
T->isolate()->group()->idle_time_handler()->NotifyIdle(deadline);
|
||||
}
|
||||
|
||||
DART_EXPORT void Dart_NotifyDetach() {
|
||||
DART_EXPORT void Dart_NotifyDestroyed() {
|
||||
Thread* T = Thread::Current();
|
||||
CHECK_ISOLATE(T->isolate());
|
||||
API_TIMELINE_BEGIN_END(T);
|
||||
TransitionNativeToVM transition(T);
|
||||
T->heap()->NotifyDetach();
|
||||
T->heap()->NotifyDestroyed();
|
||||
}
|
||||
|
||||
DART_EXPORT void Dart_NotifyLowMemory() {
|
||||
|
|
|
@ -10008,17 +10008,18 @@ void main() {
|
|||
EXPECT_VALID(result);
|
||||
}
|
||||
|
||||
static void NotifyDetachNative(Dart_NativeArguments args) {
|
||||
Dart_NotifyDetach();
|
||||
static void NotifyDestroyedNative(Dart_NativeArguments args) {
|
||||
Dart_NotifyDestroyed();
|
||||
}
|
||||
|
||||
static Dart_NativeFunction NotifyDetach_native_lookup(Dart_Handle name,
|
||||
static Dart_NativeFunction NotifyDestroyed_native_lookup(
|
||||
Dart_Handle name,
|
||||
int argument_count,
|
||||
bool* auto_setup_scope) {
|
||||
return NotifyDetachNative;
|
||||
return NotifyDestroyedNative;
|
||||
}
|
||||
|
||||
TEST_CASE(DartAPI_NotifyDetach) {
|
||||
TEST_CASE(DartAPI_NotifyDestroyed) {
|
||||
const char* kScriptChars = R"(
|
||||
import 'dart:isolate';
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
|
@ -10035,7 +10036,7 @@ void main() {
|
|||
}
|
||||
})";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &NotifyDetach_native_lookup);
|
||||
TestCase::LoadTestScript(kScriptChars, &NotifyDestroyed_native_lookup);
|
||||
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
EXPECT_VALID(result);
|
||||
}
|
||||
|
|
|
@ -436,9 +436,9 @@ void Heap::NotifyIdle(int64_t deadline) {
|
|||
}
|
||||
}
|
||||
|
||||
void Heap::NotifyDetach() {
|
||||
TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "NotifyDetach");
|
||||
CollectAllGarbage(GCReason::kDetach, /*compact=*/true);
|
||||
void Heap::NotifyDestroyed() {
|
||||
TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "NotifyDestroyed");
|
||||
CollectAllGarbage(GCReason::kDestroyed, /*compact=*/true);
|
||||
Page::ClearCache();
|
||||
}
|
||||
|
||||
|
@ -878,8 +878,8 @@ const char* Heap::GCReasonToString(GCReason gc_reason) {
|
|||
return "external";
|
||||
case GCReason::kIdle:
|
||||
return "idle";
|
||||
case GCReason::kDetach:
|
||||
return "detach";
|
||||
case GCReason::kDestroyed:
|
||||
return "destroyed";
|
||||
case GCReason::kDebugging:
|
||||
return "debugging";
|
||||
case GCReason::kCatchUp:
|
||||
|
|
|
@ -108,7 +108,7 @@ class Heap {
|
|||
ObjectPtr FindObject(FindObjectVisitor* visitor);
|
||||
|
||||
void NotifyIdle(int64_t deadline);
|
||||
void NotifyDetach();
|
||||
void NotifyDestroyed();
|
||||
|
||||
Dart_PerformanceMode mode() const { return mode_; }
|
||||
Dart_PerformanceMode SetMode(Dart_PerformanceMode mode);
|
||||
|
|
|
@ -46,7 +46,7 @@ enum class GCReason {
|
|||
kFull, // Heap::CollectAllGarbage
|
||||
kExternal, // Dart_NewFinalizableHandle Dart_NewWeakPersistentHandle
|
||||
kIdle, // Dart_NotifyIdle
|
||||
kDetach, // Dart_NotifyDetach
|
||||
kDestroyed, // Dart_NotifyDestroyed
|
||||
kDebugging, // service request, etc.
|
||||
kCatchUp, // End of ForceGrowthScope or Dart_PerformanceMode_Latency.
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue