Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 23754021: Invalidation trickles mega-patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/glue/sync_backend_host.h" 5 #include "chrome/browser/sync/glue/sync_backend_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "base/tracked_objects.h" 20 #include "base/tracked_objects.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "chrome/browser/invalidation/invalidation_service.h" 22 #include "chrome/browser/invalidation/invalidation_service.h"
23 #include "chrome/browser/chrome_notification_types.h"
23 #include "chrome/browser/invalidation/invalidation_service_factory.h" 24 #include "chrome/browser/invalidation/invalidation_service_factory.h"
24 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/net/network_time_tracker.h" 25 #include "chrome/browser/net/network_time_tracker.h"
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/signin/token_service.h" 27 #include "chrome/browser/signin/token_service.h"
28 #include "chrome/browser/signin/token_service_factory.h" 28 #include "chrome/browser/signin/token_service_factory.h"
29 #include "chrome/browser/sync/glue/change_processor.h" 29 #include "chrome/browser/sync/glue/change_processor.h"
30 #include "chrome/browser/sync/glue/chrome_encryptor.h" 30 #include "chrome/browser/sync/glue/chrome_encryptor.h"
31 #include "chrome/browser/sync/glue/device_info.h" 31 #include "chrome/browser/sync/glue/device_info.h"
32 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 32 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
33 #include "chrome/browser/sync/glue/synced_device_tracker.h" 33 #include "chrome/browser/sync/glue/synced_device_tracker.h"
34 #include "chrome/browser/sync/sync_prefs.h" 34 #include "chrome/browser/sync/sync_prefs.h"
(...skipping 10 matching lines...) Expand all
45 #include "net/base/host_port_pair.h" 45 #include "net/base/host_port_pair.h"
46 #include "net/url_request/url_request_context_getter.h" 46 #include "net/url_request/url_request_context_getter.h"
47 #include "sync/internal_api/public/base_transaction.h" 47 #include "sync/internal_api/public/base_transaction.h"
48 #include "sync/internal_api/public/engine/model_safe_worker.h" 48 #include "sync/internal_api/public/engine/model_safe_worker.h"
49 #include "sync/internal_api/public/http_bridge.h" 49 #include "sync/internal_api/public/http_bridge.h"
50 #include "sync/internal_api/public/internal_components_factory_impl.h" 50 #include "sync/internal_api/public/internal_components_factory_impl.h"
51 #include "sync/internal_api/public/read_transaction.h" 51 #include "sync/internal_api/public/read_transaction.h"
52 #include "sync/internal_api/public/sync_manager_factory.h" 52 #include "sync/internal_api/public/sync_manager_factory.h"
53 #include "sync/internal_api/public/util/experiments.h" 53 #include "sync/internal_api/public/util/experiments.h"
54 #include "sync/internal_api/public/util/sync_string_conversions.h" 54 #include "sync/internal_api/public/util/sync_string_conversions.h"
55 #include "sync/notifier/object_id_invalidation_map.h"
55 #include "sync/protocol/encryption.pb.h" 56 #include "sync/protocol/encryption.pb.h"
56 #include "sync/protocol/sync.pb.h" 57 #include "sync/protocol/sync.pb.h"
57 #include "sync/util/nigori.h" 58 #include "sync/util/nigori.h"
58 59
59 static const int kSaveChangesIntervalSeconds = 10; 60 static const int kSaveChangesIntervalSeconds = 10;
60 static const base::FilePath::CharType kSyncDataFolderName[] = 61 static const base::FilePath::CharType kSyncDataFolderName[] =
61 FILE_PATH_LITERAL("Sync Data"); 62 FILE_PATH_LITERAL("Sync Data");
62 63
63 typedef TokenService::TokenAvailableDetails TokenAvailableDetails; 64 typedef TokenService::TokenAvailableDetails TokenAvailableDetails;
64 65
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 void SyncBackendHost::OnInvalidatorStateChange(syncer::InvalidatorState state) { 1488 void SyncBackendHost::OnInvalidatorStateChange(syncer::InvalidatorState state) {
1488 registrar_->sync_thread()->message_loop()->PostTask( 1489 registrar_->sync_thread()->message_loop()->PostTask(
1489 FROM_HERE, 1490 FROM_HERE,
1490 base::Bind(&SyncBackendHost::Core::DoOnInvalidatorStateChange, 1491 base::Bind(&SyncBackendHost::Core::DoOnInvalidatorStateChange,
1491 core_.get(), 1492 core_.get(),
1492 state)); 1493 state));
1493 } 1494 }
1494 1495
1495 void SyncBackendHost::OnIncomingInvalidation( 1496 void SyncBackendHost::OnIncomingInvalidation(
1496 const syncer::ObjectIdInvalidationMap& invalidation_map) { 1497 const syncer::ObjectIdInvalidationMap& invalidation_map) {
1497 // TODO(dcheng): Acknowledge immediately for now. Fix this once the 1498 // TODO(rlarocque): Acknowledge these invalidations only after the syncer has
1498 // invalidator doesn't repeatedly ping for unacknowledged invaliations, since 1499 // acted on them and saved the results to disk.
1499 // it conflicts with the sync scheduler's internal backoff algorithm. 1500 invalidation_map.AcknowledgeAll();
1500 // See http://crbug.com/124149 for more information.
1501 for (syncer::ObjectIdInvalidationMap::const_iterator it =
1502 invalidation_map.begin(); it != invalidation_map.end(); ++it) {
1503 invalidator_->AcknowledgeInvalidation(it->first, it->second.ack_handle);
1504 }
1505
1506 registrar_->sync_thread()->message_loop()->PostTask( 1501 registrar_->sync_thread()->message_loop()->PostTask(
1507 FROM_HERE, 1502 FROM_HERE,
1508 base::Bind(&SyncBackendHost::Core::DoOnIncomingInvalidation, 1503 base::Bind(&SyncBackendHost::Core::DoOnIncomingInvalidation,
1509 core_.get(), 1504 core_.get(),
1510 invalidation_map)); 1505 invalidation_map));
1511 } 1506 }
1512 1507
1513 bool SyncBackendHost::CheckPassphraseAgainstCachedPendingKeys( 1508 bool SyncBackendHost::CheckPassphraseAgainstCachedPendingKeys(
1514 const std::string& passphrase) const { 1509 const std::string& passphrase) const {
1515 DCHECK(cached_pending_keys_.has_blob()); 1510 DCHECK(cached_pending_keys_.has_blob());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 1600
1606 base::MessageLoop* SyncBackendHost::GetSyncLoopForTesting() { 1601 base::MessageLoop* SyncBackendHost::GetSyncLoopForTesting() {
1607 return registrar_->sync_thread()->message_loop(); 1602 return registrar_->sync_thread()->message_loop();
1608 } 1603 }
1609 1604
1610 #undef SDVLOG 1605 #undef SDVLOG
1611 1606
1612 #undef SLOG 1607 #undef SLOG
1613 1608
1614 } // namespace browser_sync 1609 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/glue/sync_backend_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698