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

Side by Side Diff: chrome/browser/bookmarks/bookmark_storage.h

Issue 155456: Try the original CL "Always persist bookmark IDs" again with the fix to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 26 matching lines...) Expand all
37 // BookmarkStorage. BoomarkStorage loads the bookmarks (and index) in the 37 // BookmarkStorage. BoomarkStorage loads the bookmarks (and index) in the
38 // background thread, then calls back to the BookmarkModel (on the main 38 // background thread, then calls back to the BookmarkModel (on the main
39 // thread) when loading is done, passing ownership back to the BookmarkModel. 39 // thread) when loading is done, passing ownership back to the BookmarkModel.
40 // While loading BookmarkModel does not maintain references to the contents 40 // While loading BookmarkModel does not maintain references to the contents
41 // of the LoadDetails, this ensures we don't have any threading problems. 41 // of the LoadDetails, this ensures we don't have any threading problems.
42 class LoadDetails { 42 class LoadDetails {
43 public: 43 public:
44 LoadDetails(BookmarkNode* bb_node, 44 LoadDetails(BookmarkNode* bb_node,
45 BookmarkNode* other_folder_node, 45 BookmarkNode* other_folder_node,
46 BookmarkIndex* index, 46 BookmarkIndex* index,
47 int max_id) 47 int64 max_id)
48 : bb_node_(bb_node), 48 : bb_node_(bb_node),
49 other_folder_node_(other_folder_node), 49 other_folder_node_(other_folder_node),
50 index_(index), 50 index_(index),
51 max_id_(max_id) { 51 max_id_(max_id),
52 ids_reassigned_(false) {
52 } 53 }
53 54
54 void release() { 55 void release() {
55 bb_node_.release(); 56 bb_node_.release();
56 other_folder_node_.release(); 57 other_folder_node_.release();
57 index_.release(); 58 index_.release();
58 } 59 }
59 60
60 BookmarkNode* bb_node() { return bb_node_.get(); } 61 BookmarkNode* bb_node() { return bb_node_.get(); }
61 BookmarkNode* other_folder_node() { return other_folder_node_.get(); } 62 BookmarkNode* other_folder_node() { return other_folder_node_.get(); }
62 BookmarkIndex* index() { return index_.get(); } 63 BookmarkIndex* index() { return index_.get(); }
63 64
64 // Max id of the nodes. 65 // Max id of the nodes.
65 void set_max_id(int max_id) { max_id_ = max_id; } 66 void set_max_id(int64 max_id) { max_id_ = max_id; }
66 int max_id() const { return max_id_; } 67 int64 max_id() const { return max_id_; }
67 68
68 // Computed checksum. 69 // Computed checksum.
69 void set_computed_checksum(const std::string& value) { 70 void set_computed_checksum(const std::string& value) {
70 computed_checksum_ = value; 71 computed_checksum_ = value;
71 } 72 }
72 const std::string& computed_checksum() const { return computed_checksum_; } 73 const std::string& computed_checksum() const { return computed_checksum_; }
73 74
74 // Stored checksum. 75 // Stored checksum.
75 void set_stored_checksum(const std::string& value) { 76 void set_stored_checksum(const std::string& value) {
76 stored_checksum_ = value; 77 stored_checksum_ = value;
77 } 78 }
78 const std::string& stored_checksum() const { return stored_checksum_; } 79 const std::string& stored_checksum() const { return stored_checksum_; }
79 80
81 // Whether ids were reassigned.
82 void set_ids_reassigned(bool value) { ids_reassigned_ = value; }
83 bool ids_reassigned() const { return ids_reassigned_; }
84
80 private: 85 private:
81 scoped_ptr<BookmarkNode> bb_node_; 86 scoped_ptr<BookmarkNode> bb_node_;
82 scoped_ptr<BookmarkNode> other_folder_node_; 87 scoped_ptr<BookmarkNode> other_folder_node_;
83 scoped_ptr<BookmarkIndex> index_; 88 scoped_ptr<BookmarkIndex> index_;
84 int max_id_; 89 int64 max_id_;
85 std::string computed_checksum_; 90 std::string computed_checksum_;
86 std::string stored_checksum_; 91 std::string stored_checksum_;
92 bool ids_reassigned_;
87 93
88 DISALLOW_COPY_AND_ASSIGN(LoadDetails); 94 DISALLOW_COPY_AND_ASSIGN(LoadDetails);
89 }; 95 };
90 96
91 // Creates a BookmarkStorage for the specified model 97 // Creates a BookmarkStorage for the specified model
92 BookmarkStorage(Profile* profile, BookmarkModel* model); 98 BookmarkStorage(Profile* profile, BookmarkModel* model);
93 ~BookmarkStorage(); 99 ~BookmarkStorage();
94 100
95 // Loads the bookmarks into the model, notifying the model when done. This 101 // Loads the bookmarks into the model, notifying the model when done. This
96 // takes ownership of |details|. See LoadDetails for details. 102 // takes ownership of |details|. See LoadDetails for details.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // Path to temporary file created during migrating bookmarks from history. 169 // Path to temporary file created during migrating bookmarks from history.
164 const FilePath tmp_history_path_; 170 const FilePath tmp_history_path_;
165 171
166 // See class description of LoadDetails for details on this. 172 // See class description of LoadDetails for details on this.
167 scoped_ptr<LoadDetails> details_; 173 scoped_ptr<LoadDetails> details_;
168 174
169 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); 175 DISALLOW_COPY_AND_ASSIGN(BookmarkStorage);
170 }; 176 };
171 177
172 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ 178 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698