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

Side by Side Diff: components/sync/core/delete_journal.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Fix tools and iOS. Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/sync/core/delete_journal.h" 5 #include "components/sync/core/delete_journal.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "components/sync/core/base_transaction.h" 12 #include "components/sync/core/base_transaction.h"
13 #include "components/sync/syncable/directory.h" 13 #include "components/sync/syncable/directory.h"
14 #include "components/sync/syncable/syncable_base_transaction.h" 14 #include "components/sync/syncable/syncable_base_transaction.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 // static 18 // static
19 void DeleteJournal::GetBookmarkDeleteJournals( 19 void DeleteJournal::GetBookmarkDeleteJournals(
20 BaseTransaction* trans, 20 BaseTransaction* trans,
21 BookmarkDeleteJournalList* delete_journal_list) { 21 BookmarkDeleteJournalList* delete_journal_list) {
22 syncer::syncable::EntryKernelSet deleted_entries; 22 syncable::EntryKernelSet deleted_entries;
23 trans->GetDirectory()->delete_journal()->GetDeleteJournals( 23 trans->GetDirectory()->delete_journal()->GetDeleteJournals(
24 trans->GetWrappedTrans(), BOOKMARKS, &deleted_entries); 24 trans->GetWrappedTrans(), BOOKMARKS, &deleted_entries);
25 std::set<int64_t> undecryptable_journal; 25 std::set<int64_t> undecryptable_journal;
26 for (syncer::syncable::EntryKernelSet::const_iterator i = 26 for (syncable::EntryKernelSet::const_iterator i = deleted_entries.begin();
27 deleted_entries.begin();
28 i != deleted_entries.end(); ++i) { 27 i != deleted_entries.end(); ++i) {
29 delete_journal_list->push_back(BookmarkDeleteJournal()); 28 delete_journal_list->push_back(BookmarkDeleteJournal());
30 delete_journal_list->back().id = (*i)->ref(syncer::syncable::META_HANDLE); 29 delete_journal_list->back().id = (*i)->ref(syncable::META_HANDLE);
31 delete_journal_list->back().external_id = 30 delete_journal_list->back().external_id =
32 (*i)->ref(syncer::syncable::LOCAL_EXTERNAL_ID); 31 (*i)->ref(syncable::LOCAL_EXTERNAL_ID);
33 delete_journal_list->back().is_folder = (*i)->ref(syncer::syncable::IS_DIR); 32 delete_journal_list->back().is_folder = (*i)->ref(syncable::IS_DIR);
34 33
35 const sync_pb::EntitySpecifics& specifics = 34 const sync_pb::EntitySpecifics& specifics = (*i)->ref(syncable::SPECIFICS);
36 (*i)->ref(syncer::syncable::SPECIFICS);
37 if (!specifics.has_encrypted()) { 35 if (!specifics.has_encrypted()) {
38 delete_journal_list->back().specifics = specifics; 36 delete_journal_list->back().specifics = specifics;
39 } else { 37 } else {
40 std::string plaintext_data = 38 std::string plaintext_data =
41 trans->GetCryptographer()->DecryptToString(specifics.encrypted()); 39 trans->GetCryptographer()->DecryptToString(specifics.encrypted());
42 sync_pb::EntitySpecifics unencrypted_data; 40 sync_pb::EntitySpecifics unencrypted_data;
43 if (plaintext_data.length() == 0 || 41 if (plaintext_data.length() == 0 ||
44 !unencrypted_data.ParseFromString(plaintext_data)) { 42 !unencrypted_data.ParseFromString(plaintext_data)) {
45 // Fail to decrypt, Add this delete journal to purge. 43 // Fail to decrypt, Add this delete journal to purge.
46 undecryptable_journal.insert(delete_journal_list->back().id); 44 undecryptable_journal.insert(delete_journal_list->back().id);
(...skipping 11 matching lines...) Expand all
58 } 56 }
59 57
60 // static 58 // static
61 void DeleteJournal::PurgeDeleteJournals(BaseTransaction* trans, 59 void DeleteJournal::PurgeDeleteJournals(BaseTransaction* trans,
62 const std::set<int64_t>& ids) { 60 const std::set<int64_t>& ids) {
63 trans->GetDirectory()->delete_journal()->PurgeDeleteJournals( 61 trans->GetDirectory()->delete_journal()->PurgeDeleteJournals(
64 trans->GetWrappedTrans(), ids); 62 trans->GetWrappedTrans(), ids);
65 } 63 }
66 64
67 } // namespace syncer 65 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698