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 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/deferred_sequenced_task_runner.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
16 #include "base/string16.h" | 17 #include "base/string16.h" |
17 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
18 #include "base/synchronization/waitable_event.h" | 19 #include "base/synchronization/waitable_event.h" |
19 #include "chrome/browser/bookmarks/bookmark_service.h" | 20 #include "chrome/browser/bookmarks/bookmark_service.h" |
20 #include "chrome/browser/profiles/profile_keyed_service.h" | 21 #include "chrome/browser/profiles/profile_keyed_service.h" |
21 #include "chrome/common/cancelable_task_tracker.h" | 22 #include "chrome/common/cancelable_task_tracker.h" |
22 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 class BookmarkModel : public content::NotificationObserver, | 228 class BookmarkModel : public content::NotificationObserver, |
228 public BookmarkService, | 229 public BookmarkService, |
229 public ProfileKeyedService { | 230 public ProfileKeyedService { |
230 public: | 231 public: |
231 explicit BookmarkModel(Profile* profile); | 232 explicit BookmarkModel(Profile* profile); |
232 virtual ~BookmarkModel(); | 233 virtual ~BookmarkModel(); |
233 | 234 |
234 // Invoked prior to destruction to release any necessary resources. | 235 // Invoked prior to destruction to release any necessary resources. |
235 virtual void Shutdown() OVERRIDE; | 236 virtual void Shutdown() OVERRIDE; |
236 | 237 |
| 238 // Returns sequenced task runner where all bookmarks I/O operations are |
| 239 // performed. |
| 240 scoped_refptr<base::DeferredSequencedTaskRunner> GetBookmarkTaskRunner(); |
| 241 |
237 // Loads the bookmarks. This is called upon creation of the | 242 // Loads the bookmarks. This is called upon creation of the |
238 // BookmarkModel. You need not invoke this directly. | 243 // BookmarkModel. You need not invoke this directly. |
239 void Load(); | 244 void Load(); |
240 | 245 |
241 // Returns true if the model finished loading. | 246 // Returns true if the model finished loading. |
242 // This is virtual so it can be mocked. | 247 // This is virtual so it can be mocked. |
243 virtual bool IsLoaded() const; | 248 virtual bool IsLoaded() const; |
244 | 249 |
245 // Returns the root node. The 'bookmark bar' node and 'other' node are | 250 // Returns the root node. The 'bookmark bar' node and 'other' node are |
246 // children of the root node. | 251 // children of the root node. |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 526 |
522 scoped_ptr<BookmarkIndex> index_; | 527 scoped_ptr<BookmarkIndex> index_; |
523 | 528 |
524 base::WaitableEvent loaded_signal_; | 529 base::WaitableEvent loaded_signal_; |
525 | 530 |
526 // See description of IsDoingExtensiveChanges above. | 531 // See description of IsDoingExtensiveChanges above. |
527 int extensive_changes_; | 532 int extensive_changes_; |
528 | 533 |
529 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 534 scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
530 | 535 |
| 536 scoped_refptr<base::DeferredSequencedTaskRunner> bookmark_task_runner_; |
| 537 |
531 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 538 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
532 }; | 539 }; |
533 | 540 |
534 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ | 541 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MODEL_H_ |
OLD | NEW |