summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 22:31:39 +0000
committermarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 22:31:39 +0000
commitcbcd641584f5871ec827e5e92d2e701c3d1a4471 (patch)
tree0d247c884cecad5ed158bc260ea495d6670d8b97
parent23eb8cd1862166d32bff8dcf9ee1b6e0e4717fff (diff)
downloadchromium_src-cbcd641584f5871ec827e5e92d2e701c3d1a4471.zip
chromium_src-cbcd641584f5871ec827e5e92d2e701c3d1a4471.tar.gz
chromium_src-cbcd641584f5871ec827e5e92d2e701c3d1a4471.tar.bz2
Adds support for BlockTillLoaded to Linux.
Review URL: http://codereview.chromium.org/39298 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11300 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc21
-rw-r--r--chrome/browser/bookmarks/bookmark_model.h11
2 files changed, 6 insertions, 26 deletions
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index bedbac3..34e179f 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -95,10 +95,8 @@ BookmarkModel::BookmarkModel(Profile* profile)
bookmark_bar_node_(NULL),
other_node_(NULL),
observers_(ObserverList<BookmarkModelObserver>::NOTIFY_EXISTING_ONLY),
- waiting_for_history_load_(false)
-#if defined(OS_WIN)
- , loaded_signal_(CreateEvent(NULL, TRUE, FALSE, NULL))
-#endif
+ waiting_for_history_load_(false),
+ loaded_signal_(TRUE, FALSE)
{
// Create the bookmark bar and other bookmarks folders. These always exist.
CreateBookmarkNode();
@@ -489,13 +487,7 @@ void BookmarkModel::DoneLoading() {
loaded_ = true;
-#if defined(OS_WIN)
- if (loaded_signal_.Get())
- SetEvent(loaded_signal_.Get());
-#else
- NOTIMPLEMENTED();
-#endif
-
+ loaded_signal_.Signal();
// Notify our direct observers.
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_, Loaded(this));
@@ -583,12 +575,7 @@ BookmarkNode* BookmarkModel::AddNode(BookmarkNode* parent,
}
void BookmarkModel::BlockTillLoaded() {
-#if defined(OS_WIN)
- if (loaded_signal_.Get())
- WaitForSingleObject(loaded_signal_.Get(), INFINITE);
-#else
- NOTIMPLEMENTED();
-#endif
+ loaded_signal_.Wait();
}
BookmarkNode* BookmarkModel::GetNodeByID(BookmarkNode* node, int id) {
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h
index 23517dd..bd94c12 100644
--- a/chrome/browser/bookmarks/bookmark_model.h
+++ b/chrome/browser/bookmarks/bookmark_model.h
@@ -9,9 +9,7 @@
#include "base/lock.h"
#include "base/observer_list.h"
-#if defined(OS_WIN)
-#include "base/scoped_handle.h"
-#endif // defined(OS_WIN)
+#include "base/waitable_event.h"
#include "chrome/browser/bookmarks/bookmark_service.h"
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/cancelable_request.h"
@@ -430,12 +428,7 @@ class BookmarkModel : public NotificationObserver, public BookmarkService {
// doesn't exist and the history service hasn't finished loading.
bool waiting_for_history_load_;
-#if defined(OS_WIN)
- // TODO(port): Implement for other platforms.
-
- // Handle to event signaled when loading is done.
- ScopedHandle loaded_signal_;
-#endif
+ base::WaitableEvent loaded_signal_;
DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
};