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

Unified Diff: third_party/WebKit/Source/platform/heap/Persistent.h

Issue 2204183002: Prepare CompositorWorker for per thread heap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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: third_party/WebKit/Source/platform/heap/Persistent.h
diff --git a/third_party/WebKit/Source/platform/heap/Persistent.h b/third_party/WebKit/Source/platform/heap/Persistent.h
index 37399f545ca475db1e18cd29ce91cdf00fed7e81..b74ebd51e6e85a0b5faef621ae5f58a2e8ccd56b 100644
--- a/third_party/WebKit/Source/platform/heap/Persistent.h
+++ b/third_party/WebKit/Source/platform/heap/Persistent.h
@@ -114,6 +114,7 @@ public:
operator T*() const { return m_raw; }
T* operator->() const { return *this; }
T* get() const { return m_raw; }
+ T* getInternal() const { return m_raw; }
template<typename U>
PersistentBase& operator=(U* other)
@@ -471,6 +472,13 @@ public:
Parent::operator=(other);
return *this;
}
+
+ template<typename U>
+ static CrossThreadPersistent<U> protectWeak(const PersistentBase<U, WeakPersistentConfiguration, CrossThreadPersistentConfiguration>& other)
haraken 2016/09/12 11:45:09 Can we drop the changes in this file?
+ {
+ CrossThreadPersistentRegion::LockScope persistentLock(ProcessHeap::crossThreadPersistentRegion());
+ return CrossThreadPersistent<U>(other.getInternal());
+ }
};
// Combines the behavior of CrossThreadPersistent and WeakPersistent.
@@ -520,6 +528,32 @@ public:
Parent::operator=(other);
return *this;
}
+
+ T& operator*() const
haraken 2016/09/12 11:45:09 As discussed offline, we should try to remove Cros
keishi 2016/09/13 03:12:42 Sorry. Done.
+ {
+ DCHECK(!Parent::get() || &ThreadState::fromObject(Parent::get())->heap() == &ThreadState::current()->heap());
+ return Parent::operator*();
+ }
+ explicit operator bool() const
+ {
+ DCHECK(!Parent::get() || &ThreadState::fromObject(Parent::get())->heap() == &ThreadState::current()->heap());
+ return Parent::operator bool();
+ }
+ operator T*() const
+ {
+ DCHECK(!Parent::get() || &ThreadState::fromObject(Parent::get())->heap() == &ThreadState::current()->heap());
+ return Parent::operator T*();
+ }
+ T* operator->() const
+ {
+ DCHECK(!Parent::get() || &ThreadState::fromObject(Parent::get())->heap() == &ThreadState::current()->heap());
+ return Parent::operator->();
+ }
+ T* get() const
+ {
+ DCHECK(!Parent::get() || &ThreadState::fromObject(Parent::get())->heap() == &ThreadState::current()->heap());
+ return Parent::get();
+ }
};
template<typename Collection>

Powered by Google App Engine
This is Rietveld 408576698