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

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

Issue 10436013: [Sync] Make InvalidationNotifier use PushClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 7 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
« no previous file with comments | « sync/notifier/invalidation_notifier_unittest.cc ('k') | sync/notifier/push_client_channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/non_blocking_invalidation_notifier.h" 5 #include "sync/notifier/non_blocking_invalidation_notifier.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "jingle/notifier/listener/push_client.h"
11 #include "sync/notifier/invalidation_notifier.h" 12 #include "sync/notifier/invalidation_notifier.h"
12 13
13 namespace sync_notifier { 14 namespace sync_notifier {
14 15
15 class NonBlockingInvalidationNotifier::Core 16 class NonBlockingInvalidationNotifier::Core
16 : public base::RefCountedThreadSafe<NonBlockingInvalidationNotifier::Core>, 17 : public base::RefCountedThreadSafe<NonBlockingInvalidationNotifier::Core>,
17 public SyncNotifierObserver { 18 public SyncNotifierObserver {
18 public: 19 public:
19 // Called on parent thread. |delegate_observer| should be 20 // Called on parent thread. |delegate_observer| should be
20 // initialized. 21 // initialized.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 invalidation_state_tracker, 74 invalidation_state_tracker,
74 const std::string& client_info) { 75 const std::string& client_info) {
75 DCHECK(notifier_options.request_context_getter); 76 DCHECK(notifier_options.request_context_getter);
76 DCHECK_EQ(notifier::NOTIFICATION_SERVER, 77 DCHECK_EQ(notifier::NOTIFICATION_SERVER,
77 notifier_options.notification_method); 78 notifier_options.notification_method);
78 io_message_loop_proxy_ = notifier_options.request_context_getter-> 79 io_message_loop_proxy_ = notifier_options.request_context_getter->
79 GetIOMessageLoopProxy(); 80 GetIOMessageLoopProxy();
80 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); 81 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
81 invalidation_notifier_.reset( 82 invalidation_notifier_.reset(
82 new InvalidationNotifier( 83 new InvalidationNotifier(
83 notifier_options, 84 notifier::PushClient::CreateDefaultOnIOThread(notifier_options),
84 initial_max_invalidation_versions, 85 initial_max_invalidation_versions,
85 invalidation_state_tracker, 86 invalidation_state_tracker,
86 client_info)); 87 client_info));
87 invalidation_notifier_->AddObserver(this); 88 invalidation_notifier_->AddObserver(this);
88 } 89 }
89 90
90 91
91 void NonBlockingInvalidationNotifier::Core::Teardown() { 92 void NonBlockingInvalidationNotifier::Core::Teardown() {
92 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); 93 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
93 invalidation_notifier_->RemoveObserver(this); 94 invalidation_notifier_->RemoveObserver(this);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 260 }
260 261
261 void NonBlockingInvalidationNotifier::StoreState( 262 void NonBlockingInvalidationNotifier::StoreState(
262 const std::string& state) { 263 const std::string& state) {
263 DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread()); 264 DCHECK(parent_message_loop_proxy_->BelongsToCurrentThread());
264 FOR_EACH_OBSERVER(SyncNotifierObserver, observers_, 265 FOR_EACH_OBSERVER(SyncNotifierObserver, observers_,
265 StoreState(state)); 266 StoreState(state));
266 } 267 }
267 268
268 } // namespace sync_notifier 269 } // namespace sync_notifier
OLDNEW
« no previous file with comments | « sync/notifier/invalidation_notifier_unittest.cc ('k') | sync/notifier/push_client_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698