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

Unified Diff: gin/per_isolate_data.cc

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/per_isolate_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/per_isolate_data.cc
diff --git a/gin/per_isolate_data.cc b/gin/per_isolate_data.cc
index 7de9047abe8b17b7f790e8eb8491d1b597c8f894..b3f24abe00d97dcd23ca52133a5fd0d4acdc6740 100644
--- a/gin/per_isolate_data.cc
+++ b/gin/per_isolate_data.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/logging.h"
#include "gin/per_isolate_data.h"
#include "gin/public/gin_embedders.h"
@@ -55,4 +56,54 @@ v8::Local<v8::FunctionTemplate> PerIsolateData::GetFunctionTemplate(
return it->second.Get(isolate_);
}
+void PerIsolateData::SetIndexedPropertyInterceptor(
+ WrappableBase* base,
+ IndexedPropertyInterceptor* interceptor) {
+ indexed_interceptors_[base] = interceptor;
+}
+
+void PerIsolateData::SetNamedPropertyInterceptor(
+ WrappableBase* base,
+ NamedPropertyInterceptor* interceptor) {
+ named_interceptors_[base] = interceptor;
+}
+
+void PerIsolateData::ClearIndexedPropertyInterceptor(
+ WrappableBase* base,
+ IndexedPropertyInterceptor* interceptor) {
+ IndexedPropertyInterceptorMap::iterator it = indexed_interceptors_.find(base);
+ if (it != indexed_interceptors_.end())
+ indexed_interceptors_.erase(it);
+ else
+ NOTREACHED();
+}
+
+void PerIsolateData::ClearNamedPropertyInterceptor(
+ WrappableBase* base,
+ NamedPropertyInterceptor* interceptor) {
+ NamedPropertyInterceptorMap::iterator it = named_interceptors_.find(base);
+ if (it != named_interceptors_.end())
+ named_interceptors_.erase(it);
+ else
+ NOTREACHED();
+}
+
+IndexedPropertyInterceptor* PerIsolateData::GetIndexedPropertyInterceptor(
+ WrappableBase* base) {
+ IndexedPropertyInterceptorMap::iterator it = indexed_interceptors_.find(base);
+ if (it != indexed_interceptors_.end())
+ return it->second;
+ else
+ return NULL;
+}
+
+NamedPropertyInterceptor* PerIsolateData::GetNamedPropertyInterceptor(
+ WrappableBase* base) {
+ NamedPropertyInterceptorMap::iterator it = named_interceptors_.find(base);
+ if (it != named_interceptors_.end())
+ return it->second;
+ else
+ return NULL;
+}
+
} // namespace gin
« no previous file with comments | « gin/per_isolate_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698