Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: sync/notifier/sync_system_resources.h

Issue 26594002: Chrome sync: Put WeakPtrFactory members at the end (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge (see prior patch for try jobs) Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // Simple system resources class that uses the current message loop 5 // Simple system resources class that uses the current message loop
6 // for scheduling. Assumes the current message loop is already 6 // for scheduling. Assumes the current message loop is already
7 // running. 7 // running.
8 8
9 #ifndef SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ 9 #ifndef SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_
10 #define SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ 10 #define SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 invalidation::Closure* task) OVERRIDE; 58 invalidation::Closure* task) OVERRIDE;
59 59
60 virtual bool IsRunningOnThread() const OVERRIDE; 60 virtual bool IsRunningOnThread() const OVERRIDE;
61 61
62 virtual invalidation::Time GetCurrentTime() const OVERRIDE; 62 virtual invalidation::Time GetCurrentTime() const OVERRIDE;
63 63
64 virtual void SetSystemResources( 64 virtual void SetSystemResources(
65 invalidation::SystemResources* resources) OVERRIDE; 65 invalidation::SystemResources* resources) OVERRIDE;
66 66
67 private: 67 private:
68 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_; 68 // Runs the task, deletes it, and removes it from |posted_tasks_|.
69 void RunPostedTask(invalidation::Closure* task);
70
69 // Holds all posted tasks that have not yet been run. 71 // Holds all posted tasks that have not yet been run.
70 std::set<invalidation::Closure*> posted_tasks_; 72 std::set<invalidation::Closure*> posted_tasks_;
71 73
72 const base::MessageLoop* created_on_loop_; 74 const base::MessageLoop* created_on_loop_;
73 bool is_started_; 75 bool is_started_;
74 bool is_stopped_; 76 bool is_stopped_;
75 77
76 // Runs the task, deletes it, and removes it from |posted_tasks_|. 78 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_;
77 void RunPostedTask(invalidation::Closure* task);
78 }; 79 };
79 80
80 class SyncStorage : public invalidation::Storage { 81 class SyncStorage : public invalidation::Storage {
81 public: 82 public:
82 SyncStorage(StateWriter* state_writer, invalidation::Scheduler* scheduler); 83 SyncStorage(StateWriter* state_writer, invalidation::Scheduler* scheduler);
83 84
84 virtual ~SyncStorage(); 85 virtual ~SyncStorage();
85 86
86 void SetInitialState(const std::string& value) { 87 void SetInitialState(const std::string& value) {
87 cached_state_ = value; 88 cached_state_ = value;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 scoped_ptr<SyncLogger> logger_; 144 scoped_ptr<SyncLogger> logger_;
144 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_; 145 scoped_ptr<SyncInvalidationScheduler> internal_scheduler_;
145 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_; 146 scoped_ptr<SyncInvalidationScheduler> listener_scheduler_;
146 scoped_ptr<SyncStorage> storage_; 147 scoped_ptr<SyncStorage> storage_;
147 PushClientChannel push_client_channel_; 148 PushClientChannel push_client_channel_;
148 }; 149 };
149 150
150 } // namespace syncer 151 } // namespace syncer
151 152
152 #endif // SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_ 153 #endif // SYNC_NOTIFIER_SYNC_SYSTEM_RESOURCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698