Skip to content

Commit

Permalink
Fix windows build by using lambda capture workaround (flutter#4514)
Browse files Browse the repository at this point in the history
* Fix windows build by using lambda capture workaround

* clang format, add todo

* clang-format again
  • Loading branch information
aam authored Jan 4, 2018
1 parent 6bacf45 commit f6ea8f3
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,27 +331,33 @@ void Shell::SetAssetBundlePathInPlatformViewUIThread(

*view_existed = false;

IteratePlatformViews([
view_id, // argument
assets_directory = std::move(assets_directory), // argument
&view_existed, // out
&dart_isolate_id, // out
&isolate_name // out
](PlatformView * view)
->bool {
if (reinterpret_cast<uintptr_t>(view) != view_id) {
// Keep looking.
return true;
}
*view_existed = true;
view->SetAssetBundlePath(assets_directory);
*dart_isolate_id =
view->engine().GetUIIsolateMainPort();
*isolate_name = view->engine().GetUIIsolateName();
// We found the requested view. Stop iterating over
// platform views.
return false;
});
IteratePlatformViews(
[view_id, // argument
#if !defined(OS_WIN)
// Using std::move on const references inside lambda capture is
// not supported on Windows for some reason.
// TODO(https://github.com/flutter/flutter/issues/13908):
// Investigate the root cause of the difference.
assets_directory = std::move(assets_directory), // argument
#else
assets_directory, // argument
#endif
&view_existed, // out
&dart_isolate_id, // out
&isolate_name // out
](PlatformView* view) -> bool {
if (reinterpret_cast<uintptr_t>(view) != view_id) {
// Keep looking.
return true;
}
*view_existed = true;
view->SetAssetBundlePath(assets_directory);
*dart_isolate_id = view->engine().GetUIIsolateMainPort();
*isolate_name = view->engine().GetUIIsolateName();
// We found the requested view. Stop iterating over
// platform views.
return false;
});

latch->Signal();
}
Expand Down

0 comments on commit f6ea8f3

Please sign in to comment.