| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1330995 commit e597882
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1028,15 +1028,15 @@ inline void Environment::SetInstanceMethod(v8::Local<v8::FunctionTemplate> that, | |||
| 1028 | 1028 | t->SetClassName(name_string); | |
| 1029 | 1029 | } | |
| 1030 | 1030 | ||
| 1031 | - void Environment::AddCleanupHook(void (*fn)(void*), void* arg) { | ||
| 1031 | + void Environment::AddCleanupHook(CleanupCallback fn, void* arg) { | ||
| 1032 | 1032 | auto insertion_info = cleanup_hooks_.emplace(CleanupHookCallback { | |
| 1033 | 1033 | fn, arg, cleanup_hook_counter_++ | |
| 1034 | 1034 | }); | |
| 1035 | 1035 | // Make sure there was no existing element with these values. | |
| 1036 | 1036 | CHECK_EQ(insertion_info.second, true); | |
| 1037 | 1037 | } | |
| 1038 | 1038 | ||
| 1039 | - void Environment::RemoveCleanupHook(void (*fn)(void*), void* arg) { | ||
| 1039 | + void Environment::RemoveCleanupHook(CleanupCallback fn, void* arg) { | ||
| 1040 | 1040 | CleanupHookCallback search { fn, arg, 0 }; | |
| 1041 | 1041 | cleanup_hooks_.erase(search); | |
| 1042 | 1042 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -891,7 +891,9 @@ class ShouldNotAbortOnUncaughtScope { | |||
| 891 | 891 | ||
| 892 | 892 | class CleanupHookCallback { | |
| 893 | 893 | public: | |
| 894 | - CleanupHookCallback(void (*fn)(void*), | ||
| 894 | + typedef void (*Callback)(void*); | ||
| 895 | + | ||
| 896 | + CleanupHookCallback(Callback fn, | ||
| 895 | 897 | void* arg, | |
| 896 | 898 | uint64_t insertion_order_counter) | |
| 897 | 899 | : fn_(fn), arg_(arg), insertion_order_counter_(insertion_order_counter) {} | |
@@ -911,7 +913,7 @@ class CleanupHookCallback { | |||
| 911 | 913 | ||
| 912 | 914 | private: | |
| 913 | 915 | friend class Environment; | |
| 914 | - void (*fn_)(void*); | ||
| 916 | + Callback fn_; | ||
| 915 | 917 | void* arg_; | |
| 916 | 918 | ||
| 917 | 919 | // We keep track of the insertion order for these objects, so that we can | |
@@ -1319,8 +1321,9 @@ class Environment : public MemoryRetainer { | |||
| 1319 | 1321 | void ScheduleTimer(int64_t duration); | |
| 1320 | 1322 | void ToggleTimerRef(bool ref); | |
| 1321 | 1323 | ||
| 1322 | - inline void AddCleanupHook(void (*fn)(void*), void* arg); | ||
| 1323 | - inline void RemoveCleanupHook(void (*fn)(void*), void* arg); | ||
| 1324 | + using CleanupCallback = CleanupHookCallback::Callback; | ||
| 1325 | + inline void AddCleanupHook(CleanupCallback cb, void* arg); | ||
| 1326 | + inline void RemoveCleanupHook(CleanupCallback cb, void* arg); | ||
| 1324 | 1327 | void RunCleanup(); | |
| 1325 | 1328 | ||
| 1326 | 1329 | static size_t NearHeapLimitCallback(void* data, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments