OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 DataPersistent_h | 5 #ifndef DataPersistent_h |
6 #define DataPersistent_h | 6 #define DataPersistent_h |
7 | 7 |
| 8 #include <memory> |
8 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
9 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
10 #include "wtf/PtrUtil.h" | 11 #include "wtf/PtrUtil.h" |
11 #include <memory> | |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // DataPersistent<T> provides the copy-on-modify behavior of DataRef<>, | 15 // DataPersistent<T> provides the copy-on-modify behavior of DataRef<>, |
16 // but for Persistent<> heap references. | 16 // but for Persistent<> heap references. |
17 // | 17 // |
18 // That is, the DataPersistent<T> copy assignment, |a = b;|, makes |a| | 18 // That is, the DataPersistent<T> copy assignment, |a = b;|, makes |a| |
19 // share a reference to the T object that |b| holds until |a| is mutated | 19 // share a reference to the T object that |b| holds until |a| is mutated |
20 // and access() on it is called. Or, dually, if |b| is mutated after the | 20 // and access() on it is called. Or, dually, if |b| is mutated after the |
21 // assignment that mutation isn't observable to |a| but will be performed | 21 // assignment that mutation isn't observable to |a| but will be performed |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 private: | 80 private: |
81 // Reduce size of DataPersistent<> by delaying creation of Persistent<>. | 81 // Reduce size of DataPersistent<> by delaying creation of Persistent<>. |
82 std::unique_ptr<Persistent<T>> m_data; | 82 std::unique_ptr<Persistent<T>> m_data; |
83 unsigned m_ownCopy : 1; | 83 unsigned m_ownCopy : 1; |
84 }; | 84 }; |
85 | 85 |
86 } // namespace blink | 86 } // namespace blink |
87 | 87 |
88 #endif // DataPersistent_h | 88 #endif // DataPersistent_h |
OLD | NEW |