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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 | 59 |
60 void ServerNotifierThread::SendNotification( | 60 void ServerNotifierThread::SendNotification( |
61 const OutgoingNotificationData& data) { | 61 const OutgoingNotificationData& data) { |
62 DCHECK_EQ(MessageLoop::current(), parent_message_loop_); | 62 DCHECK_EQ(MessageLoop::current(), parent_message_loop_); |
63 NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " | 63 NOTREACHED() << "Shouldn't send notifications if ServerNotifierThread is " |
64 "used"; | 64 "used"; |
65 } | 65 } |
66 | 66 |
67 void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { | 67 void ServerNotifierThread::OnInvalidate(syncable::ModelType model_type) { |
68 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 68 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
69 // TODO(akalin): This is a hack to make new sync data types work | 69 DCHECK_NE(model_type, syncable::UNSPECIFIED); |
tim (not reviewing)
2011/01/14 22:02:35
I think DCHECK_NE TOP_LEVEL_FOLDER as well wouldn'
| |
70 // with server-issued notifications. Remove this when it's not | 70 VLOG(1) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); |
71 // needed anymore. | |
72 VLOG(1) << "OnInvalidate: " << ((model_type == syncable::UNSPECIFIED) ? | |
73 "UNKNOWN" : syncable::ModelTypeToString(model_type)); | |
74 | 71 |
75 syncable::ModelTypeBitSet model_types; | 72 syncable::ModelTypeBitSet model_types; |
76 model_types[model_type] = true; | 73 model_types[model_type] = true; |
77 IncomingNotificationData notification_data; | 74 IncomingNotificationData notification_data; |
78 notification_data.service_specific_data = model_types.to_string(); | 75 notification_data.service_specific_data = model_types.to_string(); |
79 observers_->Notify(&Observer::OnIncomingNotification, notification_data); | 76 observers_->Notify(&Observer::OnIncomingNotification, notification_data); |
80 } | 77 } |
81 | 78 |
82 void ServerNotifierThread::OnInvalidateAll() { | 79 void ServerNotifierThread::OnInvalidateAll() { |
83 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 80 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 chrome_invalidation_client_->RegisterTypes(); | 126 chrome_invalidation_client_->RegisterTypes(); |
130 observers_->Notify(&Observer::OnSubscriptionStateChange, true); | 127 observers_->Notify(&Observer::OnSubscriptionStateChange, true); |
131 } | 128 } |
132 | 129 |
133 void ServerNotifierThread::StopInvalidationListener() { | 130 void ServerNotifierThread::StopInvalidationListener() { |
134 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 131 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
135 chrome_invalidation_client_.reset(); | 132 chrome_invalidation_client_.reset(); |
136 } | 133 } |
137 | 134 |
138 } // namespace sync_notifier | 135 } // namespace sync_notifier |
OLD | NEW |