From 3b3a025ed445c99bf2a429222ffd1b845e51540e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 12 Feb 2015 17:23:49 +0800 Subject: [PATCH 1/5] Move GetsOrCreateAsarArchive to asar_util.h --- atom.gyp | 2 ++ .../browser/net/asar/asar_protocol_handler.cc | 16 ++------- atom/browser/net/asar/asar_protocol_handler.h | 8 ----- atom/browser/net/asar/url_request_asar_job.cc | 2 +- atom/browser/net/asar/url_request_asar_job.h | 5 +-- atom/common/asar/asar_util.cc | 35 +++++++++++++++++++ atom/common/asar/asar_util.h | 23 ++++++++++++ 7 files changed, 66 insertions(+), 25 deletions(-) create mode 100644 atom/common/asar/asar_util.cc create mode 100644 atom/common/asar/asar_util.h diff --git a/atom.gyp b/atom.gyp index a01d89fa9c7d..826248c54d37 100644 --- a/atom.gyp +++ b/atom.gyp @@ -216,6 +216,8 @@ 'atom/common/api/object_life_monitor.h', 'atom/common/asar/archive.cc', 'atom/common/asar/archive.h', + 'atom/common/asar/asar_util.cc', + 'atom/common/asar/asar_util.h', 'atom/common/asar/scoped_temporary_file.cc', 'atom/common/asar/scoped_temporary_file.h', 'atom/common/common_message_generator.cc', diff --git a/atom/browser/net/asar/asar_protocol_handler.cc b/atom/browser/net/asar/asar_protocol_handler.cc index b2c16b896e1a..1e600feaa4fb 100644 --- a/atom/browser/net/asar/asar_protocol_handler.cc +++ b/atom/browser/net/asar/asar_protocol_handler.cc @@ -6,6 +6,7 @@ #include "atom/browser/net/asar/url_request_asar_job.h" #include "atom/common/asar/archive.h" +#include "atom/common/asar/asar_util.h" #include "net/base/filename_util.h" #include "net/base/net_errors.h" #include "net/url_request/url_request_error_job.h" @@ -49,19 +50,6 @@ AsarProtocolHandler::AsarProtocolHandler( AsarProtocolHandler::~AsarProtocolHandler() { } -Archive* AsarProtocolHandler::GetOrCreateAsarArchive( - const base::FilePath& path) const { - if (!archives_.contains(path)) { - scoped_ptr archive(new Archive(path)); - if (!archive->Init()) - return nullptr; - - archives_.set(path, archive.Pass()); - } - - return archives_.get(path); -} - net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) const { @@ -75,7 +63,7 @@ net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob( return new net::URLRequestFileJob(request, network_delegate, full_path, file_task_runner_); - Archive* archive = GetOrCreateAsarArchive(asar_path); + std::shared_ptr archive = GetOrCreateAsarArchive(asar_path); if (!archive) return new net::URLRequestErrorJob(request, network_delegate, net::ERR_FILE_NOT_FOUND); diff --git a/atom/browser/net/asar/asar_protocol_handler.h b/atom/browser/net/asar/asar_protocol_handler.h index cbfc95b8f778..e0cb74d5d1bf 100644 --- a/atom/browser/net/asar/asar_protocol_handler.h +++ b/atom/browser/net/asar/asar_protocol_handler.h @@ -5,8 +5,6 @@ #ifndef ATOM_BROWSER_NET_ASAR_ASAR_PROTOCOL_HANDLER_H_ #define ATOM_BROWSER_NET_ASAR_ASAR_PROTOCOL_HANDLER_H_ -#include "base/containers/scoped_ptr_hash_map.h" -#include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "net/url_request/url_request_job_factory.h" @@ -16,16 +14,12 @@ class TaskRunner; namespace asar { -class Archive; - class AsarProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { public: explicit AsarProtocolHandler( const scoped_refptr& file_task_runner); virtual ~AsarProtocolHandler(); - Archive* GetOrCreateAsarArchive(const base::FilePath& path) const; - // net::URLRequestJobFactory::ProtocolHandler: net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, @@ -35,8 +29,6 @@ class AsarProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { private: const scoped_refptr file_task_runner_; - mutable base::ScopedPtrHashMap archives_; - DISALLOW_COPY_AND_ASSIGN(AsarProtocolHandler); }; diff --git a/atom/browser/net/asar/url_request_asar_job.cc b/atom/browser/net/asar/url_request_asar_job.cc index aeaab646a9d4..82cade53c6f7 100644 --- a/atom/browser/net/asar/url_request_asar_job.cc +++ b/atom/browser/net/asar/url_request_asar_job.cc @@ -17,7 +17,7 @@ namespace asar { URLRequestAsarJob::URLRequestAsarJob( net::URLRequest* request, net::NetworkDelegate* network_delegate, - Archive* archive, + std::shared_ptr archive, const base::FilePath& file_path, const scoped_refptr& file_task_runner) : net::URLRequestJob(request, network_delegate), diff --git a/atom/browser/net/asar/url_request_asar_job.h b/atom/browser/net/asar/url_request_asar_job.h index 899976471f0e..dc23e327cdff 100644 --- a/atom/browser/net/asar/url_request_asar_job.h +++ b/atom/browser/net/asar/url_request_asar_job.h @@ -5,6 +5,7 @@ #ifndef ATOM_BROWSER_NET_ASAR_URL_REQUEST_ASAR_JOB_H_ #define ATOM_BROWSER_NET_ASAR_URL_REQUEST_ASAR_JOB_H_ +#include #include #include "atom/common/asar/archive.h" @@ -27,7 +28,7 @@ class URLRequestAsarJob : public net::URLRequestJob { public: URLRequestAsarJob(net::URLRequest* request, net::NetworkDelegate* network_delegate, - Archive* archive, + std::shared_ptr archive, const base::FilePath& file_path, const scoped_refptr& file_task_runner); @@ -53,7 +54,7 @@ class URLRequestAsarJob : public net::URLRequestJob { // Callback after data is asynchronously read from the file into |buf|. void DidRead(scoped_refptr buf, int result); - Archive* archive_; + std::shared_ptr archive_; Archive::FileInfo file_info_; base::FilePath file_path_; diff --git a/atom/common/asar/asar_util.cc b/atom/common/asar/asar_util.cc new file mode 100644 index 000000000000..256992c95899 --- /dev/null +++ b/atom/common/asar/asar_util.cc @@ -0,0 +1,35 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/common/asar/asar_util.h" + +#include + +#include "atom/common/asar/archive.h" +#include "base/files/file_path.h" +#include "base/lazy_instance.h" +#include "base/stl_util.h" + +namespace asar { + +typedef std::map> ArchiveMap; + +namespace { + +static base::LazyInstance g_archive_map = LAZY_INSTANCE_INITIALIZER; + +} // namespace + +std::shared_ptr GetOrCreateAsarArchive(const base::FilePath& path) { + ArchiveMap& archive_map = *g_archive_map.Pointer(); + if (!ContainsKey(archive_map, path)) { + std::shared_ptr archive(new Archive(path)); + if (!archive->Init()) + return nullptr; + archive_map[path] = archive; + } + return archive_map[path]; +} + +} // namespace asar diff --git a/atom/common/asar/asar_util.h b/atom/common/asar/asar_util.h new file mode 100644 index 000000000000..f44204b2f763 --- /dev/null +++ b/atom/common/asar/asar_util.h @@ -0,0 +1,23 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_COMMON_ASAR_ASAR_UTIL_H_ +#define ATOM_COMMON_ASAR_ASAR_UTIL_H_ + +#include + +namespace base { +class FilePath; +} + +namespace asar { + +class Archive; + +// Gets or creates a new Archive from the path. +std::shared_ptr GetOrCreateAsarArchive(const base::FilePath& path); + +} // namespace asar + +#endif // ATOM_COMMON_ASAR_ASAR_UTIL_H_ From 98a7f08be2ca7aaeb2ebdcea49811dc1ec19771a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 12 Feb 2015 17:31:14 +0800 Subject: [PATCH 2/5] Move GetAsarArchivePath to asar_util.h --- .../browser/net/asar/asar_protocol_handler.cc | 31 +------------------ atom/common/asar/asar_util.cc | 25 +++++++++++++++ atom/common/asar/asar_util.h | 5 +++ 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/atom/browser/net/asar/asar_protocol_handler.cc b/atom/browser/net/asar/asar_protocol_handler.cc index 1e600feaa4fb..0daa6f427e8f 100644 --- a/atom/browser/net/asar/asar_protocol_handler.cc +++ b/atom/browser/net/asar/asar_protocol_handler.cc @@ -14,35 +14,6 @@ namespace asar { -namespace { - -const base::FilePath::CharType kAsarExtension[] = FILE_PATH_LITERAL(".asar"); - -// Get the relative path in asar archive. -bool GetAsarPath(const base::FilePath& full_path, - base::FilePath* asar_path, - base::FilePath* relative_path) { - base::FilePath iter = full_path; - while (true) { - base::FilePath dirname = iter.DirName(); - if (iter.MatchesExtension(kAsarExtension)) - break; - else if (iter == dirname) - return false; - iter = dirname; - } - - base::FilePath tail; - if (!iter.AppendRelativePath(full_path, &tail)) - return false; - - *asar_path = iter; - *relative_path = tail; - return true; -} - -} // namespace - AsarProtocolHandler::AsarProtocolHandler( const scoped_refptr& file_task_runner) : file_task_runner_(file_task_runner) {} @@ -59,7 +30,7 @@ net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob( // Create asar:// job when the path contains "xxx.asar/", otherwise treat the // URL request as file://. base::FilePath asar_path, relative_path; - if (!GetAsarPath(full_path, &asar_path, &relative_path)) + if (!GetAsarArchivePath(full_path, &asar_path, &relative_path)) return new net::URLRequestFileJob(request, network_delegate, full_path, file_task_runner_); diff --git a/atom/common/asar/asar_util.cc b/atom/common/asar/asar_util.cc index 256992c95899..241f230c55b3 100644 --- a/atom/common/asar/asar_util.cc +++ b/atom/common/asar/asar_util.cc @@ -17,8 +17,11 @@ typedef std::map> ArchiveMap; namespace { +// The global instance of ArchiveMap, will be destroyed on exit. static base::LazyInstance g_archive_map = LAZY_INSTANCE_INITIALIZER; +const base::FilePath::CharType kAsarExtension[] = FILE_PATH_LITERAL(".asar"); + } // namespace std::shared_ptr GetOrCreateAsarArchive(const base::FilePath& path) { @@ -32,4 +35,26 @@ std::shared_ptr GetOrCreateAsarArchive(const base::FilePath& path) { return archive_map[path]; } +bool GetAsarArchivePath(const base::FilePath& full_path, + base::FilePath* asar_path, + base::FilePath* relative_path) { + base::FilePath iter = full_path; + while (true) { + base::FilePath dirname = iter.DirName(); + if (iter.MatchesExtension(kAsarExtension)) + break; + else if (iter == dirname) + return false; + iter = dirname; + } + + base::FilePath tail; + if (!iter.AppendRelativePath(full_path, &tail)) + return false; + + *asar_path = iter; + *relative_path = tail; + return true; +} + } // namespace asar diff --git a/atom/common/asar/asar_util.h b/atom/common/asar/asar_util.h index f44204b2f763..9df55da5f3cd 100644 --- a/atom/common/asar/asar_util.h +++ b/atom/common/asar/asar_util.h @@ -18,6 +18,11 @@ class Archive; // Gets or creates a new Archive from the path. std::shared_ptr GetOrCreateAsarArchive(const base::FilePath& path); +// Separates the path to Archive out. +bool GetAsarArchivePath(const base::FilePath& full_path, + base::FilePath* asar_path, + base::FilePath* relative_path); + } // namespace asar #endif // ATOM_COMMON_ASAR_ASAR_UTIL_H_ From 3678f13dfb0e1266f06b247535039393b820fa5c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 12 Feb 2015 19:34:21 +0800 Subject: [PATCH 3/5] Make NativeImage work with asar archive --- atom/common/api/atom_api_native_image.cc | 4 ++-- atom/common/asar/asar_util.cc | 23 +++++++++++++++++++++++ atom/common/asar/asar_util.h | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index 6b873fa7f55a..a57ff221a424 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -7,11 +7,11 @@ #include #include +#include "atom/common/asar/asar_util.h" #include "atom/common/native_mate_converters/file_path_converter.h" #include "atom/common/native_mate_converters/gfx_converter.h" #include "atom/common/native_mate_converters/gurl_converter.h" #include "base/base64.h" -#include "base/files/file_util.h" #include "base/strings/string_util.h" #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" @@ -86,7 +86,7 @@ bool AddImageSkiaRep(gfx::ImageSkia* image, const base::FilePath& path, double scale_factor) { std::string file_contents; - if (!base::ReadFileToString(path, &file_contents)) + if (!asar::ReadFileToString(path, &file_contents)) return false; const unsigned char* data = diff --git a/atom/common/asar/asar_util.cc b/atom/common/asar/asar_util.cc index 241f230c55b3..7c35ddcc5c2c 100644 --- a/atom/common/asar/asar_util.cc +++ b/atom/common/asar/asar_util.cc @@ -8,6 +8,7 @@ #include "atom/common/asar/archive.h" #include "base/files/file_path.h" +#include "base/files/file_util.h" #include "base/lazy_instance.h" #include "base/stl_util.h" @@ -57,4 +58,26 @@ bool GetAsarArchivePath(const base::FilePath& full_path, return true; } +bool ReadFileToString(const base::FilePath& path, std::string* contents) { + base::FilePath asar_path, relative_path; + if (!GetAsarArchivePath(path, &asar_path, &relative_path)) + return base::ReadFileToString(path, contents); + + std::shared_ptr archive = GetOrCreateAsarArchive(asar_path); + if (!archive) + return false; + + Archive::FileInfo info; + if (!archive->GetFileInfo(relative_path, &info)) + return false; + + base::File src(asar_path, base::File::FLAG_OPEN | base::File::FLAG_READ); + if (!src.IsValid()) + return false; + + contents->resize(info.size); + return static_cast(info.size) == src.Read( + info.offset, const_cast(contents->data()), contents->size()); +} + } // namespace asar diff --git a/atom/common/asar/asar_util.h b/atom/common/asar/asar_util.h index 9df55da5f3cd..b3c60f679b52 100644 --- a/atom/common/asar/asar_util.h +++ b/atom/common/asar/asar_util.h @@ -23,6 +23,9 @@ bool GetAsarArchivePath(const base::FilePath& full_path, base::FilePath* asar_path, base::FilePath* relative_path); +// Same with base::ReadFileToString but supports asar Archive. +bool ReadFileToString(const base::FilePath& path, std::string* contents); + } // namespace asar #endif // ATOM_COMMON_ASAR_ASAR_UTIL_H_ From 9646c28a4151299a176a88202a1e3dde8b8117c9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 12 Feb 2015 19:34:39 +0800 Subject: [PATCH 4/5] spec: native-image should read asar archive --- spec/asar-spec.coffee | 6 ++++++ spec/fixtures/asar/logo.asar | Bin 0 -> 16134 bytes 2 files changed, 6 insertions(+) create mode 100644 spec/fixtures/asar/logo.asar diff --git a/spec/asar-spec.coffee b/spec/asar-spec.coffee index ab96d7ee3d6f..222faf9a5e2e 100644 --- a/spec/asar-spec.coffee +++ b/spec/asar-spec.coffee @@ -430,3 +430,9 @@ describe 'asar package', -> it 'does not touch global fs object', -> assert.notEqual fs.readdir, gfs.readdir + + describe 'native-image', -> + it 'reads image from asar archive', -> + p = path.join fixtures, 'asar', 'logo.asar', 'logo.png' + logo = require('native-image').createFromPath p + assert.deepEqual logo.getSize(), {width: 55, height: 55} diff --git a/spec/fixtures/asar/logo.asar b/spec/fixtures/asar/logo.asar new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!vW9uQRTuINA3|84#hYQ06Ff~q3C%U$6>f+Jt5fvo(DKJkZOKu5y>QLbhi F{cnFYJ2e0R literal 0 HcmV?d00001 From a8c227d5f51665decbafb3bb72c3431484016247 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 12 Feb 2015 19:50:28 +0800 Subject: [PATCH 5/5] Fix cpplint warnings --- atom/common/asar/asar_util.cc | 4 ++-- atom/common/asar/asar_util.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/atom/common/asar/asar_util.cc b/atom/common/asar/asar_util.cc index 7c35ddcc5c2c..43e2601ac456 100644 --- a/atom/common/asar/asar_util.cc +++ b/atom/common/asar/asar_util.cc @@ -5,6 +5,7 @@ #include "atom/common/asar/asar_util.h" #include +#include #include "atom/common/asar/archive.h" #include "base/files/file_path.h" @@ -14,11 +15,10 @@ namespace asar { -typedef std::map> ArchiveMap; - namespace { // The global instance of ArchiveMap, will be destroyed on exit. +typedef std::map> ArchiveMap; static base::LazyInstance g_archive_map = LAZY_INSTANCE_INITIALIZER; const base::FilePath::CharType kAsarExtension[] = FILE_PATH_LITERAL(".asar"); diff --git a/atom/common/asar/asar_util.h b/atom/common/asar/asar_util.h index b3c60f679b52..4cb5b88e0483 100644 --- a/atom/common/asar/asar_util.h +++ b/atom/common/asar/asar_util.h @@ -6,6 +6,7 @@ #define ATOM_COMMON_ASAR_ASAR_UTIL_H_ #include +#include namespace base { class FilePath;