| OLD | NEW |
| 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 #ifndef COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_ |
| 6 #define COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_ | 6 #define COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 16 #include "components/sync/base/sync_export.h" | |
| 17 #include "components/sync/base/weak_handle.h" | 16 #include "components/sync/base/weak_handle.h" |
| 18 #include "components/sync/core/sync_manager.h" | 17 #include "components/sync/core/sync_manager.h" |
| 19 #include "components/sync/syncable/transaction_observer.h" | 18 #include "components/sync/syncable/transaction_observer.h" |
| 20 | 19 |
| 21 namespace tracked_objects { | 20 namespace tracked_objects { |
| 22 class Location; | 21 class Location; |
| 23 } // namespace tracked_objects | 22 } // namespace tracked_objects |
| 24 | 23 |
| 25 namespace syncer { | 24 namespace syncer { |
| 26 | 25 |
| 27 class JsEventDetails; | 26 class JsEventDetails; |
| 28 class JsEventHandler; | 27 class JsEventHandler; |
| 29 | 28 |
| 30 // Observes all change- and transaction-related events and routes a | 29 // Observes all change- and transaction-related events and routes a |
| 31 // summarized version to a JsEventHandler. | 30 // summarized version to a JsEventHandler. |
| 32 class SYNC_EXPORT JsMutationEventObserver | 31 class JsMutationEventObserver : public SyncManager::ChangeObserver, |
| 33 : public SyncManager::ChangeObserver, | 32 public syncable::TransactionObserver, |
| 34 public syncable::TransactionObserver, | 33 public base::NonThreadSafe { |
| 35 public base::NonThreadSafe { | |
| 36 public: | 34 public: |
| 37 JsMutationEventObserver(); | 35 JsMutationEventObserver(); |
| 38 | 36 |
| 39 ~JsMutationEventObserver() override; | 37 ~JsMutationEventObserver() override; |
| 40 | 38 |
| 41 base::WeakPtr<JsMutationEventObserver> AsWeakPtr(); | 39 base::WeakPtr<JsMutationEventObserver> AsWeakPtr(); |
| 42 | 40 |
| 43 void InvalidateWeakPtrs(); | 41 void InvalidateWeakPtrs(); |
| 44 | 42 |
| 45 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 43 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 const JsEventDetails& details); | 61 const JsEventDetails& details); |
| 64 | 62 |
| 65 base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_; | 63 base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_; |
| 66 | 64 |
| 67 DISALLOW_COPY_AND_ASSIGN(JsMutationEventObserver); | 65 DISALLOW_COPY_AND_ASSIGN(JsMutationEventObserver); |
| 68 }; | 66 }; |
| 69 | 67 |
| 70 } // namespace syncer | 68 } // namespace syncer |
| 71 | 69 |
| 72 #endif // COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_ | 70 #endif // COMPONENTS_SYNC_CORE_IMPL_JS_MUTATION_EVENT_OBSERVER_H_ |
| OLD | NEW |