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

Unified Diff: src/handles.h

Issue 2622503002: include fixing: api.h shouldn't include objects-inl.h (Closed)
Patch Set: static type check Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/global-handles.cc ('k') | src/i18n.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index 2c98209a1d5faf8047cda9e5be4a637a077057b4..8664a3ff890a07048936147efde2d305bcba0c70 100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -5,6 +5,8 @@
#ifndef V8_HANDLES_H_
#define V8_HANDLES_H_
+#include <type_traits>
+
#include "include/v8.h"
#include "src/base/functional.h"
#include "src/base/macros.h"
@@ -91,11 +93,10 @@ class Handle final : public HandleBase {
public:
V8_INLINE explicit Handle(T** location = nullptr)
: HandleBase(reinterpret_cast<Object**>(location)) {
- Object* a = nullptr;
- T* b = nullptr;
- a = b; // Fake assignment to enforce type checks.
- USE(a);
+ // Type check:
+ static_assert(std::is_base_of<Object, T>::value, "static type violation");
}
+
V8_INLINE explicit Handle(T* object) : Handle(object, object->GetIsolate()) {}
V8_INLINE Handle(T* object, Isolate* isolate) : HandleBase(object, isolate) {}
« no previous file with comments | « src/global-handles.cc ('k') | src/i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698