| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // This happens in unit tests. | 178 // This happens in unit tests. |
| 179 if (model_) | 179 if (model_) |
| 180 model_->DoneLoading(details_.release()); | 180 model_->DoneLoading(details_.release()); |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 if (!history->backend_loaded()) { | 183 if (!history->backend_loaded()) { |
| 184 // The backend isn't finished loading. Wait for it. | 184 // The backend isn't finished loading. Wait for it. |
| 185 notification_registrar_.Add(this, NotificationType::HISTORY_LOADED, | 185 notification_registrar_.Add(this, NotificationType::HISTORY_LOADED, |
| 186 Source<Profile>(profile_)); | 186 Source<Profile>(profile_)); |
| 187 } else { | 187 } else { |
| 188 DoLoadBookmarks(tmp_history_path_); | 188 OnHistoryFinishedWriting(); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 void BookmarkStorage::OnHistoryFinishedWriting() { | 192 void BookmarkStorage::OnHistoryFinishedWriting() { |
| 193 notification_registrar_.Remove(this, NotificationType::HISTORY_LOADED, | 193 notification_registrar_.Remove(this, NotificationType::HISTORY_LOADED, |
| 194 Source<Profile>(profile_)); | 194 Source<Profile>(profile_)); |
| 195 | 195 |
| 196 // This is used when migrating bookmarks data from database to file. | 196 // This is used when migrating bookmarks data from database to file. |
| 197 // History wrote the file for us, and now we want to load data from it. | 197 // History wrote the file for us, and now we want to load data from it. |
| 198 DoLoadBookmarks(tmp_history_path_); | 198 DoLoadBookmarks(tmp_history_path_); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 275 } |
| 276 | 276 |
| 277 void BookmarkStorage::RunTaskOnBackendThread(Task* task) const { | 277 void BookmarkStorage::RunTaskOnBackendThread(Task* task) const { |
| 278 if (backend_thread()) { | 278 if (backend_thread()) { |
| 279 backend_thread()->message_loop()->PostTask(FROM_HERE, task); | 279 backend_thread()->message_loop()->PostTask(FROM_HERE, task); |
| 280 } else { | 280 } else { |
| 281 task->Run(); | 281 task->Run(); |
| 282 delete task; | 282 delete task; |
| 283 } | 283 } |
| 284 } | 284 } |
| OLD | NEW |