Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: sync/notifier/chrome_invalidation_client.cc

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sync/notifier/chrome_invalidation_client.h" 5 #include "sync/notifier/chrome_invalidation_client.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/tracked_objects.h" 12 #include "base/tracked_objects.h"
13 #include "google/cacheinvalidation/include/invalidation-client-factory.h" 13 #include "google/cacheinvalidation/include/invalidation-client-factory.h"
14 #include "google/cacheinvalidation/include/invalidation-client.h" 14 #include "google/cacheinvalidation/include/invalidation-client.h"
15 #include "google/cacheinvalidation/include/types.h" 15 #include "google/cacheinvalidation/include/types.h"
16 #include "google/cacheinvalidation/v2/types.pb.h" 16 #include "google/cacheinvalidation/v2/types.pb.h"
17 #include "jingle/notifier/listener/push_client.h" 17 #include "jingle/notifier/listener/push_client.h"
18 #include "sync/internal_api/public/syncable/model_type.h" 18 #include "sync/internal_api/public/syncable/model_type.h"
19 #include "sync/notifier/invalidation_util.h" 19 #include "sync/notifier/invalidation_util.h"
20 #include "sync/notifier/registration_manager.h" 20 #include "sync/notifier/registration_manager.h"
21 21
22 namespace { 22 namespace {
23 23
24 const char kApplicationName[] = "chrome-sync"; 24 const char kApplicationName[] = "chrome-sync";
25 25
26 } // namespace 26 } // namespace
27 27
28 namespace csync { 28 namespace syncer {
29 29
30 ChromeInvalidationClient::Listener::~Listener() {} 30 ChromeInvalidationClient::Listener::~Listener() {}
31 31
32 ChromeInvalidationClient::ChromeInvalidationClient( 32 ChromeInvalidationClient::ChromeInvalidationClient(
33 scoped_ptr<notifier::PushClient> push_client) 33 scoped_ptr<notifier::PushClient> push_client)
34 : push_client_(push_client.get()), 34 : push_client_(push_client.get()),
35 chrome_system_resources_(push_client.Pass(), 35 chrome_system_resources_(push_client.Pass(),
36 ALLOW_THIS_IN_INITIALIZER_LIST(this)), 36 ALLOW_THIS_IN_INITIALIZER_LIST(this)),
37 listener_(NULL), 37 listener_(NULL),
38 ticl_state_(DEFAULT_NOTIFICATION_ERROR), 38 ticl_state_(DEFAULT_NOTIFICATION_ERROR),
39 push_client_state_(DEFAULT_NOTIFICATION_ERROR) { 39 push_client_state_(DEFAULT_NOTIFICATION_ERROR) {
40 DCHECK(CalledOnValidThread()); 40 DCHECK(CalledOnValidThread());
41 push_client_->AddObserver(this); 41 push_client_->AddObserver(this);
42 } 42 }
43 43
44 ChromeInvalidationClient::~ChromeInvalidationClient() { 44 ChromeInvalidationClient::~ChromeInvalidationClient() {
45 DCHECK(CalledOnValidThread()); 45 DCHECK(CalledOnValidThread());
46 push_client_->RemoveObserver(this); 46 push_client_->RemoveObserver(this);
47 Stop(); 47 Stop();
48 DCHECK(!listener_); 48 DCHECK(!listener_);
49 } 49 }
50 50
51 void ChromeInvalidationClient::Start( 51 void ChromeInvalidationClient::Start(
52 const std::string& client_id, const std::string& client_info, 52 const std::string& client_id, const std::string& client_info,
53 const std::string& state, 53 const std::string& state,
54 const InvalidationVersionMap& initial_max_invalidation_versions, 54 const InvalidationVersionMap& initial_max_invalidation_versions,
55 const csync::WeakHandle<InvalidationStateTracker>& 55 const syncer::WeakHandle<InvalidationStateTracker>&
56 invalidation_state_tracker, 56 invalidation_state_tracker,
57 Listener* listener) { 57 Listener* listener) {
58 DCHECK(CalledOnValidThread()); 58 DCHECK(CalledOnValidThread());
59 Stop(); 59 Stop();
60 60
61 chrome_system_resources_.set_platform(client_info); 61 chrome_system_resources_.set_platform(client_info);
62 chrome_system_resources_.Start(); 62 chrome_system_resources_.Start();
63 63
64 // The Storage resource is implemented as a write-through cache. We populate 64 // The Storage resource is implemented as a write-through cache. We populate
65 // it with the initial state on startup, so subsequent writes go to disk and 65 // it with the initial state on startup, so subsequent writes go to disk and
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 push_client_state_ = FromNotifierReason(reason); 352 push_client_state_ = FromNotifierReason(reason);
353 EmitStateChange(); 353 EmitStateChange();
354 } 354 }
355 355
356 void ChromeInvalidationClient::OnIncomingNotification( 356 void ChromeInvalidationClient::OnIncomingNotification(
357 const notifier::Notification& notification) { 357 const notifier::Notification& notification) {
358 DCHECK(CalledOnValidThread()); 358 DCHECK(CalledOnValidThread());
359 // Do nothing, since this is already handled by |invalidation_client_|. 359 // Do nothing, since this is already handled by |invalidation_client_|.
360 } 360 }
361 361
362 } // namespace csync 362 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/notifier/chrome_invalidation_client.h ('k') | sync/notifier/chrome_invalidation_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698