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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/TraceWrapperV8Reference.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/TraceWrapperV8Reference.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/TraceWrapperV8Reference.h b/third_party/WebKit/Source/bindings/core/v8/TraceWrapperV8Reference.h
index 85a1882f3fc94dd6cc8d2094c641fec73ce15a1e..e14518dc645e603f27c9db7e1a4399bfc8b1a0c7 100644
--- a/third_party/WebKit/Source/bindings/core/v8/TraceWrapperV8Reference.h
+++ b/third_party/WebKit/Source/bindings/core/v8/TraceWrapperV8Reference.h
@@ -2,74 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef TraceWrapperV8Reference_h
-#define TraceWrapperV8Reference_h
-
-#include "bindings/core/v8/ScriptWrappableVisitor.h"
-
-namespace blink {
-
-/**
- * TraceWrapperV8Reference is used to trace from Blink to V8. If wrapper
- * tracing is disabled, the reference is a weak v8::Persistent. Otherwise,
- * the reference is (strongly) traced by wrapper tracing.
- *
- * TODO(mlippautz): Use a better handle type than v8::Persistent.
- */
-template <typename T>
-class TraceWrapperV8Reference {
- public:
- explicit TraceWrapperV8Reference(void* parent) : parent_(parent) {}
-
- TraceWrapperV8Reference(v8::Isolate* isolate,
- void* parent,
- v8::Local<T> handle)
- : parent_(parent) {
- InternalSet(isolate, handle);
- handle_.SetWeak();
- }
-
- ~TraceWrapperV8Reference() { Clear(); }
-
- void Set(v8::Isolate* isolate, v8::Local<T> handle) {
- InternalSet(isolate, handle);
- handle_.SetWeak();
- }
-
- template <typename P>
- void Set(v8::Isolate* isolate,
- v8::Local<T> handle,
- P* parameters,
- void (*callback)(const v8::WeakCallbackInfo<P>&),
- v8::WeakCallbackType type = v8::WeakCallbackType::kParameter) {
- InternalSet(isolate, handle);
- handle_.SetWeak(parameters, callback, type);
- }
-
- ALWAYS_INLINE v8::Local<T> NewLocal(v8::Isolate* isolate) const {
- return v8::Local<T>::New(isolate, handle_);
- }
-
- bool IsEmpty() const { return handle_.IsEmpty(); }
- void Clear() { handle_.Reset(); }
- ALWAYS_INLINE v8::Persistent<T>& Get() { return handle_; }
-
- template <typename S>
- const TraceWrapperV8Reference<S>& Cast() const {
- return reinterpret_cast<const TraceWrapperV8Reference<S>&>(
- const_cast<const TraceWrapperV8Reference<T>&>(*this));
- }
-
- private:
- inline void InternalSet(v8::Isolate* isolate, v8::Local<T> handle) {
- handle_.Reset(isolate, handle);
- ScriptWrappableVisitor::WriteBarrier(isolate, parent_, &Cast<v8::Value>());
- }
-
- v8::Persistent<T> handle_;
- void* parent_;
-};
-
-} // namespace blink
-
-#endif // TraceWrapperV8Reference_h
+// This file has been moved to platform/bindings/TraceWrapperV8Reference.h.
+// TODO(adithyas): Remove this file.
+#include "platform/bindings/TraceWrapperV8Reference.h"

Powered by Google App Engine
This is Rietveld 408576698