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_GE(model_type, syncable::FIRST_REAL_MODEL_TYPE); |
70 // with server-issued notifications. Remove this when it's not | 70 DCHECK_LT(model_type, syncable::MODEL_TYPE_COUNT); |
71 // needed anymore. | 71 VLOG(1) << "OnInvalidate: " << syncable::ModelTypeToString(model_type); |
72 VLOG(1) << "OnInvalidate: " << ((model_type == syncable::UNSPECIFIED) ? | |
73 "UNKNOWN" : syncable::ModelTypeToString(model_type)); | |
74 | 72 |
75 syncable::ModelTypeBitSet model_types; | 73 syncable::ModelTypeBitSet model_types; |
76 model_types[model_type] = true; | 74 model_types[model_type] = true; |
77 IncomingNotificationData notification_data; | 75 IncomingNotificationData notification_data; |
78 notification_data.service_specific_data = model_types.to_string(); | 76 notification_data.service_specific_data = model_types.to_string(); |
79 observers_->Notify(&Observer::OnIncomingNotification, notification_data); | 77 observers_->Notify(&Observer::OnIncomingNotification, notification_data); |
80 } | 78 } |
81 | 79 |
82 void ServerNotifierThread::OnInvalidateAll() { | 80 void ServerNotifierThread::OnInvalidateAll() { |
83 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 81 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(); | 127 chrome_invalidation_client_->RegisterTypes(); |
130 observers_->Notify(&Observer::OnSubscriptionStateChange, true); | 128 observers_->Notify(&Observer::OnSubscriptionStateChange, true); |
131 } | 129 } |
132 | 130 |
133 void ServerNotifierThread::StopInvalidationListener() { | 131 void ServerNotifierThread::StopInvalidationListener() { |
134 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); | 132 DCHECK_EQ(MessageLoop::current(), worker_message_loop()); |
135 chrome_invalidation_client_.reset(); | 133 chrome_invalidation_client_.reset(); |
136 } | 134 } |
137 | 135 |
138 } // namespace sync_notifier | 136 } // namespace sync_notifier |
OLD | NEW |