| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // We need to wait until history has finished loading before reading | 170 // We need to wait until history has finished loading before reading |
| 171 // from generated bookmarks file. | 171 // from generated bookmarks file. |
| 172 HistoryService* history = | 172 HistoryService* history = |
| 173 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 173 profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
| 174 if (!history) { | 174 if (!history) { |
| 175 // This happens in unit tests. | 175 // This happens in unit tests. |
| 176 if (model_) | 176 if (model_) |
| 177 model_->DoneLoading(details_.release()); | 177 model_->DoneLoading(details_.release()); |
| 178 return; | 178 return; |
| 179 } | 179 } |
| 180 if (!history->backend_loaded()) { | 180 if (!history->BackendLoaded()) { |
| 181 // The backend isn't finished loading. Wait for it. | 181 // The backend isn't finished loading. Wait for it. |
| 182 notification_registrar_.Add(this, NotificationType::HISTORY_LOADED, | 182 notification_registrar_.Add(this, NotificationType::HISTORY_LOADED, |
| 183 Source<Profile>(profile_)); | 183 Source<Profile>(profile_)); |
| 184 } else { | 184 } else { |
| 185 DoLoadBookmarks(tmp_history_path_); | 185 DoLoadBookmarks(tmp_history_path_); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 void BookmarkStorage::OnHistoryFinishedWriting() { | 189 void BookmarkStorage::OnHistoryFinishedWriting() { |
| 190 notification_registrar_.Remove(this, NotificationType::HISTORY_LOADED, | 190 notification_registrar_.Remove(this, NotificationType::HISTORY_LOADED, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 void BookmarkStorage::RunTaskOnBackendThread(Task* task) const { | 274 void BookmarkStorage::RunTaskOnBackendThread(Task* task) const { |
| 275 if (backend_thread()) { | 275 if (backend_thread()) { |
| 276 backend_thread()->message_loop()->PostTask(FROM_HERE, task); | 276 backend_thread()->message_loop()->PostTask(FROM_HERE, task); |
| 277 } else { | 277 } else { |
| 278 task->Run(); | 278 task->Run(); |
| 279 delete task; | 279 delete task; |
| 280 } | 280 } |
| 281 } | 281 } |
| OLD | NEW |