| 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 SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_ | 5 #ifndef SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_ |
| 6 #define SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_ | 6 #define SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // Observes all change- and transaction-related events and routes a | 28 // Observes all change- and transaction-related events and routes a |
| 29 // summarized version to a JsEventHandler. | 29 // summarized version to a JsEventHandler. |
| 30 class SYNC_EXPORT_PRIVATE JsMutationEventObserver | 30 class SYNC_EXPORT_PRIVATE JsMutationEventObserver |
| 31 : public SyncManager::ChangeObserver, | 31 : public SyncManager::ChangeObserver, |
| 32 public syncable::TransactionObserver, | 32 public syncable::TransactionObserver, |
| 33 public base::NonThreadSafe { | 33 public base::NonThreadSafe { |
| 34 public: | 34 public: |
| 35 JsMutationEventObserver(); | 35 JsMutationEventObserver(); |
| 36 | 36 |
| 37 virtual ~JsMutationEventObserver(); | 37 ~JsMutationEventObserver() override; |
| 38 | 38 |
| 39 base::WeakPtr<JsMutationEventObserver> AsWeakPtr(); | 39 base::WeakPtr<JsMutationEventObserver> AsWeakPtr(); |
| 40 | 40 |
| 41 void InvalidateWeakPtrs(); | 41 void InvalidateWeakPtrs(); |
| 42 | 42 |
| 43 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); | 43 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler); |
| 44 | 44 |
| 45 // SyncManager::ChangeObserver implementation. | 45 // SyncManager::ChangeObserver implementation. |
| 46 virtual void OnChangesApplied( | 46 void OnChangesApplied(ModelType model_type, |
| 47 ModelType model_type, | 47 int64 write_transaction_id, |
| 48 int64 write_transaction_id, | 48 const ImmutableChangeRecordList& changes) override; |
| 49 const ImmutableChangeRecordList& changes) override; | 49 void OnChangesComplete(ModelType model_type) override; |
| 50 virtual void OnChangesComplete(ModelType model_type) override; | |
| 51 | 50 |
| 52 // syncable::TransactionObserver implementation. | 51 // syncable::TransactionObserver implementation. |
| 53 virtual void OnTransactionWrite( | 52 void OnTransactionWrite( |
| 54 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 53 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
| 55 ModelTypeSet models_with_changes) override; | 54 ModelTypeSet models_with_changes) override; |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 WeakHandle<JsEventHandler> event_handler_; | 57 WeakHandle<JsEventHandler> event_handler_; |
| 59 | 58 |
| 60 void HandleJsEvent( | 59 void HandleJsEvent( |
| 61 const tracked_objects::Location& from_here, | 60 const tracked_objects::Location& from_here, |
| 62 const std::string& name, const JsEventDetails& details); | 61 const std::string& name, const JsEventDetails& details); |
| 63 | 62 |
| 64 base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_; | 63 base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_; |
| 65 | 64 |
| 66 DISALLOW_COPY_AND_ASSIGN(JsMutationEventObserver); | 65 DISALLOW_COPY_AND_ASSIGN(JsMutationEventObserver); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 } // namespace syncer | 68 } // namespace syncer |
| 70 | 69 |
| 71 #endif // SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_ | 70 #endif // SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_ |
| OLD | NEW |