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

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

Issue 8785015: Revert 112815 - [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: 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/process_commit_response_command.h" 5 #include "chrome/browser/sync/engine/process_commit_response_command.h"
6 6
7 #include <cstddef>
8 #include <set> 7 #include <set>
9 #include <string> 8 #include <string>
10 #include <vector> 9 #include <vector>
11 10
12 #include "base/basictypes.h" 11 #include "base/basictypes.h"
13 #include "base/location.h" 12 #include "base/location.h"
14 #include "chrome/browser/sync/engine/syncer_proto_util.h" 13 #include "chrome/browser/sync/engine/syncer_proto_util.h"
15 #include "chrome/browser/sync/engine/syncer_util.h" 14 #include "chrome/browser/sync/engine/syncer_util.h"
16 #include "chrome/browser/sync/engine/syncproto.h" 15 #include "chrome/browser/sync/engine/syncproto.h"
17 #include "chrome/browser/sync/sessions/sync_session.h" 16 #include "chrome/browser/sync/sessions/sync_session.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void IncrementErrorCounters(StatusController* status) { 52 void IncrementErrorCounters(StatusController* status) {
54 status->increment_num_consecutive_errors(); 53 status->increment_num_consecutive_errors();
55 } 54 }
56 void ResetErrorCounters(StatusController* status) { 55 void ResetErrorCounters(StatusController* status) {
57 status->set_num_consecutive_errors(0); 56 status->set_num_consecutive_errors(0);
58 } 57 }
59 58
60 ProcessCommitResponseCommand::ProcessCommitResponseCommand() {} 59 ProcessCommitResponseCommand::ProcessCommitResponseCommand() {}
61 ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {} 60 ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {}
62 61
63 std::set<ModelSafeGroup> ProcessCommitResponseCommand::GetGroupsToChange(
64 const sessions::SyncSession& session) const {
65 std::set<ModelSafeGroup> groups_with_commits;
66 syncable::ScopedDirLookup dir(session.context()->directory_manager(),
67 session.context()->account_name());
68 if (!dir.good()) {
69 LOG(ERROR) << "Scoped dir lookup failed!";
70 return groups_with_commits;
71 }
72
73 syncable::ReadTransaction trans(FROM_HERE, dir);
74 const StatusController& status = session.status_controller();
75 for (size_t i = 0; i < status.commit_ids().size(); ++i) {
76 groups_with_commits.insert(
77 GetGroupForModelType(status.GetUnrestrictedCommitModelTypeAt(i),
78 session.routing_info()));
79 }
80
81 return groups_with_commits;
82 }
83
84 bool ProcessCommitResponseCommand::ModelNeutralExecuteImpl( 62 bool ProcessCommitResponseCommand::ModelNeutralExecuteImpl(
85 sessions::SyncSession* session) { 63 sessions::SyncSession* session) {
86 ScopedDirLookup dir(session->context()->directory_manager(), 64 ScopedDirLookup dir(session->context()->directory_manager(),
87 session->context()->account_name()); 65 session->context()->account_name());
88 if (!dir.good()) { 66 if (!dir.good()) {
89 LOG(ERROR) << "Scoped dir lookup failed!"; 67 LOG(ERROR) << "Scoped dir lookup failed!";
90 return false; 68 return false;
91 } 69 }
92 70
93 const StatusController& status = session->status_controller(); 71 const StatusController& status = session->status_controller();
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // been recursively deleted. 485 // been recursively deleted.
508 // TODO(nick): Here, commit_message.deleted() would be more correct than 486 // TODO(nick): Here, commit_message.deleted() would be more correct than
509 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then 487 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then
510 // deleted during the commit of the rename. Unit test & fix. 488 // deleted during the commit of the rename. Unit test & fix.
511 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { 489 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) {
512 deleted_folders->insert(local_entry->Get(ID)); 490 deleted_folders->insert(local_entry->Get(ID));
513 } 491 }
514 } 492 }
515 493
516 } // namespace browser_sync 494 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698