Skip to content

Commit

Permalink
Avoid sync engine having to read the session name
Browse files Browse the repository at this point in the history
Datatypes are now capable of reading this name (the device's name)
without help from SyncEngine/ProfileSyncService, so we can avoid
plumbing this string through in core sync code.

Bug: 922971
Change-Id: I17461fa7af2ed39dcf311bd54907e8776256d463
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1564998
Reviewed-by: Mohamed Amir Yosef <mamir@chromium.org>
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#650335}
  • Loading branch information
Mikel Astiz authored and Commit Bot committed Apr 12, 2019
1 parent 9cb44c4 commit f7a6591
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 20 deletions.
4 changes: 1 addition & 3 deletions components/sync/driver/glue/sync_engine_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "components/data_use_measurement/core/data_use_user_data.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
#include "components/sync/base/get_session_name.h"
#include "components/sync/base/invalidation_adapter.h"
#include "components/sync/base/sync_base_switches.h"
#include "components/sync/device_info/local_device_info_provider_impl.h"
Expand Down Expand Up @@ -443,8 +442,7 @@ void SyncEngineBackend::DoInitialProcessControlTypes() {
FROM_HERE, &SyncEngineImpl::HandleInitializationSuccessOnFrontendLoop,
registrar_->GetLastConfiguredTypes(), js_backend_, debug_info_listener_,
base::Passed(sync_manager_->GetModelTypeConnectorProxy()),
sync_manager_->cache_guid(), GetSessionNameBlocking(),
user_share->directory->store_birthday(),
sync_manager_->cache_guid(), user_share->directory->store_birthday(),
user_share->directory->bag_of_chips());

js_backend_.Reset();
Expand Down
5 changes: 2 additions & 3 deletions components/sync/driver/glue/sync_engine_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ void SyncEngineImpl::HandleInitializationSuccessOnFrontendLoop(
const WeakHandle<DataTypeDebugInfoListener> debug_info_listener,
std::unique_ptr<ModelTypeConnector> model_type_connector,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
Expand All @@ -332,15 +331,15 @@ void SyncEngineImpl::HandleInitializationSuccessOnFrontendLoop(
}

host_->OnEngineInitialized(initial_types, js_backend, debug_info_listener,
cache_guid, session_name, birthday, bag_of_chips,
cache_guid, birthday, bag_of_chips,
/*success=*/true);
}

void SyncEngineImpl::HandleInitializationFailureOnFrontendLoop() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
host_->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(),
WeakHandle<DataTypeDebugInfoListener>(),
/*cache_guid=*/"", /*session_name=*/"",
/*cache_guid=*/"",
/*birthday=*/"", /*bag_of_chips=*/"",
/*success=*/false);
}
Expand Down
1 change: 0 additions & 1 deletion components/sync/driver/glue/sync_engine_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class SyncEngineImpl : public SyncEngine, public InvalidationHandler {
const WeakHandle<DataTypeDebugInfoListener> debug_info_listener,
std::unique_ptr<ModelTypeConnector> model_type_connector,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips);

Expand Down
1 change: 0 additions & 1 deletion components/sync/driver/glue/sync_engine_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class TestSyncEngineHost : public SyncEngineHostStub {
const std::string&,
const std::string&,
const std::string&,
const std::string&,
bool success) override {
EXPECT_EQ(expect_success_, success);
set_engine_types_.Run(initial_types);
Expand Down
1 change: 0 additions & 1 deletion components/sync/driver/profile_sync_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ void ProfileSyncService::OnEngineInitialized(
const WeakHandle<JsBackend>& js_backend,
const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips,
bool success) {
Expand Down
1 change: 0 additions & 1 deletion components/sync/driver/profile_sync_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class ProfileSyncService : public SyncService,
const WeakHandle<JsBackend>& js_backend,
const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips,
bool success) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,8 @@ TEST_F(ProfileSyncServiceStartupTest, FullStartupSequenceFirstTime) {
ON_CALL(*sync_engine, IsInitialized()).WillByDefault(Return(true));
sync_service()->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(),
WeakHandle<DataTypeDebugInfoListener>(),
"test-guid", "test-session-name",
"test-birthday", "test-bag-of-chips",
"test-guid", "test-birthday",
"test-bag-of-chips",
/*success=*/true);
ASSERT_TRUE(sync_service()->IsEngineInitialized());
EXPECT_EQ(SyncService::TransportState::PENDING_DESIRED_CONFIGURATION,
Expand Down Expand Up @@ -714,8 +714,8 @@ TEST_F(ProfileSyncServiceStartupTest, FullStartupSequenceNthTime) {
ON_CALL(*sync_engine, IsInitialized()).WillByDefault(Return(true));
sync_service()->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(),
WeakHandle<DataTypeDebugInfoListener>(),
"test-guid", "test-session-name",
"test-birthday", "test-bag-of-chips",
"test-guid", "test-birthday",
"test-bag-of-chips",
/*success=*/true);
ON_CALL(*data_type_manager, state())
.WillByDefault(Return(DataTypeManager::CONFIGURING));
Expand Down
5 changes: 2 additions & 3 deletions components/sync/engine/fake_sync_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace syncer {
namespace {

const char kTestCacheGuid[] = "test-guid";
const char kTestSessionName[] = "test-session-name";
const char kTestBirthday[] = "1";

} // namespace
Expand All @@ -25,8 +24,8 @@ void FakeSyncEngine::Initialize(InitParams params) {
initialized_ = success;
params.host->OnEngineInitialized(ModelTypeSet(), WeakHandle<JsBackend>(),
WeakHandle<DataTypeDebugInfoListener>(),
kTestCacheGuid, kTestSessionName,
kTestBirthday, /*bag_of_chips=*/"", success);
kTestCacheGuid, kTestBirthday,
/*bag_of_chips=*/"", success);
}

bool FakeSyncEngine::IsInitialized() const {
Expand Down
1 change: 0 additions & 1 deletion components/sync/engine/sync_engine_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class SyncEngineHost {
const WeakHandle<JsBackend>& js_backend,
const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips,
bool success) = 0;
Expand Down
1 change: 0 additions & 1 deletion components/sync/engine/sync_engine_host_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ void SyncEngineHostStub::OnEngineInitialized(
const WeakHandle<JsBackend>& js_backend,
const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips,
bool success) {}
Expand Down
1 change: 0 additions & 1 deletion components/sync/engine/sync_engine_host_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class SyncEngineHostStub : public SyncEngineHost {
const WeakHandle<JsBackend>& js_backend,
const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
const std::string& cache_guid,
const std::string& session_name,
const std::string& birthday,
const std::string& bag_of_chips,
bool success) override;
Expand Down

0 comments on commit f7a6591

Please sign in to comment.