@@ -201,8 +201,9 @@ void PlatformConfiguration::DidCreateIsolate() {
201
201
void PlatformConfiguration::UpdateLocales (
202
202
const std::vector<std::string>& locales) {
203
203
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
204
- if (!dart_state)
204
+ if (!dart_state) {
205
205
return ;
206
+ }
206
207
tonic::DartState::Scope scope (dart_state);
207
208
tonic::LogIfError (tonic::DartInvokeField (
208
209
library_.value (), " _updateLocales" ,
@@ -213,8 +214,9 @@ void PlatformConfiguration::UpdateLocales(
213
214
214
215
void PlatformConfiguration::UpdateUserSettingsData (const std::string& data) {
215
216
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
216
- if (!dart_state)
217
+ if (!dart_state) {
217
218
return ;
219
+ }
218
220
tonic::DartState::Scope scope (dart_state);
219
221
220
222
tonic::LogIfError (tonic::DartInvokeField (library_.value (),
@@ -226,8 +228,9 @@ void PlatformConfiguration::UpdateUserSettingsData(const std::string& data) {
226
228
227
229
void PlatformConfiguration::UpdateLifecycleState (const std::string& data) {
228
230
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
229
- if (!dart_state)
231
+ if (!dart_state) {
230
232
return ;
233
+ }
231
234
tonic::DartState::Scope scope (dart_state);
232
235
tonic::LogIfError (tonic::DartInvokeField (library_.value (),
233
236
" _updateLifecycleState" ,
@@ -238,8 +241,9 @@ void PlatformConfiguration::UpdateLifecycleState(const std::string& data) {
238
241
239
242
void PlatformConfiguration::UpdateSemanticsEnabled (bool enabled) {
240
243
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
241
- if (!dart_state)
244
+ if (!dart_state) {
242
245
return ;
246
+ }
243
247
tonic::DartState::Scope scope (dart_state);
244
248
UIDartState::ThrowIfUIOperationsProhibited ();
245
249
@@ -249,8 +253,9 @@ void PlatformConfiguration::UpdateSemanticsEnabled(bool enabled) {
249
253
250
254
void PlatformConfiguration::UpdateAccessibilityFeatures (int32_t values) {
251
255
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
252
- if (!dart_state)
256
+ if (!dart_state) {
253
257
return ;
258
+ }
254
259
tonic::DartState::Scope scope (dart_state);
255
260
256
261
tonic::LogIfError (tonic::DartInvokeField (library_.value (),
@@ -293,14 +298,16 @@ void PlatformConfiguration::DispatchSemanticsAction(int32_t id,
293
298
SemanticsAction action,
294
299
std::vector<uint8_t > args) {
295
300
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
296
- if (!dart_state)
301
+ if (!dart_state) {
297
302
return ;
303
+ }
298
304
tonic::DartState::Scope scope (dart_state);
299
305
300
306
Dart_Handle args_handle = (args.empty ()) ? Dart_Null () : ToByteData (args);
301
307
302
- if (Dart_IsError (args_handle))
308
+ if (Dart_IsError (args_handle)) {
303
309
return ;
310
+ }
304
311
305
312
tonic::LogIfError (tonic::DartInvokeField (
306
313
library_.value (), " _dispatchSemanticsAction" ,
@@ -310,8 +317,9 @@ void PlatformConfiguration::DispatchSemanticsAction(int32_t id,
310
317
311
318
void PlatformConfiguration::BeginFrame (fml::TimePoint frameTime) {
312
319
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
313
- if (!dart_state)
320
+ if (!dart_state) {
314
321
return ;
322
+ }
315
323
tonic::DartState::Scope scope (dart_state);
316
324
317
325
int64_t microseconds = (frameTime - fml::TimePoint ()).ToMicroseconds ();
@@ -328,8 +336,9 @@ void PlatformConfiguration::BeginFrame(fml::TimePoint frameTime) {
328
336
329
337
void PlatformConfiguration::ReportTimings (std::vector<int64_t > timings) {
330
338
std::shared_ptr<tonic::DartState> dart_state = library_.dart_state ().lock ();
331
- if (!dart_state)
339
+ if (!dart_state) {
332
340
return ;
341
+ }
333
342
tonic::DartState::Scope scope (dart_state);
334
343
335
344
Dart_Handle data_handle =
@@ -353,11 +362,13 @@ void PlatformConfiguration::ReportTimings(std::vector<int64_t> timings) {
353
362
354
363
void PlatformConfiguration::CompletePlatformMessageEmptyResponse (
355
364
int response_id) {
356
- if (!response_id)
365
+ if (!response_id) {
357
366
return ;
367
+ }
358
368
auto it = pending_responses_.find (response_id);
359
- if (it == pending_responses_.end ())
369
+ if (it == pending_responses_.end ()) {
360
370
return ;
371
+ }
361
372
auto response = std::move (it->second );
362
373
pending_responses_.erase (it);
363
374
response->CompleteEmpty ();
@@ -366,11 +377,13 @@ void PlatformConfiguration::CompletePlatformMessageEmptyResponse(
366
377
void PlatformConfiguration::CompletePlatformMessageResponse (
367
378
int response_id,
368
379
std::vector<uint8_t > data) {
369
- if (!response_id)
380
+ if (!response_id) {
370
381
return ;
382
+ }
371
383
auto it = pending_responses_.find (response_id);
372
- if (it == pending_responses_.end ())
384
+ if (it == pending_responses_.end ()) {
373
385
return ;
386
+ }
374
387
auto response = std::move (it->second );
375
388
pending_responses_.erase (it);
376
389
response->Complete (std::make_unique<fml::DataMapping>(std::move (data)));
0 commit comments