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

Unified Diff: src/extensions/gc-extension.cc

Issue 14075012: Expose the GC under a name that is less collision prone than window.gc. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: --expose-gc-as Created 7 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: src/extensions/gc-extension.cc
diff --git a/src/extensions/gc-extension.cc b/src/extensions/gc-extension.cc
index 813b9219bfec7eacd0638cf002c8abb368bba3d2..c42413be7fadd5580d2eed8c4c3616688944212e 100644
--- a/src/extensions/gc-extension.cc
+++ b/src/extensions/gc-extension.cc
@@ -50,7 +50,15 @@ v8::Handle<v8::Value> GCExtension::GC(const v8::Arguments& args) {
void GCExtension::Register() {
- static GCExtension gc_extension;
+ static char buffer[50];
+ if (FLAG_expose_gc_as != NULL && strlen(FLAG_expose_gc_as) != 0) {
+ snprintf(
+ buffer, sizeof(buffer), "native function %s();", FLAG_expose_gc_as);
+ } else {
+ snprintf(buffer, sizeof(buffer), "native function gc();");
+ }
+
+ static GCExtension gc_extension(buffer);
static v8::DeclareExtension declaration(&gc_extension);
}

Powered by Google App Engine
This is Rietveld 408576698