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

Unified Diff: chrome/browser/sync/js/js_sync_manager_observer.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/js/js_sync_manager_observer.cc
diff --git a/chrome/browser/sync/js/js_sync_manager_observer.cc b/chrome/browser/sync/js/js_sync_manager_observer.cc
index 7f4a85ef4a5d7b0706ad05d9c56550ff0522c924..7714f27422a7bc145920411c0620b84d0015e571 100644
--- a/chrome/browser/sync/js/js_sync_manager_observer.cc
+++ b/chrome/browser/sync/js/js_sync_manager_observer.cc
@@ -30,54 +30,6 @@ void JsSyncManagerObserver::SetJsEventHandler(
event_handler_ = event_handler;
}
-namespace {
-
-// Max number of changes we attempt to convert to values (to avoid
-// running out of memory).
-const size_t kChangeLimit = 300;
-
-} // namespace
-
-void JsSyncManagerObserver::OnChangesApplied(
- syncable::ModelType model_type,
- int64 write_transaction_id,
- const sync_api::ImmutableChangeRecordList& changes) {
- if (!event_handler_.IsInitialized()) {
- return;
- }
- DictionaryValue details;
- details.SetString("modelType", syncable::ModelTypeToString(model_type));
- details.SetString("writeTransactionId",
- base::Int64ToString(write_transaction_id));
- Value* changes_value = NULL;
- const size_t changes_size = changes.Get().size();
- if (changes_size <= kChangeLimit) {
- ListValue* changes_list = new ListValue();
- for (sync_api::ChangeRecordList::const_iterator it =
- changes.Get().begin(); it != changes.Get().end(); ++it) {
- changes_list->Append(it->ToValue());
- }
- changes_value = changes_list;
- } else {
- changes_value =
- Value::CreateStringValue(
- base::Uint64ToString(static_cast<uint64>(changes_size)) +
- " changes");
- }
- details.Set("changes", changes_value);
- HandleJsEvent(FROM_HERE, "onChangesApplied", JsEventDetails(&details));
-}
-
-void JsSyncManagerObserver::OnChangesComplete(
- syncable::ModelType model_type) {
- if (!event_handler_.IsInitialized()) {
- return;
- }
- DictionaryValue details;
- details.SetString("modelType", syncable::ModelTypeToString(model_type));
- HandleJsEvent(FROM_HERE, "onChangesComplete", JsEventDetails(&details));
-}
-
void JsSyncManagerObserver::OnSyncCycleCompleted(
const sessions::SyncSessionSnapshot* snapshot) {
if (!event_handler_.IsInitialized()) {
« no previous file with comments | « chrome/browser/sync/js/js_sync_manager_observer.h ('k') | chrome/browser/sync/js/js_sync_manager_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698