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

Unified Diff: include/v8.h

Issue 1542943002: [proxies] Expose proxies in the API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2015-12-17_JSProxy_d8_printing_1530293004
Patch Set: adressing comments Created 5 years 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 | « no previous file | src/api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 1e97776aab008f35d6cc23a5fbc468327f9d68d8..70a3a596d82f7b474f6c4aa29e97cdba8dfce925 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -92,6 +92,7 @@ class ObjectTemplate;
class Platform;
class Primitive;
class Promise;
+class Proxy;
class RawOperationDescriptor;
class Script;
class SharedArrayBuffer;
@@ -1954,6 +1955,11 @@ class V8_EXPORT Value : public Data {
*/
bool IsSharedArrayBuffer() const;
+ /**
+ * Returns true if this value is a JavaScript Proxy.
+ */
+ bool IsProxy() const;
+
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
Local<Context> context) const;
@@ -3376,6 +3382,32 @@ class V8_EXPORT Promise : public Object {
};
+/**
+ * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition,
+ * 26.2.1).
+ */
+class V8_EXPORT Proxy : public Object {
+ public:
+ Local<Object> GetTarget();
+ Local<Value> GetHandler();
+ bool IsRevoked();
+ void Revoke();
+
+ /**
+ * Creates a new empty Map.
+ */
+ static MaybeLocal<Proxy> New(Local<Context> context,
+ Local<Object> local_target,
+ Local<Object> local_handler);
+
+ V8_INLINE static Proxy* Cast(Value* obj);
+
+ private:
+ Proxy();
+ static void CheckCast(Value* obj);
+};
+
+
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
// The number of required internal fields can be defined by embedder.
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
@@ -8047,6 +8079,14 @@ Promise* Promise::Cast(v8::Value* value) {
}
+Proxy* Proxy::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<Proxy*>(value);
+}
+
+
Promise::Resolver* Promise::Resolver::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698