[email protected] | 5407c38 | 2011-09-02 18:15:50 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | f45c5f3 | 2012-04-18 19:26:37 | [diff] [blame] | 5 | #include "webkit/support/gc_extension.h" |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 6 | |
[email protected] | 5407c38 | 2011-09-02 18:15:50 | [diff] [blame] | 7 | #include "v8/include/v8.h" |
8 | |||||
9 | const char kGCExtensionName[] = "v8/GCController"; | ||||
10 | |||||
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 11 | namespace extensions_v8 { |
12 | |||||
[email protected] | 5407c38 | 2011-09-02 18:15:50 | [diff] [blame] | 13 | // static |
[email protected] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 14 | v8::Extension* GCExtension::Get() { |
15 | v8::Extension* extension = new v8::Extension( | ||||
[email protected] | 5407c38 | 2011-09-02 18:15:50 | [diff] [blame] | 16 | 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] | 06533c0b | 2009-03-05 21:39:11 | [diff] [blame] | 24 | return extension; |
25 | } | ||||
26 | |||||
27 | } // namespace extensions_v8 |