From fc767e432da4a41c9de2cccbc262c21f77958231 Mon Sep 17 00:00:00 2001 From: "jianli@chromium.org" Date: Tue, 13 May 2014 05:02:14 +0000 Subject: [PATCH] Rename GCMClient::Load to GCMClient::Start This is to address TODO and keep the naming consistent. BUG=none TEST=none due to no functionality changes Review URL: https://codereview.chromium.org/285623002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270020 0039d316-1c4b-4281-b951-d872f2087c98 --- .../extension_gcm_app_handler_unittest.cc | 2 +- .../services/gcm/fake_gcm_client_factory.cc | 6 +-- .../services/gcm/fake_gcm_client_factory.h | 5 +- .../browser/services/gcm/gcm_client_mock.cc | 12 ++--- chrome/browser/services/gcm/gcm_client_mock.h | 15 +++--- .../gcm/gcm_profile_service_unittest.cc | 6 +-- chrome/browser/services/gcm/gcm_service.cc | 28 +++++----- chrome/browser/services/gcm/gcm_service.h | 4 +- .../services/gcm/gcm_service_unittest.cc | 52 +++++++++---------- google_apis/gcm/gcm_client.h | 8 +-- google_apis/gcm/gcm_client_impl.cc | 2 +- google_apis/gcm/gcm_client_impl.h | 2 +- google_apis/gcm/gcm_client_impl_unittest.cc | 2 +- 13 files changed, 70 insertions(+), 74 deletions(-) diff --git a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc index 6b5726191be7..8e9f3cc0f2fa 100644 --- a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc +++ b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc @@ -216,7 +216,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test { profile(), &ExtensionGCMAppHandlerTest::BuildGCMProfileService)); scoped_ptr gcm_client_factory( - new gcm::FakeGCMClientFactory(gcm::GCMClientMock::NO_DELAY_LOADING)); + new gcm::FakeGCMClientFactory(gcm::GCMClientMock::NO_DELAY_START)); gcm_profile_service->Initialize(gcm_client_factory.Pass()); // Create a fake version of ExtensionGCMAppHandler. diff --git a/chrome/browser/services/gcm/fake_gcm_client_factory.cc b/chrome/browser/services/gcm/fake_gcm_client_factory.cc index 2d1d23c8c3d4..ba44d4de3ffe 100644 --- a/chrome/browser/services/gcm/fake_gcm_client_factory.cc +++ b/chrome/browser/services/gcm/fake_gcm_client_factory.cc @@ -10,15 +10,15 @@ namespace gcm { FakeGCMClientFactory::FakeGCMClientFactory( - GCMClientMock::LoadingDelay gcm_client_loading_delay) - : gcm_client_loading_delay_(gcm_client_loading_delay) { + GCMClientMock::StartMode gcm_client_start_mode) + : gcm_client_start_mode_(gcm_client_start_mode) { } FakeGCMClientFactory::~FakeGCMClientFactory() { } scoped_ptr FakeGCMClientFactory::BuildInstance() { - return scoped_ptr(new GCMClientMock(gcm_client_loading_delay_)); + return scoped_ptr(new GCMClientMock(gcm_client_start_mode_)); } } // namespace gcm diff --git a/chrome/browser/services/gcm/fake_gcm_client_factory.h b/chrome/browser/services/gcm/fake_gcm_client_factory.h index ba6c74a12de4..11fdf6595827 100644 --- a/chrome/browser/services/gcm/fake_gcm_client_factory.h +++ b/chrome/browser/services/gcm/fake_gcm_client_factory.h @@ -16,15 +16,14 @@ class GCMClient; class FakeGCMClientFactory : public GCMClientFactory { public: - explicit FakeGCMClientFactory( - GCMClientMock::LoadingDelay gcm_client_loading_delay); + explicit FakeGCMClientFactory(GCMClientMock::StartMode gcm_client_start_mode); virtual ~FakeGCMClientFactory(); // GCMClientFactory: virtual scoped_ptr BuildInstance() OVERRIDE; private: - GCMClientMock::LoadingDelay gcm_client_loading_delay_; + GCMClientMock::StartMode gcm_client_start_mode_; DISALLOW_COPY_AND_ASSIGN(FakeGCMClientFactory); }; diff --git a/chrome/browser/services/gcm/gcm_client_mock.cc b/chrome/browser/services/gcm/gcm_client_mock.cc index b894efaa70c8..96c8ffe05f4f 100644 --- a/chrome/browser/services/gcm/gcm_client_mock.cc +++ b/chrome/browser/services/gcm/gcm_client_mock.cc @@ -13,10 +13,10 @@ namespace gcm { -GCMClientMock::GCMClientMock(LoadingDelay loading_delay) +GCMClientMock::GCMClientMock(StartMode start_mode) : delegate_(NULL), status_(UNINITIALIZED), - loading_delay_(loading_delay), + start_mode_(start_mode), weak_ptr_factory_(this) { } @@ -34,17 +34,17 @@ void GCMClientMock::Initialize( delegate_ = delegate; } -void GCMClientMock::Load() { +void GCMClientMock::Start() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - DCHECK_NE(LOADED, status_); + DCHECK_NE(STARTED, status_); - if (loading_delay_ == DELAY_LOADING) + if (start_mode_ == DELAY_START) return; DoLoading(); } void GCMClientMock::DoLoading() { - status_ = LOADED; + status_ = STARTED; base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&GCMClientMock::CheckinFinished, diff --git a/chrome/browser/services/gcm/gcm_client_mock.h b/chrome/browser/services/gcm/gcm_client_mock.h index ce080cead34b..b6e8dd9e79b1 100644 --- a/chrome/browser/services/gcm/gcm_client_mock.h +++ b/chrome/browser/services/gcm/gcm_client_mock.h @@ -15,18 +15,17 @@ class GCMClientMock : public GCMClient { public: enum Status { UNINITIALIZED, - LOADED, + STARTED, STOPPED, CHECKED_OUT }; - enum LoadingDelay { - NO_DELAY_LOADING, - DELAY_LOADING, + enum StartMode { + NO_DELAY_START, + DELAY_START, }; - // |loading_delay| denotes if the check-in should be delayed. - explicit GCMClientMock(LoadingDelay loading_delay); + explicit GCMClientMock(StartMode start_mode); virtual ~GCMClientMock(); // Overridden from GCMClient: @@ -39,7 +38,7 @@ class GCMClientMock : public GCMClient { const scoped_refptr& url_request_context_getter, Delegate* delegate) OVERRIDE; - virtual void Load() OVERRIDE; + virtual void Start() OVERRIDE; virtual void Stop() OVERRIDE; virtual void CheckOut() OVERRIDE; virtual void Register(const std::string& app_id, @@ -83,7 +82,7 @@ class GCMClientMock : public GCMClient { Delegate* delegate_; Status status_; - LoadingDelay loading_delay_; + StartMode start_mode_; base::WeakPtrFactory weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(GCMClientMock); diff --git a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc index 6fef486dbb9f..6ac3ceb8a943 100644 --- a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc +++ b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc @@ -96,7 +96,7 @@ void GCMProfileServiceTest::SetUp() { profile_.get(), &BuildGCMProfileService)); gcm_profile_service_->Initialize(scoped_ptr( - new FakeGCMClientFactory(GCMClientMock::NO_DELAY_LOADING))); + new FakeGCMClientFactory(GCMClientMock::NO_DELAY_START))); FakeSigninManager* signin_manager = static_cast( SigninManagerFactory::GetInstance()->GetForProfile(profile_.get())); @@ -158,7 +158,7 @@ TEST_F(GCMProfileServiceTest, RegisterUnderNeutralChannelSignal) { // GCMClient should be checked in. EXPECT_TRUE(gcm_profile_service_->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, GetGCMClient()->status()); // Registration should succeed. std::string expected_registration_id = @@ -180,7 +180,7 @@ TEST_F(GCMProfileServiceTest, SendUnderNeutralChannelSignal) { // GCMClient should be checked in. EXPECT_TRUE(gcm_profile_service_->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, GetGCMClient()->status()); // Sending should succeed. EXPECT_EQ(message.id, send_message_id_); diff --git a/chrome/browser/services/gcm/gcm_service.cc b/chrome/browser/services/gcm/gcm_service.cc index 7374f0642189..4a33e0c64bc9 100644 --- a/chrome/browser/services/gcm/gcm_service.cc +++ b/chrome/browser/services/gcm/gcm_service.cc @@ -154,7 +154,7 @@ class GCMService::IOWorker : public GCMClient::Delegate { const std::vector& account_ids, const scoped_refptr& url_request_context_getter); - void Load(const base::WeakPtr& service); + void Start(const base::WeakPtr& service); void Stop(); void CheckOut(); void Register(const std::string& app_id, @@ -304,11 +304,11 @@ void GCMService::IOWorker::OnActivityRecorded() { GetGCMStatistics(false); } -void GCMService::IOWorker::Load(const base::WeakPtr& service) { +void GCMService::IOWorker::Start(const base::WeakPtr& service) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); service_ = service; - gcm_client_->Load(); + gcm_client_->Start(); } void GCMService::IOWorker::Stop() { @@ -410,10 +410,9 @@ void GCMService::Initialize(scoped_ptr gcm_client_factory) { account_ids, GetURLRequestContextGetter())); - // Load from the GCM store and initiate the GCM check-in if the rollout signal - // indicates yes. + // Start the GCM service if the rollout signal indicates yes. if (ShouldStartAutomatically()) - EnsureLoaded(); + EnsureStarted(); identity_provider_->AddObserver(this); } @@ -421,7 +420,7 @@ void GCMService::Initialize(scoped_ptr gcm_client_factory) { void GCMService::Start() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - EnsureLoaded(); + EnsureStarted(); } void GCMService::Stop() { @@ -667,14 +666,14 @@ void GCMService::SetGCMRecording(GetGCMStatisticsCallback callback, void GCMService::OnActiveAccountLogin() { if (ShouldStartAutomatically()) - EnsureLoaded(); + EnsureStarted(); } void GCMService::OnActiveAccountLogout() { CheckOut(); } -void GCMService::EnsureLoaded() { +void GCMService::EnsureStarted() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); const std::string account_id = identity_provider_->GetActiveAccountId(); if (account_id.empty()) @@ -690,14 +689,12 @@ void GCMService::EnsureLoaded() { DCHECK(!delayed_task_controller_); delayed_task_controller_.reset(new DelayedTaskController); - // This will load the data from the gcm store and trigger the check-in if - // the persisted check-in info is not found. // Note that we need to pass weak pointer again since the existing weak // pointer in IOWorker might have been invalidated when check-out occurs. content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(&GCMService::IOWorker::Load, + base::Bind(&GCMService::IOWorker::Start, base::Unretained(io_worker_.get()), weak_ptr_factory_.GetWeakPtr())); } @@ -733,10 +730,11 @@ void GCMService::CheckOut() { GCMClient::Result GCMService::EnsureAppReady(const std::string& app_id) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - // Ensure that check-in has been done. - EnsureLoaded(); - // If the service was not started, bail out. + // Starts the service if not yet. + EnsureStarted(); + + // If the service cannot be started, bail out. if (account_id_.empty()) return GCMClient::NOT_SIGNED_IN; diff --git a/chrome/browser/services/gcm/gcm_service.h b/chrome/browser/services/gcm/gcm_service.h index 321be2ea31d1..afa9dbe64fd4 100644 --- a/chrome/browser/services/gcm/gcm_service.h +++ b/chrome/browser/services/gcm/gcm_service.h @@ -130,9 +130,9 @@ class GCMService : public IdentityProvider::Observer { typedef std::map GCMAppHandlerMap; - // Ensures that the GCMClient is loaded and the GCM check-in is done if the + // Ensures that the GCMClient is started and the GCM check-in is done if the // |identity_provider_| is able to supply an account ID. - void EnsureLoaded(); + void EnsureStarted(); // Remove cached data when GCM service is stopped. void RemoveCachedData(); diff --git a/chrome/browser/services/gcm/gcm_service_unittest.cc b/chrome/browser/services/gcm/gcm_service_unittest.cc index 530239fc68e3..9de63d3a2bb5 100644 --- a/chrome/browser/services/gcm/gcm_service_unittest.cc +++ b/chrome/browser/services/gcm/gcm_service_unittest.cc @@ -234,7 +234,7 @@ class TestGCMServiceWrapper { GCMClientMock* GetGCMClient(); void CreateService(bool start_automatically, - GCMClientMock::LoadingDelay gcm_client_loading_delay); + GCMClientMock::StartMode gcm_client_start_mode); void SignIn(const std::string& account_id); void SignOut(); @@ -313,13 +313,13 @@ GCMClientMock* TestGCMServiceWrapper::GetGCMClient() { void TestGCMServiceWrapper::CreateService( bool start_automatically, - GCMClientMock::LoadingDelay gcm_client_loading_delay) { + GCMClientMock::StartMode gcm_client_start_mode) { service_.reset(new TestGCMService( start_automatically, identity_provider_owner_.PassAs(), request_context_)); service_->Initialize(scoped_ptr( - new FakeGCMClientFactory(gcm_client_loading_delay))); + new FakeGCMClientFactory(gcm_client_start_mode))); gcm_app_handler_.reset(new FakeGCMAppHandler); service_->AddAppHandler(kTestAppID1, gcm_app_handler_.get()); @@ -445,7 +445,7 @@ void GCMServiceTest::TearDown() { TEST_F(GCMServiceTest, CreateGCMServiceBeforeSignIn) { // Create CreateGMCService first. - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); EXPECT_FALSE(wrapper_->service()->IsStarted()); // Sign in. This will kick off the check-in. @@ -458,12 +458,12 @@ TEST_F(GCMServiceTest, CreateGCMServiceAfterSignIn) { wrapper_->SignIn(kTestAccountID1); // Create GCMeService after sign-in. - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); EXPECT_TRUE(wrapper_->service()->IsStarted()); } TEST_F(GCMServiceTest, Shutdown) { - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); EXPECT_TRUE(wrapper_->ServiceHasAppHandlers()); wrapper_->service()->ShutdownService(); @@ -471,12 +471,12 @@ TEST_F(GCMServiceTest, Shutdown) { } TEST_F(GCMServiceTest, SignInAndSignOutUnderPositiveChannelSignal) { - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); // GCMClient should be loaded. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); wrapper_->SignOut(); @@ -488,7 +488,7 @@ TEST_F(GCMServiceTest, SignInAndSignOutUnderPositiveChannelSignal) { TEST_F(GCMServiceTest, SignInAndSignOutUnderNonPositiveChannelSignal) { // Non-positive channel signal will prevent GCMClient from checking in during // sign-in. - wrapper_->CreateService(false, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(false, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); // GCMClient should not be loaded. @@ -503,12 +503,12 @@ TEST_F(GCMServiceTest, SignInAndSignOutUnderNonPositiveChannelSignal) { } TEST_F(GCMServiceTest, SignOutAndThenSignIn) { - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); // GCMClient should be loaded. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); wrapper_->SignOut(); @@ -521,16 +521,16 @@ TEST_F(GCMServiceTest, SignOutAndThenSignIn) { // GCMClient should be loaded again. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); } TEST_F(GCMServiceTest, StopAndRestartGCM) { - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); // GCMClient should be loaded. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); // Stops the GCM. wrapper_->service()->Stop(); @@ -548,7 +548,7 @@ TEST_F(GCMServiceTest, StopAndRestartGCM) { // GCMClient should be loaded. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); // Stops the GCM. wrapper_->service()->Stop(); @@ -568,7 +568,7 @@ TEST_F(GCMServiceTest, StopAndRestartGCM) { } TEST_F(GCMServiceTest, RegisterWhenNotSignedIn) { - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); std::vector sender_ids; sender_ids.push_back("sender1"); @@ -581,7 +581,7 @@ TEST_F(GCMServiceTest, RegisterWhenNotSignedIn) { TEST_F(GCMServiceTest, RegisterUnderNonPositiveChannelSignal) { // Non-positive channel signal will prevent GCMClient from checking in during // sign-in. - wrapper_->CreateService(false, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(false, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); // GCMClient should not be checked in. @@ -595,7 +595,7 @@ TEST_F(GCMServiceTest, RegisterUnderNonPositiveChannelSignal) { // GCMClient should be checked in. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); // Registration should succeed. const std::string expected_registration_id = @@ -605,7 +605,7 @@ TEST_F(GCMServiceTest, RegisterUnderNonPositiveChannelSignal) { } TEST_F(GCMServiceTest, SendWhenNotSignedIn) { - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); GCMClient::OutgoingMessage message; message.id = "1"; @@ -619,7 +619,7 @@ TEST_F(GCMServiceTest, SendWhenNotSignedIn) { TEST_F(GCMServiceTest, SendUnderNonPositiveChannelSignal) { // Non-positive channel signal will prevent GCMClient from checking in during // sign-in. - wrapper_->CreateService(false, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(false, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); // GCMClient should not be checked in. @@ -634,7 +634,7 @@ TEST_F(GCMServiceTest, SendUnderNonPositiveChannelSignal) { // GCMClient should be checked in. EXPECT_TRUE(wrapper_->service()->IsGCMClientReady()); - EXPECT_EQ(GCMClientMock::LOADED, wrapper_->GetGCMClient()->status()); + EXPECT_EQ(GCMClientMock::STARTED, wrapper_->GetGCMClient()->status()); // Sending should succeed. EXPECT_EQ(message.id, wrapper_->send_message_id()); @@ -663,7 +663,7 @@ GCMServiceSingleInstanceTest::~GCMServiceSingleInstanceTest() { void GCMServiceSingleInstanceTest::SetUp() { GCMServiceTest::SetUp(); - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); wrapper_->SignIn(kTestAccountID1); } @@ -740,7 +740,7 @@ TEST_F(GCMServiceSingleInstanceTest, RegisterAgainWithDifferentSenderIDs) { TEST_F(GCMServiceSingleInstanceTest, GCMClientNotReadyBeforeRegistration) { // Make GCMClient not ready initially. wrapper_.reset(new TestGCMServiceWrapper(request_context_)); - wrapper_->CreateService(true, GCMClientMock::DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::DELAY_START); wrapper_->SignIn(kTestAccountID1); // The registration is on hold until GCMClient is ready. @@ -872,7 +872,7 @@ TEST_F(GCMServiceSingleInstanceTest, Send) { TEST_F(GCMServiceSingleInstanceTest, GCMClientNotReadyBeforeSending) { // Make GCMClient not ready initially. wrapper_.reset(new TestGCMServiceWrapper(request_context_)); - wrapper_->CreateService(true, GCMClientMock::DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::DELAY_START); wrapper_->SignIn(kTestAccountID1); // The sending is on hold until GCMClient is ready. @@ -1008,8 +1008,8 @@ void GCMServiceMultipleInstanceTest::SetUp() { wrapper2_.reset(new TestGCMServiceWrapper(request_context_)); - wrapper_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); - wrapper2_->CreateService(true, GCMClientMock::NO_DELAY_LOADING); + wrapper_->CreateService(true, GCMClientMock::NO_DELAY_START); + wrapper2_->CreateService(true, GCMClientMock::NO_DELAY_START); // Initiate check-in for each instance. wrapper_->SignIn(kTestAccountID1); diff --git a/google_apis/gcm/gcm_client.h b/google_apis/gcm/gcm_client.h index e0e31a44a344..bee154b7b8ad 100644 --- a/google_apis/gcm/gcm_client.h +++ b/google_apis/gcm/gcm_client.h @@ -185,10 +185,10 @@ class GCM_EXPORT GCMClient { url_request_context_getter, Delegate* delegate) = 0; - // Loads the data from the persistent store. This will automatically kick off - // the check-in if the check-in info is not found in the store. - // TODO(jianli): consider renaming this name to Start. - virtual void Load() = 0; + // Starts the GCM service by first loading the data from the persistent store. + // This will then kick off the check-in if the check-in info is not found in + // the store. + virtual void Start() = 0; // Stops using the GCM service. This will not erase the persisted data. virtual void Stop() = 0; diff --git a/google_apis/gcm/gcm_client_impl.cc b/google_apis/gcm/gcm_client_impl.cc index c0fd7191ec5d..ed9838c9b4e4 100644 --- a/google_apis/gcm/gcm_client_impl.cc +++ b/google_apis/gcm/gcm_client_impl.cc @@ -230,7 +230,7 @@ void GCMClientImpl::Initialize( state_ = INITIALIZED; } -void GCMClientImpl::Load() { +void GCMClientImpl::Start() { DCHECK_EQ(INITIALIZED, state_); // Once the loading is completed, the check-in will be initiated. diff --git a/google_apis/gcm/gcm_client_impl.h b/google_apis/gcm/gcm_client_impl.h index 47ef48a10209..5555ca32cd3a 100644 --- a/google_apis/gcm/gcm_client_impl.h +++ b/google_apis/gcm/gcm_client_impl.h @@ -88,7 +88,7 @@ class GCM_EXPORT GCMClientImpl const scoped_refptr& url_request_context_getter, GCMClient::Delegate* delegate) OVERRIDE; - virtual void Load() OVERRIDE; + virtual void Start() OVERRIDE; virtual void Stop() OVERRIDE; virtual void CheckOut() OVERRIDE; virtual void Register(const std::string& app_id, diff --git a/google_apis/gcm/gcm_client_impl_unittest.cc b/google_apis/gcm/gcm_client_impl_unittest.cc index 5719ff1dd3f2..010660a365e3 100644 --- a/google_apis/gcm/gcm_client_impl_unittest.cc +++ b/google_apis/gcm/gcm_client_impl_unittest.cc @@ -457,7 +457,7 @@ void GCMClientImplTest::InitializeGCMClient() { this); // Start loading and check-in. - gcm_client_->Load(); + gcm_client_->Start(); PumpLoopUntilIdle(); }