summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_codec.h
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 23:27:01 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 23:27:01 +0000
commit93027af7b72518f78c34ada454884eb022dcf656 (patch)
tree08d6c738c42f263140bf546e07f8df79647e6422 /chrome/browser/bookmarks/bookmark_codec.h
parent4baf17bd9aef3b92251d729e1f16fc7ffde3d0aa (diff)
downloadchromium_src-93027af7b72518f78c34ada454884eb022dcf656.zip
chromium_src-93027af7b72518f78c34ada454884eb022dcf656.tar.gz
chromium_src-93027af7b72518f78c34ada454884eb022dcf656.tar.bz2
Makes sure bookmark ids are unique on reading from file. If not unique
we reassign them. The particular scenario that can lead to this is when migrating bookmarks out of the db we never reset the ids of the newly created nodes, so that we wrote all to the file with ids of 0. I'm not patching that code so that I have coverage of the unit test, and we'll handle fix up during reading anyway. BUG=24060 TEST=covered by unit tests Review URL: http://codereview.chromium.org/268001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28346 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_codec.h')
-rw-r--r--chrome/browser/bookmarks/bookmark_codec.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/bookmarks/bookmark_codec.h b/chrome/browser/bookmarks/bookmark_codec.h
index 25e9cb0..257a80f 100644
--- a/chrome/browser/bookmarks/bookmark_codec.h
+++ b/chrome/browser/bookmarks/bookmark_codec.h
@@ -9,6 +9,7 @@
#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_
#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_CODEC_H_
+#include <set>
#include <string>
#include "base/basictypes.h"
@@ -137,8 +138,13 @@ class BookmarkCodec {
// Whether or not IDs were reassigned by the codec.
bool ids_reassigned_;
- // Whether or not IDs were missing for some bookmark nodes during decoding.
- bool ids_missing_;
+ // Whether or not IDs are valid. This is initially true, but set to false
+ // if an id is missing or not unique.
+ bool ids_valid_;
+
+ // Contains the id of each of the nodes found in the file. Used to determine
+ // if we have duplicates.
+ std::set<int64> ids_;
// MD5 context used to compute MD5 hash of all bookmark data.
MD5Context md5_context_;