| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9ccf7db commit 3701e5d
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1041,15 +1041,15 @@ inline void Environment::SetInstanceMethod(v8::Local<v8::FunctionTemplate> that, | |||
| 1041 | 1041 | t->SetClassName(name_string); | |
| 1042 | 1042 | } | |
| 1043 | 1043 | ||
| 1044 | - void Environment::AddCleanupHook(void (*fn)(void*), void* arg) { | ||
| 1044 | + void Environment::AddCleanupHook(CleanupCallback fn, void* arg) { | ||
| 1045 | 1045 | auto insertion_info = cleanup_hooks_.emplace(CleanupHookCallback { | |
| 1046 | 1046 | fn, arg, cleanup_hook_counter_++ | |
| 1047 | 1047 | }); | |
| 1048 | 1048 | // Make sure there was no existing element with these values. | |
| 1049 | 1049 | CHECK_EQ(insertion_info.second, true); | |
| 1050 | 1050 | } | |
| 1051 | 1051 | ||
| 1052 | - void Environment::RemoveCleanupHook(void (*fn)(void*), void* arg) { | ||
| 1052 | + void Environment::RemoveCleanupHook(CleanupCallback fn, void* arg) { | ||
| 1053 | 1053 | CleanupHookCallback search { fn, arg, 0 }; | |
| 1054 | 1054 | cleanup_hooks_.erase(search); | |
| 1055 | 1055 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -789,7 +789,9 @@ class ShouldNotAbortOnUncaughtScope { | |||
| 789 | 789 | ||
| 790 | 790 | class CleanupHookCallback { | |
| 791 | 791 | public: | |
| 792 | - CleanupHookCallback(void (*fn)(void*), | ||
| 792 | + typedef void (*Callback)(void*); | ||
| 793 | + | ||
| 794 | + CleanupHookCallback(Callback fn, | ||
| 793 | 795 | void* arg, | |
| 794 | 796 | uint64_t insertion_order_counter) | |
| 795 | 797 | : fn_(fn), arg_(arg), insertion_order_counter_(insertion_order_counter) {} | |
@@ -809,7 +811,7 @@ class CleanupHookCallback { | |||
| 809 | 811 | ||
| 810 | 812 | private: | |
| 811 | 813 | friend class Environment; | |
| 812 | - void (*fn_)(void*); | ||
| 814 | + Callback fn_; | ||
| 813 | 815 | void* arg_; | |
| 814 | 816 | ||
| 815 | 817 | // We keep track of the insertion order for these objects, so that we can | |
@@ -1171,8 +1173,9 @@ class Environment : public MemoryRetainer { | |||
| 1171 | 1173 | void ScheduleTimer(int64_t duration); | |
| 1172 | 1174 | void ToggleTimerRef(bool ref); | |
| 1173 | 1175 | ||
| 1174 | - inline void AddCleanupHook(void (*fn)(void*), void* arg); | ||
| 1175 | - inline void RemoveCleanupHook(void (*fn)(void*), void* arg); | ||
| 1176 | + using CleanupCallback = CleanupHookCallback::Callback; | ||
| 1177 | + inline void AddCleanupHook(CleanupCallback cb, void* arg); | ||
| 1178 | + inline void RemoveCleanupHook(CleanupCallback cb, void* arg); | ||
| 1176 | 1179 | void RunCleanup(); | |
| 1177 | 1180 | ||
| 1178 | 1181 | static void BuildEmbedderGraph(v8::Isolate* isolate, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments