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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ScopedPersistent_h 31 #ifndef ScopedPersistent_h
32 #define ScopedPersistent_h 32 #define ScopedPersistent_h
33 33
34 #include "wtf/Allocator.h" 34 #include "wtf/Allocator.h"
35 #include "wtf/Noncopyable.h" 35 #include "wtf/Noncopyable.h"
36 #include <memory>
36 #include <v8.h> 37 #include <v8.h>
37 38
38 namespace blink { 39 namespace blink {
39 40
40 template<typename T> 41 template<typename T>
41 class ScopedPersistent { 42 class ScopedPersistent {
42 USING_FAST_MALLOC(ScopedPersistent); 43 USING_FAST_MALLOC(ScopedPersistent);
43 WTF_MAKE_NONCOPYABLE(ScopedPersistent); 44 WTF_MAKE_NONCOPYABLE(ScopedPersistent);
44 public: 45 public:
45 ScopedPersistent() { } 46 ScopedPersistent() { }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 86 }
86 87
87 bool isEmpty() const { return m_handle.IsEmpty(); } 88 bool isEmpty() const { return m_handle.IsEmpty(); }
88 bool isWeak() const { return m_handle.IsWeak(); } 89 bool isWeak() const { return m_handle.IsWeak(); }
89 90
90 void set(v8::Isolate* isolate, v8::Local<T> handle) 91 void set(v8::Isolate* isolate, v8::Local<T> handle)
91 { 92 {
92 m_handle.Reset(isolate, handle); 93 m_handle.Reset(isolate, handle);
93 } 94 }
94 95
95 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. 96 // Note: This is clear in the std::unique_ptr sense, not the v8::Handle sens e.
96 void clear() 97 void clear()
97 { 98 {
98 m_handle.Reset(); 99 m_handle.Reset();
99 } 100 }
100 101
101 void setReference(const v8::Persistent<v8::Object>& parent, v8::Isolate* iso late) 102 void setReference(const v8::Persistent<v8::Object>& parent, v8::Isolate* iso late)
102 { 103 {
103 isolate->SetReference(parent, m_handle); 104 isolate->SetReference(parent, m_handle);
104 } 105 }
105 106
(...skipping 14 matching lines...) Expand all
120 } 121 }
121 122
122 123
123 private: 124 private:
124 v8::Persistent<T> m_handle; 125 v8::Persistent<T> m_handle;
125 }; 126 };
126 127
127 } // namespace blink 128 } // namespace blink
128 129
129 #endif // ScopedPersistent_h 130 #endif // ScopedPersistent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698