OLD | NEW |
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 "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/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 for (int i = 0; i < node->child_count(); ++i) | 46 for (int i = 0; i < node->child_count(); ++i) |
47 AddBookmarksToIndex(details, node->GetChild(i)); | 47 AddBookmarksToIndex(details, node->GetChild(i)); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 void LoadCallback(const base::FilePath& path, | 51 void LoadCallback(const base::FilePath& path, |
52 BookmarkStorage* storage, | 52 BookmarkStorage* storage, |
53 BookmarkLoadDetails* details) { | 53 BookmarkLoadDetails* details) { |
54 startup_metric_utils::ScopedSlowStartupUMA | 54 startup_metric_utils::ScopedSlowStartupUMA |
55 scoped_timer("Startup.SlowStartupBookmarksLoad"); | 55 scoped_timer("Startup.SlowStartupBookmarksLoad"); |
56 bool bookmark_file_exists = file_util::PathExists(path); | 56 bool bookmark_file_exists = base::PathExists(path); |
57 if (bookmark_file_exists) { | 57 if (bookmark_file_exists) { |
58 JSONFileValueSerializer serializer(path); | 58 JSONFileValueSerializer serializer(path); |
59 scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); | 59 scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); |
60 | 60 |
61 if (root.get()) { | 61 if (root.get()) { |
62 // Building the index can take a while, so we do it on the background | 62 // Building the index can take a while, so we do it on the background |
63 // thread. | 63 // thread. |
64 int64 max_node_id = 0; | 64 int64 max_node_id = 0; |
65 BookmarkCodec codec; | 65 BookmarkCodec codec; |
66 TimeTicks start_time = TimeTicks::Now(); | 66 TimeTicks start_time = TimeTicks::Now(); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 NOTREACHED(); | 173 NOTREACHED(); |
174 return false; | 174 return false; |
175 } | 175 } |
176 | 176 |
177 std::string data; | 177 std::string data; |
178 if (!SerializeData(&data)) | 178 if (!SerializeData(&data)) |
179 return false; | 179 return false; |
180 writer_.WriteNow(data); | 180 writer_.WriteNow(data); |
181 return true; | 181 return true; |
182 } | 182 } |
OLD | NEW |