未验证 提交 fe92a512 编写于 作者: C Chinmay Garde 提交者: GitHub

Fix iOS build to account for Shell rasterizer registration updates. (#4295)

上级 eabcf3aa
......@@ -7,6 +7,7 @@
#include "flutter/common/settings.h"
#include "flutter/common/threads.h"
#include "flutter/flow/layers/layer_tree.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/common/shell.h"
#include "lib/fxl/synchronization/waitable_event.h"
......@@ -88,17 +89,24 @@ void SnapshotRasterizer(fxl::WeakPtr<shell::Rasterizer> rasterizer,
SkCGDrawBitmap(context, bitmap, 0, 0);
}
static fxl::WeakPtr<shell::Rasterizer> GetRandomRasterizer() {
fxl::WeakPtr<shell::Rasterizer> rasterizer;
shell::Shell::Shared().IteratePlatformViews([&rasterizer](shell::PlatformView* view) -> bool {
rasterizer = view->rasterizer().GetWeakRasterizerPtr();
// We just grab the first rasterizer so there is no need to iterate
// further.
return false;
});
return rasterizer;
}
void SnapshotContents(CGContextRef context, bool is_opaque) {
// TODO(chinmaygarde): Currently, there is no way to get the rasterizer for
// a particular platform view from the shell. But, for now, we only have one
// platform view. So use that. Once we support multiple platform views, the
// shell will need to provide a way to get the rasterizer for a specific
// platform view.
std::vector<fxl::WeakPtr<shell::Rasterizer>> registered_rasterizers;
shell::Shell::Shared().GetRasterizers(&registered_rasterizers);
for (auto& rasterizer : registered_rasterizers) {
SnapshotRasterizer(rasterizer, context, is_opaque);
}
SnapshotRasterizer(GetRandomRasterizer(), context, is_opaque);
}
void SnapshotContentsSync(CGContextRef context, UIView* view) {
......
......@@ -31,7 +31,7 @@ void PlatformViewIOS::Attach() {
void PlatformViewIOS::Attach(fxl::Closure firstFrameCallback) {
CreateEngine();
PostAddToShellTask();
if (firstFrameCallback) {
firstFrameCallback_ = firstFrameCallback;
rasterizer_->AddNextFrameCallback([weakSelf = GetWeakPtr()] {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册