summaryrefslogtreecommitdiffstats
path: root/webkit/extensions/v8/gc_extension.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/extensions/v8/gc_extension.cc')
-rw-r--r--webkit/extensions/v8/gc_extension.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/webkit/extensions/v8/gc_extension.cc b/webkit/extensions/v8/gc_extension.cc
new file mode 100644
index 0000000..fb3e978
--- /dev/null
+++ b/webkit/extensions/v8/gc_extension.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/extensions/v8/gc_extension.h"
+
+namespace extensions_v8 {
+
+const char* kGCExtensionName = "v8/GCController";
+
+v8::Extension* GCExtension::Get() {
+ v8::Extension* extension = new v8::Extension(
+ kGCExtensionName,
+ "(function () {"
+ " var v8_gc;"
+ " if (gc) v8_gc = gc;"
+ " GCController = new Object();"
+ " GCController.collect ="
+ " function() {if (v8_gc) v8_gc(); };"
+ " })();");
+ return extension;
+}
+
+} // namespace extensions_v8
+