Flutter iOS Embedder
FlutterFMLTaskRunnerTestHelper.mm
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
7 #include "flutter/fml/message_loop.h"
8 #include "flutter/fml/thread.h"
10 
11 // A FlutterFMLTaskRunner that owns the fml::Thread it runs on.
13 @end
14 
15 @implementation FlutterFMLThreadTaskRunner {
16  std::unique_ptr<fml::Thread> _thread;
17 }
18 
19 - (instancetype)initWithLabel:(NSString*)label {
20  _thread = std::make_unique<fml::Thread>(label.UTF8String);
21  self = [super initWithTaskRunner:_thread->GetTaskRunner()];
22  return self;
23 }
24 
25 @end
26 
27 @implementation FlutterFMLTaskRunnerTestHelper
28 
30  fml::MessageLoop::EnsureInitializedForCurrentThread();
31  return [[FlutterFMLTaskRunner alloc]
32  initWithTaskRunner:fml::MessageLoop::GetCurrent().GetTaskRunner()];
33 }
34 
35 + (FlutterFMLTaskRunner*)makeTaskRunnerWithLabel:(NSString*)label {
36  return [[FlutterFMLThreadTaskRunner alloc] initWithLabel:label];
37 }
38 
39 + (FlutterFMLTaskRunners*)makeTaskRunnersWithLabel:(NSString*)label
41  return [[FlutterFMLTaskRunners alloc] initWithLabel:label
42  platformTaskRunner:taskRunner
43  rasterTaskRunner:taskRunner
44  uiTaskRunner:taskRunner
45  ioTaskRunner:taskRunner];
46 }
47 
48 @end
fml::RefPtr< fml::TaskRunner > taskRunner()
instancetype initWithTaskRunner:(fml::RefPtr< fml::TaskRunner > task_runner)