Chromium Code Reviews| 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> |