diff --git a/assets/BUILD.gn b/assets/BUILD.gn index 28d7e569659f15026c8c52fa6cd765a44cd506ae..580ecfb6ea41b726f71b1ccbe16165ef94d4ba6f 100644 --- a/assets/BUILD.gn +++ b/assets/BUILD.gn @@ -18,7 +18,6 @@ source_set("assets") { "$flutter_root/fml", "$flutter_root/glue", "//garnet/public/lib/fxl", - "//garnet/public/lib/zip", ] public_deps = [ diff --git a/assets/zip_asset_store.cc b/assets/zip_asset_store.cc index 532461ff32a7c99d215a097df9f5de5a7b7f1b0e..6f1ecd65af4d6d746b2d2e056f820f5c3a7397c3 100644 --- a/assets/zip_asset_store.cc +++ b/assets/zip_asset_store.cc @@ -18,6 +18,10 @@ namespace blink { +void UniqueUnzipperTraits::Free(void* file) { + unzClose(file); +} + ZipAssetStore::ZipAssetStore(std::string file_path) : file_path_(std::move(file_path)) { BuildStatCache(); @@ -25,8 +29,8 @@ ZipAssetStore::ZipAssetStore(std::string file_path) ZipAssetStore::~ZipAssetStore() = default; -zip::UniqueUnzipper ZipAssetStore::CreateUnzipper() const { - return zip::UniqueUnzipper{::unzOpen2(file_path_.c_str(), nullptr)}; +UniqueUnzipper ZipAssetStore::CreateUnzipper() const { + return UniqueUnzipper{::unzOpen2(file_path_.c_str(), nullptr)}; } // |blink::AssetResolver| diff --git a/assets/zip_asset_store.h b/assets/zip_asset_store.h index 61b09474a606bf9d7d8ace5af38262328f7277e1..0854194abe4e2ce316849ae687f5d458cdedf97b 100644 --- a/assets/zip_asset_store.h +++ b/assets/zip_asset_store.h @@ -10,11 +10,18 @@ #include "flutter/assets/asset_resolver.h" #include "lib/fxl/macros.h" #include "lib/fxl/memory/ref_counted.h" -#include "lib/zip/unique_unzipper.h" #include "third_party/zlib/contrib/minizip/unzip.h" namespace blink { +struct UniqueUnzipperTraits { + static inline void* InvalidValue() { return nullptr; } + static inline bool IsValid(void* value) { return value != InvalidValue(); } + static void Free(void* file); +}; + +using UniqueUnzipper = fml::UniqueObject; + class ZipAssetStore final : public AssetResolver { public: ZipAssetStore(std::string file_path); @@ -41,7 +48,7 @@ class ZipAssetStore final : public AssetResolver { void BuildStatCache(); - zip::UniqueUnzipper CreateUnzipper() const; + UniqueUnzipper CreateUnzipper() const; FXL_DISALLOW_COPY_AND_ASSIGN(ZipAssetStore); };