cc: Stretch textures by .5 texels to prevent out of bounds sampling
[chromium-blink-merge.git] / sync / internal_api / js_mutation_event_observer.h
blob9d233515031bd15705a77b6cca713b17ede9ef14
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
3 // found in the LICENSE file.
5 #ifndef SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_
6 #define SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/non_thread_safe.h"
14 #include "sync/base/sync_export.h"
15 #include "sync/internal_api/public/sync_manager.h"
16 #include "sync/internal_api/public/util/weak_handle.h"
17 #include "sync/syncable/transaction_observer.h"
19 namespace tracked_objects {
20 class Location;
21 } // namespace tracked_objects
23 namespace syncer {
25 class JsEventDetails;
26 class JsEventHandler;
28 // Observes all change- and transaction-related events and routes a
29 // summarized version to a JsEventHandler.
30 class SYNC_EXPORT_PRIVATE JsMutationEventObserver
31 : public SyncManager::ChangeObserver,
32 public syncable::TransactionObserver,
33 public base::NonThreadSafe {
34 public:
35 JsMutationEventObserver();
37 virtual ~JsMutationEventObserver();
39 base::WeakPtr<JsMutationEventObserver> AsWeakPtr();
41 void InvalidateWeakPtrs();
43 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler);
45 // SyncManager::ChangeObserver implementation.
46 virtual void OnChangesApplied(
47 ModelType model_type,
48 int64 write_transaction_id,
49 const ImmutableChangeRecordList& changes) OVERRIDE;
50 virtual void OnChangesComplete(ModelType model_type) OVERRIDE;
52 // syncable::TransactionObserver implementation.
53 virtual void OnTransactionWrite(
54 const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
55 ModelTypeSet models_with_changes) OVERRIDE;
57 private:
58 base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_;
59 WeakHandle<JsEventHandler> event_handler_;
61 void HandleJsEvent(
62 const tracked_objects::Location& from_here,
63 const std::string& name, const JsEventDetails& details);
65 DISALLOW_COPY_AND_ASSIGN(JsMutationEventObserver);
68 } // namespace syncer
70 #endif // SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_