| 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/json_writer.h" | 10 #include "base/json_writer.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 if (root.get()) { | 86 if (root.get()) { |
| 87 // Building the index cane take a while, so we do it on the background | 87 // Building the index cane take a while, so we do it on the background |
| 88 // thread. | 88 // thread. |
| 89 int max_node_id = 0; | 89 int max_node_id = 0; |
| 90 BookmarkCodec codec(persist_ids_); | 90 BookmarkCodec codec(persist_ids_); |
| 91 TimeTicks start_time = TimeTicks::Now(); | 91 TimeTicks start_time = TimeTicks::Now(); |
| 92 codec.Decode(details_->bb_node(), details_->other_folder_node(), | 92 codec.Decode(details_->bb_node(), details_->other_folder_node(), |
| 93 &max_node_id, *root.get()); | 93 &max_node_id, *root.get()); |
| 94 details_->set_max_id(std::max(max_node_id, details_->max_id())); | 94 details_->set_max_id(std::max(max_node_id, details_->max_id())); |
| 95 details_->set_computed_checksum(codec.computed_checksum()); |
| 96 details_->set_stored_checksum(codec.stored_checksum()); |
| 95 UMA_HISTOGRAM_TIMES("Bookmarks.DecodeTime", | 97 UMA_HISTOGRAM_TIMES("Bookmarks.DecodeTime", |
| 96 TimeTicks::Now() - start_time); | 98 TimeTicks::Now() - start_time); |
| 97 | 99 |
| 98 start_time = TimeTicks::Now(); | 100 start_time = TimeTicks::Now(); |
| 99 AddBookmarksToIndex(details_->bb_node()); | 101 AddBookmarksToIndex(details_->bb_node()); |
| 100 AddBookmarksToIndex(details_->other_folder_node()); | 102 AddBookmarksToIndex(details_->other_folder_node()); |
| 101 UMA_HISTOGRAM_TIMES("Bookmarks.CreateBookmarkIndexTime", | 103 UMA_HISTOGRAM_TIMES("Bookmarks.CreateBookmarkIndexTime", |
| 102 TimeTicks::Now() - start_time); | 104 TimeTicks::Now() - start_time); |
| 103 } | 105 } |
| 104 } | 106 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 275 } |
| 274 | 276 |
| 275 void BookmarkStorage::RunTaskOnBackendThread(Task* task) const { | 277 void BookmarkStorage::RunTaskOnBackendThread(Task* task) const { |
| 276 if (backend_thread()) { | 278 if (backend_thread()) { |
| 277 backend_thread()->message_loop()->PostTask(FROM_HERE, task); | 279 backend_thread()->message_loop()->PostTask(FROM_HERE, task); |
| 278 } else { | 280 } else { |
| 279 task->Run(); | 281 task->Run(); |
| 280 delete task; | 282 delete task; |
| 281 } | 283 } |
| 282 } | 284 } |
| OLD | NEW |