From 9c1e48434bacc49f8e22d715b6af6171c528e67f Mon Sep 17 00:00:00 2001 From: Alhaad Gokhale Date: Fri, 9 Mar 2018 12:18:25 -0800 Subject: [PATCH] Updates for Fuchsia roll. (#4765) * AssetProvider * libtxt --- content_handler/app.cc | 5 +++-- content_handler/runtime_holder.cc | 10 +++++----- content_handler/runtime_holder.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/content_handler/app.cc b/content_handler/app.cc index ca6ef350d..91f57359f 100644 --- a/content_handler/app.cc +++ b/content_handler/app.cc @@ -74,8 +74,9 @@ App::App() { if (settings.using_blink) { blink::SetFontProvider(std::move(font_provider)); } else { - blink::FontCollection::ForProcess().GetFontCollection()->PushFront( - sk_make_sp(std::move(font_provider))); + blink::FontCollection::ForProcess().GetFontCollection()-> + SetAssetFontManager( + sk_make_sp(std::move(font_provider))); } context_->outgoing_services()->AddService( diff --git a/content_handler/runtime_holder.cc b/content_handler/runtime_holder.cc index 486cf2d4d..61419e462 100644 --- a/content_handler/runtime_holder.cc +++ b/content_handler/runtime_holder.cc @@ -411,8 +411,8 @@ void RuntimeHolder::HandlePlatformMessage( } void RuntimeHolder::DidCreateMainIsolate(Dart_Isolate isolate) { - if (directory_asset_bundle_) { - blink::AssetFontSelector::Install(directory_asset_bundle_); + if (asset_provider_) { + blink::AssetFontSelector::Install(asset_provider_); } else if (asset_store_) { blink::AssetFontSelector::Install(asset_store_); } @@ -504,7 +504,7 @@ void RuntimeHolder::InitRootBundle(std::vector bundle) { FXL_LOG(ERROR) << "Unable to load data dir"; return; } - directory_asset_bundle_ = + asset_provider_ = fxl::MakeRefCounted(std::move(data_dir)); } } @@ -532,8 +532,8 @@ bool RuntimeHolder::HandleAssetPlatformMessage( bool RuntimeHolder::GetAssetAsBuffer(const std::string& name, std::vector* data) { - return (directory_asset_bundle_ && - directory_asset_bundle_->GetAsBuffer(name, data)) || + return (asset_provider_ && + asset_provider_->GetAsBuffer(name, data)) || (asset_store_ && asset_store_->GetAsBuffer(name, data)); } diff --git a/content_handler/runtime_holder.h b/content_handler/runtime_holder.h index 23a9a2591..39fe3ff1a 100644 --- a/content_handler/runtime_holder.h +++ b/content_handler/runtime_holder.h @@ -11,6 +11,7 @@ #include #include "dart-pkg/fuchsia/sdk_ext/fuchsia.h" +#include "flutter/assets/asset_provider.h" #include "flutter/assets/directory_asset_bundle.h" #include "flutter/assets/unzipper_provider.h" #include "flutter/assets/zip_asset_store.h" @@ -115,7 +116,7 @@ class RuntimeHolder : public blink::RuntimeDelegate, std::vector root_bundle_data_; // TODO(zarah): Remove asset_store_ when flx is completely removed fxl::RefPtr asset_store_; - fxl::RefPtr directory_asset_bundle_; + fxl::RefPtr asset_provider_; void* dylib_handle_ = nullptr; std::unique_ptr rasterizer_; std::unique_ptr runtime_; -- GitLab