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

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

Issue 806693004: Use new phantom handles for ScriptWrappable. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Start using V8 phantom handles in Blink Created 5 years, 11 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 56 {
57 return v8::Local<T>::New(isolate, m_handle); 57 return v8::Local<T>::New(isolate, m_handle);
58 } 58 }
59 59
60 template<typename P> 60 template<typename P>
61 void setWeak(P* parameters, void (*callback)(const v8::WeakCallbackData<T, P >&)) 61 void setWeak(P* parameters, void (*callback)(const v8::WeakCallbackData<T, P >&))
62 { 62 {
63 m_handle.SetWeak(parameters, callback); 63 m_handle.SetWeak(parameters, callback);
64 } 64 }
65 65
66 template<typename P>
67 void setPhantom(P* parameters, void (*callback)(const v8::PhantomCallbackDat a<P>&))
68 {
69 m_handle.SetPhantom(parameters, callback);
70 }
71
66 bool isEmpty() const { return m_handle.IsEmpty(); } 72 bool isEmpty() const { return m_handle.IsEmpty(); }
67 bool isWeak() const { return m_handle.IsWeak(); } 73 bool isWeak() const { return m_handle.IsWeak(); }
68 74
69 void set(v8::Isolate* isolate, v8::Handle<T> handle) 75 void set(v8::Isolate* isolate, v8::Handle<T> handle)
70 { 76 {
71 m_handle.Reset(isolate, handle); 77 m_handle.Reset(isolate, handle);
72 } 78 }
73 79
74 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense. 80 // Note: This is clear in the OwnPtr sense, not the v8::Handle sense.
75 void clear() 81 void clear()
(...skipping 20 matching lines...) Expand all
96 { 102 {
97 return m_handle; 103 return m_handle;
98 } 104 }
99 105
100 v8::Persistent<T> m_handle; 106 v8::Persistent<T> m_handle;
101 }; 107 };
102 108
103 } // namespace blink 109 } // namespace blink
104 110
105 #endif // ScopedPersistent_h 111 #endif // ScopedPersistent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698