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

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

Issue 2843603002: Move ScriptWrappable and dependencies to platform/bindings (Closed)
Patch Set: Rebase and try again Created 3 years, 8 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/bindings/core/v8/ScopedPersistent.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
index 51ffd6ea861a1c3388a742e9d4917ccbfa08835a..dbca055dc6d12f768a4fb31ab577eddd3a1b500e 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
@@ -28,81 +28,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ScopedPersistent_h
-#define ScopedPersistent_h
-
-#include <memory>
-
-#include "bindings/core/v8/ScriptWrappableVisitor.h"
-#include "platform/wtf/Allocator.h"
-#include "platform/wtf/Noncopyable.h"
-#include "v8/include/v8.h"
-
-namespace blink {
-
-template <typename T>
-class ScopedPersistent {
- USING_FAST_MALLOC(ScopedPersistent);
- WTF_MAKE_NONCOPYABLE(ScopedPersistent);
-
- public:
- ScopedPersistent() {}
-
- ScopedPersistent(v8::Isolate* isolate, v8::Local<T> handle)
- : handle_(isolate, handle) {}
-
- ScopedPersistent(v8::Isolate* isolate, v8::MaybeLocal<T> maybe) {
- v8::Local<T> local;
- if (maybe.ToLocal(&local))
- handle_.Reset(isolate, local);
- }
-
- virtual ~ScopedPersistent() { Clear(); }
-
- ALWAYS_INLINE v8::Local<T> NewLocal(v8::Isolate* isolate) const {
- return v8::Local<T>::New(isolate, handle_);
- }
-
- // If you don't need to get weak callback, use setPhantom instead.
- // setPhantom is faster than setWeak.
- template <typename P>
- void SetWeak(P* parameters,
- void (*callback)(const v8::WeakCallbackInfo<P>&),
- v8::WeakCallbackType type = v8::WeakCallbackType::kParameter) {
- handle_.SetWeak(parameters, callback, type);
- }
-
- // Turns this handle into a weak phantom handle without
- // finalization callback.
- void SetPhantom() { handle_.SetWeak(); }
-
- void ClearWeak() { handle_.template ClearWeak<void>(); }
-
- bool IsEmpty() const { return handle_.IsEmpty(); }
- bool IsWeak() const { return handle_.IsWeak(); }
-
- virtual void Set(v8::Isolate* isolate, v8::Local<T> handle) {
- handle_.Reset(isolate, handle);
- }
-
- // Note: This is clear in the std::unique_ptr sense, not the v8::Local sense.
- void Clear() { handle_.Reset(); }
-
- bool operator==(const ScopedPersistent<T>& other) {
- return handle_ == other.handle_;
- }
-
- template <class S>
- bool operator==(const v8::Local<S> other) const {
- return handle_ == other;
- }
-
- ALWAYS_INLINE v8::Persistent<T>& Get() { return handle_; }
-
- private:
- v8::Persistent<T> handle_;
-};
-
-} // namespace blink
-
-#endif // ScopedPersistent_h
+// This file has been moved to platform/bindings/ScopedPersistent.h.
+// TODO(adithyas): Remove this file.
+#include "platform/bindings/ScopedPersistent.h"

Powered by Google App Engine
This is Rietveld 408576698