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

Side by Side Diff: chrome/browser/sync/engine/verify_updates_command.cc

Issue 8637006: [Sync] Make syncer commands avoid posting tasks on threads with no work to do (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head, fix windows compile Created 9 years 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/engine/verify_updates_command.h" 5 #include "chrome/browser/sync/engine/verify_updates_command.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "chrome/browser/sync/engine/syncer.h" 10 #include "chrome/browser/sync/engine/syncer.h"
11 #include "chrome/browser/sync/engine/syncer_proto_util.h" 11 #include "chrome/browser/sync/engine/syncer_proto_util.h"
12 #include "chrome/browser/sync/engine/syncer_types.h" 12 #include "chrome/browser/sync/engine/syncer_types.h"
13 #include "chrome/browser/sync/engine/syncer_util.h" 13 #include "chrome/browser/sync/engine/syncer_util.h"
14 #include "chrome/browser/sync/engine/syncproto.h" 14 #include "chrome/browser/sync/engine/syncproto.h"
15 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 15 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
16 #include "chrome/browser/sync/syncable/directory_manager.h" 16 #include "chrome/browser/sync/syncable/directory_manager.h"
17 #include "chrome/browser/sync/syncable/syncable.h" 17 #include "chrome/browser/sync/syncable/syncable.h"
18 18
19 namespace browser_sync { 19 namespace browser_sync {
20 20
21 using syncable::ScopedDirLookup; 21 using syncable::ScopedDirLookup;
22 using syncable::WriteTransaction; 22 using syncable::WriteTransaction;
23 23
24 using syncable::GET_BY_ID; 24 using syncable::GET_BY_ID;
25 using syncable::SYNCER; 25 using syncable::SYNCER;
26 26
27 VerifyUpdatesCommand::VerifyUpdatesCommand() {} 27 VerifyUpdatesCommand::VerifyUpdatesCommand() {}
28 VerifyUpdatesCommand::~VerifyUpdatesCommand() {} 28 VerifyUpdatesCommand::~VerifyUpdatesCommand() {}
29 29
30 bool VerifyUpdatesCommand::HasCustomGroupsToChange() const {
31 // TODO(akalin): Set to true.
32 return false;
33 }
34
35 std::set<ModelSafeGroup> VerifyUpdatesCommand::GetGroupsToChange(
36 const sessions::SyncSession& session) const {
37 std::set<ModelSafeGroup> groups_with_updates;
38
39 const GetUpdatesResponse& updates =
40 session.status_controller().updates_response().get_updates();
41 for (int i = 0; i < updates.entries().size(); i++) {
42 groups_with_updates.insert(
43 GetGroupForModelType(syncable::GetModelType(updates.entries(i)),
44 session.routing_info()));
45 }
46
47 return groups_with_updates;
48 }
49
30 void VerifyUpdatesCommand::ModelChangingExecuteImpl( 50 void VerifyUpdatesCommand::ModelChangingExecuteImpl(
31 sessions::SyncSession* session) { 51 sessions::SyncSession* session) {
32 DVLOG(1) << "Beginning Update Verification"; 52 DVLOG(1) << "Beginning Update Verification";
33 ScopedDirLookup dir(session->context()->directory_manager(), 53 ScopedDirLookup dir(session->context()->directory_manager(),
34 session->context()->account_name()); 54 session->context()->account_name());
35 if (!dir.good()) { 55 if (!dir.good()) {
36 LOG(ERROR) << "Scoped dir lookup failed!"; 56 LOG(ERROR) << "Scoped dir lookup failed!";
37 return; 57 return;
38 } 58 }
39 WriteTransaction trans(FROM_HERE, SYNCER, dir); 59 WriteTransaction trans(FROM_HERE, SYNCER, dir);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 deleted, is_directory, model_type); 140 deleted, is_directory, model_type);
121 } 141 }
122 142
123 if (VERIFY_UNDECIDED == result.value) 143 if (VERIFY_UNDECIDED == result.value)
124 result.value = VERIFY_SUCCESS; // No news is good news. 144 result.value = VERIFY_SUCCESS; // No news is good news.
125 145
126 return result; // This might be VERIFY_SUCCESS as well 146 return result; // This might be VERIFY_SUCCESS as well
127 } 147 }
128 148
129 } // namespace browser_sync 149 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/verify_updates_command.h ('k') | chrome/browser/sync/engine/verify_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698