OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/sync/notifier/server_notifier_thread.h" | 5 #include "chrome/browser/sync/notifier/server_notifier_thread.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 RegisterTypes(); | 104 RegisterTypes(); |
105 RunAndDeleteClosure(callback); | 105 RunAndDeleteClosure(callback); |
106 } | 106 } |
107 | 107 |
108 void ServerNotifierThread::StartInvalidationListener() { | 108 void ServerNotifierThread::StartInvalidationListener() { |
109 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 109 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
110 | 110 |
111 StopInvalidationListener(); | 111 StopInvalidationListener(); |
112 chrome_invalidation_client_.reset(new ChromeInvalidationClient()); | 112 chrome_invalidation_client_.reset(new ChromeInvalidationClient()); |
113 | 113 |
114 // TODO(akalin): If we can figure out a unique per-session key that | 114 // TODO(akalin): Make cache_guid() part of the app name. If we do |
115 // is preserved by the server, we can use that instead of kAppName. | 115 // so and we somehow propagate it up to the server somehow, we can |
116 // What this buys us is that we then won't receive any notifications | 116 // make it so that we won't receive any notifications that were |
117 // that were generated by ourselves. | 117 // generated from our own changes. |
118 const std::string kAppName = "cc_sync_listen_notifications"; | 118 const std::string kAppName = "server_notifier_thread"; |
119 chrome_invalidation_client_->Start(kAppName, this, xmpp_client()); | 119 chrome_invalidation_client_->Start(kAppName, this, xmpp_client()); |
120 } | 120 } |
121 | 121 |
122 void ServerNotifierThread::RegisterTypesAndSignalSubscribed() { | 122 void ServerNotifierThread::RegisterTypesAndSignalSubscribed() { |
123 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 123 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
124 RegisterTypes(); | 124 RegisterTypes(); |
125 parent_message_loop_->PostTask( | 125 parent_message_loop_->PostTask( |
126 FROM_HERE, | 126 FROM_HERE, |
127 NewRunnableMethod( | 127 NewRunnableMethod( |
128 this, | 128 this, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 189 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
190 | 190 |
191 if (chrome_invalidation_client_.get()) { | 191 if (chrome_invalidation_client_.get()) { |
192 // TODO(akalin): Need to do unregisters here? | 192 // TODO(akalin): Need to do unregisters here? |
193 chrome_invalidation_client_->Stop(); | 193 chrome_invalidation_client_->Stop(); |
194 } | 194 } |
195 chrome_invalidation_client_.reset(); | 195 chrome_invalidation_client_.reset(); |
196 } | 196 } |
197 | 197 |
198 } // namespace sync_notifier | 198 } // namespace sync_notifier |
OLD | NEW |