OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/shell/renderer/gc_extension.h" | |
6 | |
7 #include "v8/include/v8.h" | |
8 | |
9 const char kGCExtensionName[] = "v8/GCController"; | |
10 | |
11 namespace extensions_v8 { | |
12 | |
13 // static | |
14 v8::Extension* GCExtension::Get() { | |
15 v8::Extension* extension = new v8::Extension( | |
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 " GCController.minorCollect =" | |
24 " function() {if (v8_gc) v8_gc(true); };" | |
25 " })();"); | |
26 return extension; | |
27 } | |
28 | |
29 } // namespace extensions_v8 | |
OLD | NEW |