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

Unified Diff: gin/per_isolate_data.h

Issue 194603003: gin: Add the concept of named and indexed interceptors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 9 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 | « gin/object_template_builder.cc ('k') | gin/per_isolate_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/per_isolate_data.h
diff --git a/gin/per_isolate_data.h b/gin/per_isolate_data.h
index 18c230bf112c78f666e333985beaaa67fad2762a..fbdbca7e0e429af4a17c18e95c12530bec2b0356 100644
--- a/gin/per_isolate_data.h
+++ b/gin/per_isolate_data.h
@@ -14,6 +14,10 @@
namespace gin {
+class IndexedPropertyInterceptor;
+class NamedPropertyInterceptor;
+class WrappableBase;
+
// There is one instance of PerIsolateData per v8::Isolate managed by Gin. This
// class stores all the Gin-related data that varies per isolate.
class GIN_EXPORT PerIsolateData {
@@ -38,6 +42,22 @@ class GIN_EXPORT PerIsolateData {
v8::Local<v8::ObjectTemplate> GetObjectTemplate(WrapperInfo* info);
v8::Local<v8::FunctionTemplate> GetFunctionTemplate(WrapperInfo* info);
+ // We maintain a map from Wrappable objects that derive from one of the
+ // interceptor interfaces to the interceptor interface pointers.
+ void SetIndexedPropertyInterceptor(WrappableBase* base,
+ IndexedPropertyInterceptor* interceptor);
+ void SetNamedPropertyInterceptor(WrappableBase* base,
+ NamedPropertyInterceptor* interceptor);
+
+ void ClearIndexedPropertyInterceptor(WrappableBase* base,
+ IndexedPropertyInterceptor* interceptor);
+ void ClearNamedPropertyInterceptor(WrappableBase* base,
+ NamedPropertyInterceptor* interceptor);
+
+ IndexedPropertyInterceptor* GetIndexedPropertyInterceptor(
+ WrappableBase* base);
+ NamedPropertyInterceptor* GetNamedPropertyInterceptor(WrappableBase* base);
+
v8::Isolate* isolate() { return isolate_; }
v8::ArrayBuffer::Allocator* allocator() { return allocator_; }
@@ -46,6 +66,10 @@ class GIN_EXPORT PerIsolateData {
WrapperInfo*, v8::Eternal<v8::ObjectTemplate> > ObjectTemplateMap;
typedef std::map<
WrapperInfo*, v8::Eternal<v8::FunctionTemplate> > FunctionTemplateMap;
+ typedef std::map<WrappableBase*, IndexedPropertyInterceptor*>
+ IndexedPropertyInterceptorMap;
+ typedef std::map<WrappableBase*, NamedPropertyInterceptor*>
+ NamedPropertyInterceptorMap;
// PerIsolateData doesn't actually own |isolate_|. Instead, the isolate is
// owned by the IsolateHolder, which also owns the PerIsolateData.
@@ -53,6 +77,8 @@ class GIN_EXPORT PerIsolateData {
v8::ArrayBuffer::Allocator* allocator_;
ObjectTemplateMap object_templates_;
FunctionTemplateMap function_templates_;
+ IndexedPropertyInterceptorMap indexed_interceptors_;
+ NamedPropertyInterceptorMap named_interceptors_;
DISALLOW_COPY_AND_ASSIGN(PerIsolateData);
};
« no previous file with comments | « gin/object_template_builder.cc ('k') | gin/per_isolate_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698