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

Unified Diff: chrome/browser/sync/glue/change_processor.h

Issue 7041008: Moved ScopeStopObserving to a template class in change_processor.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up long line. Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/glue/autofill_profile_change_processor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/change_processor.h
diff --git a/chrome/browser/sync/glue/change_processor.h b/chrome/browser/sync/glue/change_processor.h
index 92fcfff16525f2df423afd88266cd37284cfa4f7..fba83016c1677687e6846ec62122cff4542e245c 100644
--- a/chrome/browser/sync/glue/change_processor.h
+++ b/chrome/browser/sync/glue/change_processor.h
@@ -52,6 +52,24 @@ class ChangeProcessor {
// datatypes need this, so we provide an empty default version.
virtual void CommitChangesFromSyncModel();
+ // This ensures that startobserving gets called after stopobserving even
+ // if there is an early return in the function.
+ template <class T>
+ class ScopedStopObserving {
+ public:
+ explicit ScopedStopObserving(T* processor)
+ : processor_(processor) {
+ processor_->StopObserving();
+ }
+ ~ScopedStopObserving() {
+ processor_->StartObserving();
+ }
+
+ private:
+ ScopedStopObserving() {}
+ T* processor_;
+ };
+
protected:
// These methods are invoked by Start() and Stop() to do
// implementation-specific work.
« no previous file with comments | « chrome/browser/sync/glue/autofill_profile_change_processor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698