| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 RegisterTypes(); | 103 RegisterTypes(); |
| 104 RunAndDeleteClosure(callback); | 104 RunAndDeleteClosure(callback); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ServerNotifierThread::StartInvalidationListener() { | 107 void ServerNotifierThread::StartInvalidationListener() { |
| 108 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 108 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
| 109 | 109 |
| 110 StopInvalidationListener(); | 110 StopInvalidationListener(); |
| 111 chrome_invalidation_client_.reset(new ChromeInvalidationClient()); | 111 chrome_invalidation_client_.reset(new ChromeInvalidationClient()); |
| 112 | 112 |
| 113 // TODO(akalin): Make cache_guid() part of the app name. If we do | 113 // TODO(akalin): Make cache_guid() part of the client ID. If we do |
| 114 // so and we somehow propagate it up to the server somehow, we can | 114 // so and we somehow propagate it up to the server somehow, we can |
| 115 // make it so that we won't receive any notifications that were | 115 // make it so that we won't receive any notifications that were |
| 116 // generated from our own changes. | 116 // generated from our own changes. |
| 117 const std::string kAppName = "server_notifier_thread"; | 117 const std::string kClientId = "server_notifier_thread"; |
| 118 chrome_invalidation_client_->Start(kAppName, this, xmpp_client()); | 118 chrome_invalidation_client_->Start(kClientId, this, xmpp_client()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ServerNotifierThread::RegisterTypesAndSignalSubscribed() { | 121 void ServerNotifierThread::RegisterTypesAndSignalSubscribed() { |
| 122 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 122 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
| 123 RegisterTypes(); | 123 RegisterTypes(); |
| 124 parent_message_loop_->PostTask( | 124 parent_message_loop_->PostTask( |
| 125 FROM_HERE, | 125 FROM_HERE, |
| 126 NewRunnableMethod( | 126 NewRunnableMethod( |
| 127 this, | 127 this, |
| 128 &ServerNotifierThread::SignalSubscribed)); | 128 &ServerNotifierThread::SignalSubscribed)); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 180 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
| 181 | 181 |
| 182 if (chrome_invalidation_client_.get()) { | 182 if (chrome_invalidation_client_.get()) { |
| 183 // TODO(akalin): Need to do unregisters here? | 183 // TODO(akalin): Need to do unregisters here? |
| 184 chrome_invalidation_client_->Stop(); | 184 chrome_invalidation_client_->Stop(); |
| 185 } | 185 } |
| 186 chrome_invalidation_client_.reset(); | 186 chrome_invalidation_client_.reset(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace sync_notifier | 189 } // namespace sync_notifier |
| OLD | NEW |