Skip to content

Commit

Permalink
Implement GetAllData and GetStorageKey. Also add TypedURLSyncBridge to
Browse files Browse the repository at this point in the history
be an observer of HistoryBackend.
Change storageKey using big endian, since user event is using big endian, and it is better to unify our number style.

BUG=726158

The following 4 functions are ported from TypedUrlSyncableService.
GetErrorPercentage()
WriteToTypedUrlSpecifics()
ClearErrorStats()
FixupURLAndGetVisits()

Review-Url: https://codereview.chromium.org/2901093009
Cr-Commit-Position: refs/heads/master@{#477079}
  • Loading branch information
gangwu authored and Commit Bot committed Jun 5, 2017
1 parent d134f7b commit c2ae2ba
Show file tree
Hide file tree
Showing 8 changed files with 643 additions and 31 deletions.
1 change: 1 addition & 0 deletions components/history/core/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ source_set("unit_tests") {
"top_sites_cache_unittest.cc",
"top_sites_database_unittest.cc",
"top_sites_impl_unittest.cc",
"typed_url_sync_bridge_unittest.cc",
"typed_url_sync_metadata_database_unittest.cc",
"typed_url_syncable_service_unittest.cc",
"url_database_unittest.cc",
Expand Down
2 changes: 1 addition & 1 deletion components/history/core/browser/history_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "components/history/core/browser/in_memory_history_backend.h"
#include "components/history/core/browser/keyword_search_term.h"
#include "components/history/core/browser/page_usage_data.h"
#include "components/history/core/browser/typed_url_sync_bridge.h"
#include "components/history/core/browser/typed_url_syncable_service.h"
#include "components/history/core/browser/url_utils.h"
#include "components/sync/driver/sync_driver_switches.h"
Expand Down Expand Up @@ -224,6 +223,7 @@ void HistoryBackend::Init(
&ModelTypeChangeProcessor::Create,
// TODO(gangwu): use ReportUnrecoverableError before launch.
base::BindRepeating(base::IgnoreResult(&DumpWithoutCrashing))));
typed_url_sync_bridge_->Init();
} else {
typed_url_syncable_service_ =
base::MakeUnique<TypedUrlSyncableService>(this);
Expand Down
7 changes: 6 additions & 1 deletion components/history/core/browser/history_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/keyword_id.h"
#include "components/history/core/browser/thumbnail_database.h"
#include "components/history/core/browser/typed_url_sync_bridge.h"
#include "components/history/core/browser/visit_tracker.h"
#include "sql/init_status.h"

Expand All @@ -53,7 +54,6 @@ struct HistoryDatabaseParams;
class HistoryDBTask;
class InMemoryHistoryBackend;
class TypedUrlSyncableService;
class TypedURLSyncBridge;
class HistoryBackendHelper;
class URLDatabase;

Expand Down Expand Up @@ -476,6 +476,11 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
HistoryDatabase* db() const { return db_.get(); }

ExpireHistoryBackend* expire_backend() { return &expirer_; }

void SetTypedURLSyncBridgeForTest(
std::unique_ptr<TypedURLSyncBridge> bridge) {
typed_url_sync_bridge_ = std::move(bridge);
}
#endif

// Returns true if the passed visit time is already expired (used by the sync
Expand Down
Loading

0 comments on commit c2ae2ba

Please sign in to comment.