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

Side by Side Diff: chrome/browser/sync/internal_api/sync_manager.cc

Issue 7745040: [Sync] Make P2PNotifier behave more like InvalidationNotifier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/internal_api/sync_manager.h" 5 #include "chrome/browser/sync/internal_api/sync_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/browser/sync/js/js_event_handler.h" 31 #include "chrome/browser/sync/js/js_event_handler.h"
32 #include "chrome/browser/sync/js/js_reply_handler.h" 32 #include "chrome/browser/sync/js/js_reply_handler.h"
33 #include "chrome/browser/sync/js/js_sync_manager_observer.h" 33 #include "chrome/browser/sync/js/js_sync_manager_observer.h"
34 #include "chrome/browser/sync/js/js_transaction_observer.h" 34 #include "chrome/browser/sync/js/js_transaction_observer.h"
35 #include "chrome/browser/sync/notifier/sync_notifier.h" 35 #include "chrome/browser/sync/notifier/sync_notifier.h"
36 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" 36 #include "chrome/browser/sync/notifier/sync_notifier_observer.h"
37 #include "chrome/browser/sync/protocol/proto_value_conversions.h" 37 #include "chrome/browser/sync/protocol/proto_value_conversions.h"
38 #include "chrome/browser/sync/syncable/directory_change_delegate.h" 38 #include "chrome/browser/sync/syncable/directory_change_delegate.h"
39 #include "chrome/browser/sync/syncable/directory_manager.h" 39 #include "chrome/browser/sync/syncable/directory_manager.h"
40 #include "chrome/browser/sync/syncable/model_type.h" 40 #include "chrome/browser/sync/syncable/model_type.h"
41 #include "chrome/browser/sync/syncable/model_type_payload_map.h"
41 #include "chrome/browser/sync/syncable/syncable.h" 42 #include "chrome/browser/sync/syncable/syncable.h"
42 #include "chrome/browser/sync/util/cryptographer.h" 43 #include "chrome/browser/sync/util/cryptographer.h"
43 #include "chrome/browser/sync/weak_handle.h" 44 #include "chrome/browser/sync/weak_handle.h"
44 #include "net/base/network_change_notifier.h" 45 #include "net/base/network_change_notifier.h"
45 46
46 using std::string; 47 using std::string;
47 using std::vector; 48 using std::vector;
48 49
49 using base::TimeDelta; 50 using base::TimeDelta;
50 using browser_sync::AllStatus; 51 using browser_sync::AllStatus;
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 1592
1592 // This is here for tests, which are still using p2p notifications. 1593 // This is here for tests, which are still using p2p notifications.
1593 // 1594 //
1594 // TODO(chron): Consider changing this back to track has_more_to_sync 1595 // TODO(chron): Consider changing this back to track has_more_to_sync
1595 // only notify peers if a successful commit has occurred. 1596 // only notify peers if a successful commit has occurred.
1596 bool is_notifiable_commit = 1597 bool is_notifiable_commit =
1597 (event.snapshot->syncer_status.num_successful_commits > 0); 1598 (event.snapshot->syncer_status.num_successful_commits > 0);
1598 if (is_notifiable_commit) { 1599 if (is_notifiable_commit) {
1599 allstatus_.IncrementNotifiableCommits(); 1600 allstatus_.IncrementNotifiableCommits();
1600 if (sync_notifier_.get()) { 1601 if (sync_notifier_.get()) {
1601 sync_notifier_->SendNotification(); 1602 const syncable::ModelTypeSet& changed_types =
1603 syncable::ModelTypePayloadMapToSet(event.snapshot->source.types);
1604 sync_notifier_->SendNotification(changed_types);
1602 } else { 1605 } else {
1603 VLOG(1) << "Not sending notification: sync_notifier_ is NULL"; 1606 VLOG(1) << "Not sending notification: sync_notifier_ is NULL";
1604 } 1607 }
1605 } 1608 }
1606 } 1609 }
1607 1610
1608 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) { 1611 if (event.what_happened == SyncEngineEvent::STOP_SYNCING_PERMANENTLY) {
1609 ObserverList<SyncManager::Observer> temp_obs_list; 1612 ObserverList<SyncManager::Observer> temp_obs_list;
1610 CopyObservers(&temp_obs_list); 1613 CopyObservers(&temp_obs_list);
1611 FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list, 1614 FOR_EACH_OBSERVER(SyncManager::Observer, temp_obs_list,
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2054 2057
2055 for (syncable::ModelTypeSet::const_iterator i = types.begin(); 2058 for (syncable::ModelTypeSet::const_iterator i = types.begin();
2056 i != types.end(); ++i) { 2059 i != types.end(); ++i) {
2057 if (!lookup->initial_sync_ended_for_type(*i)) 2060 if (!lookup->initial_sync_ended_for_type(*i))
2058 return false; 2061 return false;
2059 } 2062 }
2060 return true; 2063 return true;
2061 } 2064 }
2062 2065
2063 } // namespace sync_api 2066 } // namespace sync_api
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698