未验证 提交 6c7ddd81 编写于 作者: J Jason Simmons 提交者: GitHub

Remove the dependency on the Garnet zip library (#5770)

上级 e02bd924
......@@ -18,7 +18,6 @@ source_set("assets") {
"$flutter_root/fml",
"$flutter_root/glue",
"//garnet/public/lib/fxl",
"//garnet/public/lib/zip",
]
public_deps = [
......
......@@ -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|
......
......@@ -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<void*, UniqueUnzipperTraits>;
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);
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册