Chromium Code Reviews| Index: components/bookmarks/browser/bookmark_storage.cc |
| diff --git a/components/bookmarks/browser/bookmark_storage.cc b/components/bookmarks/browser/bookmark_storage.cc |
| index d32a90c88061a8b082c770da656f63da4bdfc0a2..d7bebde71730f17062c2070d2643af020c6611d8 100644 |
| --- a/components/bookmarks/browser/bookmark_storage.cc |
| +++ b/components/bookmarks/browser/bookmark_storage.cc |
| @@ -16,6 +16,7 @@ |
| #include "base/json/json_string_value_serializer.h" |
| #include "base/metrics/histogram_macros.h" |
| #include "base/sequenced_task_runner.h" |
| +#include "base/sys_info.h" |
| #include "base/time/time.h" |
| #include "components/bookmarks/browser/bookmark_codec.h" |
| #include "components/bookmarks/browser/bookmark_model.h" |
| @@ -34,6 +35,9 @@ const base::FilePath::CharType kBackupExtension[] = FILE_PATH_LITERAL("bak"); |
| // How often we save. |
| const int kSaveDelayMS = 2500; |
| +// Optional keys present in MetaInfo maps in bookmark nodes to load in memory. |
| +const char* const kOptionalMetakeys[] = {"imageData", "pageData"}; |
| + |
| void BackupCallback(const base::FilePath& path) { |
| base::FilePath backup_path = path.ReplaceExtension(kBackupExtension); |
| base::CopyFile(path, backup_path); |
| @@ -69,6 +73,13 @@ void LoadCallback(const base::FilePath& path, |
| // thread. |
| int64_t max_node_id = 0; |
| BookmarkCodec codec; |
| + // Do not load the image and page data into memory for low-end devices. |
| + if (base::SysInfo::IsLowEndDevice()) { |
|
sky
2017/05/25 02:54:03
What I was getting at with my earlier comment is t
ssid
2017/05/26 01:45:40
I think I have made changes as you suggested.
|
| + std::list<const char*> optional_keys(std::begin(kOptionalMetakeys), |
| + std::end(kOptionalMetakeys)); |
| + codec.set_excluded_meta_info_keys(optional_keys); |
| + } |
| + |
| TimeTicks start_time = TimeTicks::Now(); |
| codec.Decode(details->bb_node(), details->other_folder_node(), |
| details->mobile_folder_node(), &max_node_id, *root.get()); |