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

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

Issue 8759017: BookmarkModel cleanup. synced_node is now mobile_node and I'm nuking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to trunk fix sync_integration_tests and extension test Created 9 years 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
« no previous file with comments | « chrome/browser/bookmarks/bookmark_storage.h ('k') | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 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/bookmarks/bookmark_storage.h" 5 #include "chrome/browser/bookmarks/bookmark_storage.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 JSONFileValueSerializer serializer(path); 55 JSONFileValueSerializer serializer(path);
56 scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); 56 scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL));
57 57
58 if (root.get()) { 58 if (root.get()) {
59 // Building the index can take a while, so we do it on the background 59 // Building the index can take a while, so we do it on the background
60 // thread. 60 // thread.
61 int64 max_node_id = 0; 61 int64 max_node_id = 0;
62 BookmarkCodec codec; 62 BookmarkCodec codec;
63 TimeTicks start_time = TimeTicks::Now(); 63 TimeTicks start_time = TimeTicks::Now();
64 codec.Decode(details->bb_node(), details->other_folder_node(), 64 codec.Decode(details->bb_node(), details->other_folder_node(),
65 details->synced_folder_node(), &max_node_id, *root.get()); 65 details->mobile_folder_node(), &max_node_id, *root.get());
66 details->set_max_id(std::max(max_node_id, details->max_id())); 66 details->set_max_id(std::max(max_node_id, details->max_id()));
67 details->set_computed_checksum(codec.computed_checksum()); 67 details->set_computed_checksum(codec.computed_checksum());
68 details->set_stored_checksum(codec.stored_checksum()); 68 details->set_stored_checksum(codec.stored_checksum());
69 details->set_ids_reassigned(codec.ids_reassigned()); 69 details->set_ids_reassigned(codec.ids_reassigned());
70 UMA_HISTOGRAM_TIMES("Bookmarks.DecodeTime", 70 UMA_HISTOGRAM_TIMES("Bookmarks.DecodeTime",
71 TimeTicks::Now() - start_time); 71 TimeTicks::Now() - start_time);
72 72
73 start_time = TimeTicks::Now(); 73 start_time = TimeTicks::Now();
74 AddBookmarksToIndex(details, details->bb_node()); 74 AddBookmarksToIndex(details, details->bb_node());
75 AddBookmarksToIndex(details, details->other_folder_node()); 75 AddBookmarksToIndex(details, details->other_folder_node());
76 AddBookmarksToIndex(details, details->synced_folder_node()); 76 AddBookmarksToIndex(details, details->mobile_folder_node());
77 UMA_HISTOGRAM_TIMES("Bookmarks.CreateBookmarkIndexTime", 77 UMA_HISTOGRAM_TIMES("Bookmarks.CreateBookmarkIndexTime",
78 TimeTicks::Now() - start_time); 78 TimeTicks::Now() - start_time);
79 } 79 }
80 } 80 }
81 81
82 BrowserThread::PostTask( 82 BrowserThread::PostTask(
83 BrowserThread::UI, FROM_HERE, 83 BrowserThread::UI, FROM_HERE,
84 base::Bind(&BookmarkStorage::OnLoadFinished, storage, 84 base::Bind(&BookmarkStorage::OnLoadFinished, storage,
85 bookmark_file_exists, path)); 85 bookmark_file_exists, path));
86 } 86 }
87 87
88 } // namespace 88 } // namespace
89 89
90 // BookmarkLoadDetails --------------------------------------------------------- 90 // BookmarkLoadDetails ---------------------------------------------------------
91 91
92 BookmarkLoadDetails::BookmarkLoadDetails(BookmarkNode* bb_node, 92 BookmarkLoadDetails::BookmarkLoadDetails(BookmarkNode* bb_node,
93 BookmarkNode* other_folder_node, 93 BookmarkNode* other_folder_node,
94 BookmarkNode* synced_folder_node, 94 BookmarkNode* mobile_folder_node,
95 BookmarkIndex* index, 95 BookmarkIndex* index,
96 int64 max_id) 96 int64 max_id)
97 : bb_node_(bb_node), 97 : bb_node_(bb_node),
98 other_folder_node_(other_folder_node), 98 other_folder_node_(other_folder_node),
99 synced_folder_node_(synced_folder_node), 99 mobile_folder_node_(mobile_folder_node),
100 index_(index), 100 index_(index),
101 max_id_(max_id), 101 max_id_(max_id),
102 ids_reassigned_(false) { 102 ids_reassigned_(false) {
103 } 103 }
104 104
105 BookmarkLoadDetails::~BookmarkLoadDetails() { 105 BookmarkLoadDetails::~BookmarkLoadDetails() {
106 } 106 }
107 107
108 // BookmarkStorage ------------------------------------------------------------- 108 // BookmarkStorage -------------------------------------------------------------
109 109
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 NOTREACHED(); 237 NOTREACHED();
238 return false; 238 return false;
239 } 239 }
240 240
241 std::string data; 241 std::string data;
242 if (!SerializeData(&data)) 242 if (!SerializeData(&data))
243 return false; 243 return false;
244 writer_.WriteNow(data); 244 writer_.WriteNow(data);
245 return true; 245 return true;
246 } 246 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_storage.h ('k') | chrome/browser/bookmarks/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698