#include "components/bookmarks/browser/model_loader.h"
#include <optional>
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_reader.h"
#include "base/numerics/clamped_math.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "components/bookmarks/browser/bookmark_codec.h"
#include "components/bookmarks/browser/bookmark_load_details.h"
#include "components/bookmarks/browser/titled_url_index.h"
#include "components/bookmarks/browser/url_index.h"
#include "components/bookmarks/common/bookmark_metrics.h"
#include "components/bookmarks/common/url_load_stats.h"
namespace bookmarks {
namespace {
std::optional<base::Value::Dict> LoadFileToDict(
const base::FilePath& file_path) { … }
std::unique_ptr<BookmarkLoadDetails> LoadBookmarks(
const base::FilePath& local_or_syncable_file_path,
const base::FilePath& account_file_path) { … }
void LoadManagedNode(LoadManagedNodeCallback load_managed_node_callback,
BookmarkLoadDetails& details) { … }
uint64_t GetFileSizeOrZero(const base::FilePath& file_path) { … }
void RecordLoadMetrics(const BookmarkLoadDetails& details,
const base::FilePath& local_or_syncable_file_path,
const base::FilePath& account_file_path) { … }
}
scoped_refptr<ModelLoader> ModelLoader::Create(
const base::FilePath& local_or_syncable_file_path,
const base::FilePath& account_file_path,
LoadManagedNodeCallback load_managed_node_callback,
LoadCallback callback) { … }
void ModelLoader::BlockTillLoaded() { … }
ModelLoader::ModelLoader()
: … { … }
ModelLoader::~ModelLoader() = default;
std::unique_ptr<BookmarkLoadDetails> ModelLoader::DoLoadOnBackgroundThread(
const base::FilePath& local_or_syncable_file_path,
const base::FilePath& account_file_path,
LoadManagedNodeCallback load_managed_node_callback) { … }
scoped_refptr<ModelLoader> ModelLoader::CreateForTest(
LoadManagedNodeCallback load_managed_node_callback,
BookmarkLoadDetails* details) { … }
}