blob: 44c3e112fc5313db1cbcd3709d0edd7dc5cdab85 [file] [log] [blame]
[email protected]5407c382011-09-02 18:15:501// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]06533c0b2009-03-05 21:39:112// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]f45c5f32012-04-18 19:26:375#include "webkit/support/gc_extension.h"
[email protected]06533c0b2009-03-05 21:39:116
[email protected]5407c382011-09-02 18:15:507#include "v8/include/v8.h"
8
9const char kGCExtensionName[] = "v8/GCController";
10
[email protected]06533c0b2009-03-05 21:39:1111namespace extensions_v8 {
12
[email protected]5407c382011-09-02 18:15:5013// static
[email protected]06533c0b2009-03-05 21:39:1114v8::Extension* GCExtension::Get() {
15 v8::Extension* extension = new v8::Extension(
[email protected]5407c382011-09-02 18:15:5016 kGCExtensionName,
17 "(function () {"
18 " var v8_gc;"
19 " if (gc) v8_gc = gc;"
20 " GCController = new Object();"
21 " GCController.collect ="
22 " function() {if (v8_gc) v8_gc(); };"
23 " })();");
[email protected]06533c0b2009-03-05 21:39:1124 return extension;
25}
26
27} // namespace extensions_v8