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/chrome_invalidation_client.h" | 5 #include "chrome/browser/sync/notifier/chrome_invalidation_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 } | 31 } |
32 | 32 |
33 ChromeInvalidationClient::~ChromeInvalidationClient() { | 33 ChromeInvalidationClient::~ChromeInvalidationClient() { |
34 DCHECK(non_thread_safe_.CalledOnValidThread()); | 34 DCHECK(non_thread_safe_.CalledOnValidThread()); |
35 Stop(); | 35 Stop(); |
36 DCHECK(!listener_); | 36 DCHECK(!listener_); |
37 DCHECK(!state_writer_); | 37 DCHECK(!state_writer_); |
38 } | 38 } |
39 | 39 |
40 void ChromeInvalidationClient::Start( | 40 void ChromeInvalidationClient::Start( |
41 const std::string& client_id, const std::string& state, | 41 const std::string& client_id, const std::string& client_info, |
42 Listener* listener, StateWriter* state_writer, | 42 const std::string& state, Listener* listener, |
43 base::WeakPtr<talk_base::Task> base_task) { | 43 StateWriter* state_writer, base::WeakPtr<talk_base::Task> base_task) { |
44 DCHECK(non_thread_safe_.CalledOnValidThread()); | 44 DCHECK(non_thread_safe_.CalledOnValidThread()); |
45 Stop(); | 45 Stop(); |
46 | 46 |
47 chrome_system_resources_.StartScheduler(); | 47 chrome_system_resources_.StartScheduler(); |
48 | 48 |
49 DCHECK(!listener_); | 49 DCHECK(!listener_); |
50 DCHECK(listener); | 50 DCHECK(listener); |
51 listener_ = listener; | 51 listener_ = listener; |
52 DCHECK(!state_writer_); | 52 DCHECK(!state_writer_); |
53 DCHECK(state_writer); | 53 DCHECK(state_writer); |
54 state_writer_ = state_writer; | 54 state_writer_ = state_writer; |
55 | 55 |
56 invalidation::ClientType client_type; | 56 invalidation::ClientType client_type; |
57 client_type.set_type(invalidation::ClientType::CHROME_SYNC); | 57 client_type.set_type(invalidation::ClientType::CHROME_SYNC); |
58 // TODO(akalin): Use InvalidationClient::Create() once it supports | 58 // TODO(akalin): Use InvalidationClient::Create() once it supports |
59 // taking a ClientConfig. | 59 // taking a ClientConfig. |
60 invalidation::ClientConfig client_config; | 60 invalidation::ClientConfig client_config; |
61 // Bump up limits so that we reduce the number of registration | 61 // Bump up limits so that we reduce the number of registration |
62 // replies we get. | 62 // replies we get. |
63 client_config.max_registrations_per_message = 20; | 63 client_config.max_registrations_per_message = 20; |
64 client_config.max_ops_per_message = 40; | 64 client_config.max_ops_per_message = 40; |
65 invalidation_client_.reset( | 65 invalidation_client_.reset( |
66 new invalidation::InvalidationClientImpl( | 66 new invalidation::InvalidationClientImpl( |
67 &chrome_system_resources_, client_type, client_id, client_config, | 67 &chrome_system_resources_, client_type, client_id, |
68 this)); | 68 client_info, client_config, this)); |
ghc
2011/01/24 23:09:34
client_info should fit on the previous line, no?
akalin
2011/01/24 23:17:17
Done.
| |
69 invalidation_client_->Start(state); | 69 invalidation_client_->Start(state); |
70 invalidation::NetworkEndpoint* network_endpoint = | 70 invalidation::NetworkEndpoint* network_endpoint = |
71 invalidation_client_->network_endpoint(); | 71 invalidation_client_->network_endpoint(); |
72 CHECK(network_endpoint); | 72 CHECK(network_endpoint); |
73 network_endpoint->RegisterOutboundListener( | 73 network_endpoint->RegisterOutboundListener( |
74 handle_outbound_packet_callback_.get()); | 74 handle_outbound_packet_callback_.get()); |
75 ChangeBaseTask(base_task); | 75 ChangeBaseTask(base_task); |
76 registration_manager_.reset( | 76 registration_manager_.reset( |
77 new RegistrationManager(invalidation_client_.get())); | 77 new RegistrationManager(invalidation_client_.get())); |
78 RegisterTypes(); | 78 RegisterTypes(); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 | 209 |
210 void ChromeInvalidationClient::HandleOutboundPacket( | 210 void ChromeInvalidationClient::HandleOutboundPacket( |
211 invalidation::NetworkEndpoint* const& network_endpoint) { | 211 invalidation::NetworkEndpoint* const& network_endpoint) { |
212 DCHECK(non_thread_safe_.CalledOnValidThread()); | 212 DCHECK(non_thread_safe_.CalledOnValidThread()); |
213 CHECK(cache_invalidation_packet_handler_.get()); | 213 CHECK(cache_invalidation_packet_handler_.get()); |
214 cache_invalidation_packet_handler_-> | 214 cache_invalidation_packet_handler_-> |
215 HandleOutboundPacket(network_endpoint); | 215 HandleOutboundPacket(network_endpoint); |
216 } | 216 } |
217 | 217 |
218 } // namespace sync_notifier | 218 } // namespace sync_notifier |
OLD | NEW |