OLD | NEW |
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 #include "chrome/browser/bookmarks/bookmark_storage.h" | 5 #include "chrome/browser/bookmarks/bookmark_storage.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 BookmarkLoadDetails* details) | 67 BookmarkLoadDetails* details) |
68 : path_(path), | 68 : path_(path), |
69 storage_(storage), | 69 storage_(storage), |
70 details_(details) { | 70 details_(details) { |
71 } | 71 } |
72 | 72 |
73 virtual void Run() { | 73 virtual void Run() { |
74 bool bookmark_file_exists = file_util::PathExists(path_); | 74 bool bookmark_file_exists = file_util::PathExists(path_); |
75 if (bookmark_file_exists) { | 75 if (bookmark_file_exists) { |
76 JSONFileValueSerializer serializer(path_); | 76 JSONFileValueSerializer serializer(path_); |
77 scoped_ptr<Value> root(serializer.Deserialize(NULL)); | 77 scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); |
78 | 78 |
79 if (root.get()) { | 79 if (root.get()) { |
80 // Building the index can take a while, so we do it on the background | 80 // Building the index can take a while, so we do it on the background |
81 // thread. | 81 // thread. |
82 int64 max_node_id = 0; | 82 int64 max_node_id = 0; |
83 BookmarkCodec codec; | 83 BookmarkCodec codec; |
84 TimeTicks start_time = TimeTicks::Now(); | 84 TimeTicks start_time = TimeTicks::Now(); |
85 codec.Decode(details_->bb_node(), details_->other_folder_node(), | 85 codec.Decode(details_->bb_node(), details_->other_folder_node(), |
86 &max_node_id, *root.get()); | 86 &max_node_id, *root.get()); |
87 details_->set_max_id(std::max(max_node_id, details_->max_id())); | 87 details_->set_max_id(std::max(max_node_id, details_->max_id())); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 NOTREACHED(); | 253 NOTREACHED(); |
254 return false; | 254 return false; |
255 } | 255 } |
256 | 256 |
257 std::string data; | 257 std::string data; |
258 if (!SerializeData(&data)) | 258 if (!SerializeData(&data)) |
259 return false; | 259 return false; |
260 writer_.WriteNow(data); | 260 writer_.WriteNow(data); |
261 return true; | 261 return true; |
262 } | 262 } |
OLD | NEW |