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

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

Issue 386030: Relieve SyncerSession,SyncCycleState, SyncProcessState, SyncerSession, Syncer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 5
6 #include "chrome/browser/sync/engine/verify_updates_command.h" 6 #include "chrome/browser/sync/engine/verify_updates_command.h"
7 7
8 #include "chrome/browser/sync/engine/syncer.h" 8 #include "chrome/browser/sync/engine/syncer.h"
9 #include "chrome/browser/sync/engine/syncer_proto_util.h" 9 #include "chrome/browser/sync/engine/syncer_proto_util.h"
10 #include "chrome/browser/sync/engine/syncer_types.h" 10 #include "chrome/browser/sync/engine/syncer_types.h"
11 #include "chrome/browser/sync/engine/syncer_util.h" 11 #include "chrome/browser/sync/engine/syncer_util.h"
12 #include "chrome/browser/sync/engine/syncproto.h" 12 #include "chrome/browser/sync/engine/syncproto.h"
13 #include "chrome/browser/sync/syncable/directory_manager.h" 13 #include "chrome/browser/sync/syncable/directory_manager.h"
14 #include "chrome/browser/sync/syncable/syncable.h" 14 #include "chrome/browser/sync/syncable/syncable.h"
15 #include "chrome/browser/sync/util/sync_types.h"
16 15
17 namespace browser_sync { 16 namespace browser_sync {
18 17
19 using syncable::ScopedDirLookup; 18 using syncable::ScopedDirLookup;
20 using syncable::SyncName; 19 using syncable::SyncName;
21 using syncable::WriteTransaction; 20 using syncable::WriteTransaction;
22 21
23 using syncable::GET_BY_ID; 22 using syncable::GET_BY_ID;
24 using syncable::SYNCER; 23 using syncable::SYNCER;
25 24
26 VerifyUpdatesCommand::VerifyUpdatesCommand() {} 25 VerifyUpdatesCommand::VerifyUpdatesCommand() {}
27 VerifyUpdatesCommand::~VerifyUpdatesCommand() {} 26 VerifyUpdatesCommand::~VerifyUpdatesCommand() {}
28 27
29 void VerifyUpdatesCommand::ExecuteImpl(SyncerSession* session) { 28 void VerifyUpdatesCommand::ExecuteImpl(sessions::SyncSession* session) {
30 LOG(INFO) << "Beginning Update Verification"; 29 LOG(INFO) << "Beginning Update Verification";
31 ScopedDirLookup dir(session->dirman(), session->account_name()); 30 ScopedDirLookup dir(session->context()->directory_manager(),
31 session->context()->account_name());
32 if (!dir.good()) { 32 if (!dir.good()) {
33 LOG(ERROR) << "Scoped dir lookup failed!"; 33 LOG(ERROR) << "Scoped dir lookup failed!";
34 return; 34 return;
35 } 35 }
36 WriteTransaction trans(dir, SYNCER, __FILE__, __LINE__); 36 WriteTransaction trans(dir, SYNCER, __FILE__, __LINE__);
37 GetUpdatesResponse updates = session->update_response().get_updates(); 37 sessions::StatusController* status = session->status_controller();
38 const GetUpdatesResponse& updates = status->updates_response().get_updates();
38 int update_count = updates.entries().size(); 39 int update_count = updates.entries().size();
39 40
40 LOG(INFO) << update_count << " entries to verify"; 41 LOG(INFO) << update_count << " entries to verify";
41 for (int i = 0; i < update_count; i++) { 42 for (int i = 0; i < update_count; i++) {
42 const SyncEntity entry = 43 const SyncEntity entry =
43 *reinterpret_cast<const SyncEntity *>(&(updates.entries(i))); 44 *reinterpret_cast<const SyncEntity *>(&(updates.entries(i)));
44 // Needs to be done separately in order to make sure the update processing 45 // Needs to be done separately in order to make sure the update processing
45 // still happens like normal. We should really just use one type of 46 // still happens like normal. We should really just use one type of
46 // ID in fact, there isn't actually a need for server_knows and not IDs. 47 // ID in fact, there isn't actually a need for server_knows and not IDs.
47 SyncerUtil::AttemptReuniteLostCommitResponses(&trans, entry, 48 SyncerUtil::AttemptReuniteLostCommitResponses(&trans, entry,
48 trans.directory()->cache_guid()); 49 trans.directory()->cache_guid());
49 VerifyResult result = VerifyUpdate(&trans, entry); 50 VerifyResult result = VerifyUpdate(&trans, entry);
50 session->AddVerifyResult(result, entry); 51 status->mutable_update_progress()->AddVerifyResult(result, entry);
51 } 52 }
52 } 53 }
53 54
54 VerifyResult VerifyUpdatesCommand::VerifyUpdate( 55 VerifyResult VerifyUpdatesCommand::VerifyUpdate(
55 syncable::WriteTransaction* trans, const SyncEntity& entry) { 56 syncable::WriteTransaction* trans, const SyncEntity& entry) {
56 syncable::Id id = entry.id(); 57 syncable::Id id = entry.id();
57 58
58 const bool deleted = entry.has_deleted() && entry.deleted(); 59 const bool deleted = entry.has_deleted() && entry.deleted();
59 const bool is_directory = entry.IsFolder(); 60 const bool is_directory = entry.IsFolder();
60 const bool is_bookmark = entry.has_bookmarkdata(); 61 const bool is_bookmark = entry.has_bookmarkdata();
(...skipping 30 matching lines...) Expand all
91 deleted, is_directory, is_bookmark); 92 deleted, is_directory, is_bookmark);
92 } 93 }
93 94
94 if (VERIFY_UNDECIDED == result) 95 if (VERIFY_UNDECIDED == result)
95 return VERIFY_SUCCESS; // No news is good news. 96 return VERIFY_SUCCESS; // No news is good news.
96 else 97 else
97 return result; // This might be VERIFY_SUCCESS as well 98 return result; // This might be VERIFY_SUCCESS as well
98 } 99 }
99 100
100 } // namespace browser_sync 101 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/verify_updates_command.h ('k') | chrome/browser/sync/sessions/session_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698