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

Unified Diff: chrome/browser/sync/js/js_mutation_event_observer.cc

Issue 8586014: [Sync] Replace uses of ObserverListThreadSafe with WeakHandles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 9 years, 1 month 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_mutation_event_observer.cc
diff --git a/chrome/browser/sync/js/js_mutation_event_observer.cc b/chrome/browser/sync/js/js_mutation_event_observer.cc
index 5087a23ad0c12548f29efecca3cfe3a4e8053b15..2c323d1e054028941ec11b5ba9d4f1a81a397721 100644
--- a/chrome/browser/sync/js/js_mutation_event_observer.cc
+++ b/chrome/browser/sync/js/js_mutation_event_observer.cc
@@ -15,12 +15,21 @@
namespace browser_sync {
-JsMutationEventObserver::JsMutationEventObserver() {}
+JsMutationEventObserver::JsMutationEventObserver()
+ : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {}
JsMutationEventObserver::~JsMutationEventObserver() {
DCHECK(non_thread_safe_.CalledOnValidThread());
}
+base::WeakPtr<JsMutationEventObserver> JsMutationEventObserver::AsWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
+void JsMutationEventObserver::InvalidateWeakPtrs() {
+ weak_ptr_factory_.InvalidateWeakPtrs();
+}
+
void JsMutationEventObserver::SetJsEventHandler(
const WeakHandle<JsEventHandler>& event_handler) {
event_handler_ = event_handler;
« no previous file with comments | « chrome/browser/sync/js/js_mutation_event_observer.h ('k') | chrome/browser/sync/notifier/non_blocking_invalidation_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698