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

Unified Diff: chrome/browser/sync/internal_api/sync_manager.cc

Issue 7982049: [Sync] Move some code into new class JsMutationEventObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deps Created 9 years, 3 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
Index: chrome/browser/sync/internal_api/sync_manager.cc
diff --git a/chrome/browser/sync/internal_api/sync_manager.cc b/chrome/browser/sync/internal_api/sync_manager.cc
index e2f1c2f14d348d9d3c83d67dbb58bab19f3c91f4..5e1c5374285fe3e6128a937fc42ae92ed42d9b26 100644
--- a/chrome/browser/sync/internal_api/sync_manager.cc
+++ b/chrome/browser/sync/internal_api/sync_manager.cc
@@ -34,9 +34,9 @@
#include "chrome/browser/sync/js/js_backend.h"
#include "chrome/browser/sync/js/js_event_details.h"
#include "chrome/browser/sync/js/js_event_handler.h"
+#include "chrome/browser/sync/js/js_mutation_event_observer.h"
#include "chrome/browser/sync/js/js_reply_handler.h"
#include "chrome/browser/sync/js/js_sync_manager_observer.h"
-#include "chrome/browser/sync/js/js_transaction_observer.h"
#include "chrome/browser/sync/notifier/sync_notifier.h"
#include "chrome/browser/sync/notifier/sync_notifier_observer.h"
#include "chrome/browser/sync/protocol/proto_value_conversions.h"
@@ -61,8 +61,8 @@ using browser_sync::JsEventDetails;
using browser_sync::JsEventHandler;
using browser_sync::JsEventHandler;
using browser_sync::JsReplyHandler;
+using browser_sync::JsMutationEventObserver;
using browser_sync::JsSyncManagerObserver;
-using browser_sync::JsTransactionObserver;
using browser_sync::ModelSafeWorkerRegistrar;
using browser_sync::kNigoriTag;
using browser_sync::KeyParams;
@@ -549,7 +549,7 @@ class SyncManager::SyncInternal
JsMessageHandlerMap js_message_handlers_;
WeakHandle<JsEventHandler> js_event_handler_;
JsSyncManagerObserver js_sync_manager_observer_;
- JsTransactionObserver js_transaction_observer_;
+ JsMutationEventObserver js_mutation_event_observer_;
};
const int SyncManager::SyncInternal::kDefaultNudgeDelayMilliseconds = 200;
const int SyncManager::SyncInternal::kPreferencesNudgeDelayMilliseconds = 2000;
@@ -756,7 +756,6 @@ bool SyncManager::SyncInternal::Init(
sync_notifier_.reset(sync_notifier);
- AddChangeObserver(&js_sync_manager_observer_);
AddObserver(&js_sync_manager_observer_);
SetJsEventHandler(event_handler);
@@ -897,7 +896,8 @@ bool SyncManager::SyncInternal::OpenDirectory() {
}
connection_manager()->set_client_id(lookup->cache_guid());
- lookup->AddTransactionObserver(&js_transaction_observer_);
+ lookup->AddTransactionObserver(&js_mutation_event_observer_);
+ AddChangeObserver(&js_mutation_event_observer_);
return true;
}
@@ -1262,7 +1262,6 @@ void SyncManager::SyncInternal::Shutdown() {
scheduler_.reset();
SetJsEventHandler(WeakHandle<JsEventHandler>());
- RemoveChangeObserver(&js_sync_manager_observer_);
RemoveObserver(&js_sync_manager_observer_);
if (sync_notifier_.get()) {
@@ -1281,7 +1280,8 @@ void SyncManager::SyncInternal::Shutdown() {
if (dir_manager()) {
syncable::ScopedDirLookup lookup(dir_manager(), username_for_share());
if (lookup.good()) {
- lookup->RemoveTransactionObserver(&js_transaction_observer_);
+ lookup->RemoveTransactionObserver(&js_mutation_event_observer_);
+ RemoveChangeObserver(&js_mutation_event_observer_);
} else {
NOTREACHED();
}
@@ -1680,7 +1680,7 @@ void SyncManager::SyncInternal::SetJsEventHandler(
const WeakHandle<JsEventHandler>& event_handler) {
js_event_handler_ = event_handler;
js_sync_manager_observer_.SetJsEventHandler(js_event_handler_);
- js_transaction_observer_.SetJsEventHandler(js_event_handler_);
+ js_mutation_event_observer_.SetJsEventHandler(js_event_handler_);
}
void SyncManager::SyncInternal::ProcessJsMessage(
« no previous file with comments | « chrome/browser/resources/sync_internals/chrome_sync.js ('k') | chrome/browser/sync/js/js_mutation_event_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698