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

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

Issue 7190001: [Sync] Split DirectoryChangeListener for thread-safety (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix copyright Created 9 years, 6 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) 2010 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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/tracked.h"
12 #include "chrome/browser/sync/engine/syncer_proto_util.h" 13 #include "chrome/browser/sync/engine/syncer_proto_util.h"
13 #include "chrome/browser/sync/engine/syncer_util.h" 14 #include "chrome/browser/sync/engine/syncer_util.h"
14 #include "chrome/browser/sync/engine/syncproto.h" 15 #include "chrome/browser/sync/engine/syncproto.h"
15 #include "chrome/browser/sync/sessions/sync_session.h" 16 #include "chrome/browser/sync/sessions/sync_session.h"
16 #include "chrome/browser/sync/syncable/directory_manager.h" 17 #include "chrome/browser/sync/syncable/directory_manager.h"
17 #include "chrome/browser/sync/syncable/syncable.h" 18 #include "chrome/browser/sync/syncable/syncable.h"
18 19
19 using syncable::ScopedDirLookup; 20 using syncable::ScopedDirLookup;
20 using syncable::WriteTransaction; 21 using syncable::WriteTransaction;
21 using syncable::MutableEntry; 22 using syncable::MutableEntry;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // a map of conflicting new folders. 130 // a map of conflicting new folders.
130 int transient_error_commits = 0; 131 int transient_error_commits = 0;
131 int conflicting_commits = 0; 132 int conflicting_commits = 0;
132 int error_commits = 0; 133 int error_commits = 0;
133 int successes = 0; 134 int successes = 0;
134 set<syncable::Id> conflicting_new_folder_ids; 135 set<syncable::Id> conflicting_new_folder_ids;
135 set<syncable::Id> deleted_folders; 136 set<syncable::Id> deleted_folders;
136 ConflictProgress* conflict_progress = status->mutable_conflict_progress(); 137 ConflictProgress* conflict_progress = status->mutable_conflict_progress();
137 OrderedCommitSet::Projection proj = status->commit_id_projection(); 138 OrderedCommitSet::Projection proj = status->commit_id_projection();
138 if (!proj.empty()) { // Scope for WriteTransaction. 139 if (!proj.empty()) { // Scope for WriteTransaction.
139 WriteTransaction trans(dir, SYNCER, __FILE__, __LINE__); 140 WriteTransaction trans(dir, SYNCER, FROM_HERE);
140 for (size_t i = 0; i < proj.size(); i++) { 141 for (size_t i = 0; i < proj.size(); i++) {
141 CommitResponse::ResponseType response_type = 142 CommitResponse::ResponseType response_type =
142 ProcessSingleCommitResponse(&trans, cr.entryresponse(proj[i]), 143 ProcessSingleCommitResponse(&trans, cr.entryresponse(proj[i]),
143 commit_message.entries(proj[i]), 144 commit_message.entries(proj[i]),
144 status->GetCommitIdAt(proj[i]), 145 status->GetCommitIdAt(proj[i]),
145 &conflicting_new_folder_ids, 146 &conflicting_new_folder_ids,
146 &deleted_folders); 147 &deleted_folders);
147 switch (response_type) { 148 switch (response_type) {
148 case CommitResponse::INVALID_MESSAGE: 149 case CommitResponse::INVALID_MESSAGE:
149 ++error_commits; 150 ++error_commits;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // been recursively deleted. 482 // been recursively deleted.
482 // TODO(nick): Here, commit_message.deleted() would be more correct than 483 // TODO(nick): Here, commit_message.deleted() would be more correct than
483 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then 484 // local_entry->Get(IS_DEL). For example, an item could be renamed, and then
484 // deleted during the commit of the rename. Unit test & fix. 485 // deleted during the commit of the rename. Unit test & fix.
485 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { 486 if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) {
486 deleted_folders->insert(local_entry->Get(ID)); 487 deleted_folders->insert(local_entry->Get(ID));
487 } 488 }
488 } 489 }
489 490
490 } // namespace browser_sync 491 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698