forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce UnzipperProvider (flutter#3004)
This patch abstracts where the content of the zip file is stored. Currently, zip files are stored in the file system, but in Fuchsia, we're going to store them in memory (at least for the time being). Rather than represent a zip file as a path in the file system, we instead use an UnzipperProvider, which can create zip::UniqueUnzipper objects on demand.
- Loading branch information
Showing
11 changed files
with
79 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "flutter/assets/unzipper_provider.h" | ||
|
||
#include "lib/ftl/logging.h" | ||
#include "third_party/zlib/contrib/minizip/unzip.h" | ||
|
||
namespace blink { | ||
|
||
UnzipperProvider GetUnzipperProviderForPath(std::string zip_path) { | ||
return [zip_path]() { | ||
zip::UniqueUnzipper unzipper(unzOpen2(zip_path.c_str(), nullptr)); | ||
if (!unzipper.is_valid()) | ||
FTL_LOG(ERROR) << "Unable to open zip file: " << zip_path; | ||
return unzipper; | ||
}; | ||
} | ||
|
||
} // namespace blink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2016 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef FLUTTER_ASSETS_UNZIP_PROVIDER_H_ | ||
#define FLUTTER_ASSETS_UNZIP_PROVIDER_H_ | ||
|
||
#include <functional> | ||
|
||
#include "lib/zip/unique_unzipper.h" | ||
|
||
namespace blink { | ||
|
||
using UnzipperProvider = std::function<zip::UniqueUnzipper()>; | ||
|
||
UnzipperProvider GetUnzipperProviderForPath(std::string zip_path); | ||
|
||
} // namespace blink | ||
|
||
#endif // FLUTTER_ASSETS_UNZIP_PROVIDER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters