@@ -3942,12 +3942,8 @@ TEST_F(EmbedderTest, CanPostTaskToAllNativeThreads) {
39423942 // Waits the adequate number of callbacks to fire.
39433943 fml::CountDownLatch latch;
39443944
3945- // This class will be accessed from multiple threads concurrently to track
3946- // thread specific information that is later checked. All updates to fields
3947- // in this struct must be made with this mutex acquired.
3948-
3949- std::mutex captures_mutex;
39503945 // Ensures that the expect number of distinct threads were serviced.
3946+ std::mutex thread_ids_mutex;
39513947 std::set<std::thread::id> thread_ids;
39523948
39533949 size_t platform_threads_count = 0 ;
@@ -3965,22 +3961,22 @@ TEST_F(EmbedderTest, CanPostTaskToAllNativeThreads) {
39653961 engine.get (),
39663962 [](FlutterNativeThreadType type, void * baton) {
39673963 auto captures = reinterpret_cast <Captures*>(baton);
3964+ switch (type) {
3965+ case kFlutterNativeThreadTypeRender :
3966+ captures->render_threads_count ++;
3967+ break ;
3968+ case kFlutterNativeThreadTypeWorker :
3969+ captures->worker_threads_count ++;
3970+ break ;
3971+ case kFlutterNativeThreadTypeUI :
3972+ captures->ui_threads_count ++;
3973+ break ;
3974+ case kFlutterNativeThreadTypePlatform :
3975+ captures->platform_threads_count ++;
3976+ break ;
3977+ }
39683978 {
3969- std::scoped_lock lock (captures->captures_mutex );
3970- switch (type) {
3971- case kFlutterNativeThreadTypeRender :
3972- captures->render_threads_count ++;
3973- break ;
3974- case kFlutterNativeThreadTypeWorker :
3975- captures->worker_threads_count ++;
3976- break ;
3977- case kFlutterNativeThreadTypeUI :
3978- captures->ui_threads_count ++;
3979- break ;
3980- case kFlutterNativeThreadTypePlatform :
3981- captures->platform_threads_count ++;
3982- break ;
3983- }
3979+ std::scoped_lock lock (captures->thread_ids_mutex );
39843980 captures->thread_ids .insert (std::this_thread::get_id ());
39853981 }
39863982 captures->latch .CountDown ();
0 commit comments