cc: Invalidate eviction cache in cases where we remove/add tiles.
[chromium-blink-merge.git] / gin / test / gc.cc
blob4cd67e199aba1b9323de4b4a48e181fe13f797ca
1 // Copyright 2014 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.
5 #include "gin/test/gc.h"
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "gin/arguments.h"
10 #include "gin/converter.h"
11 #include "gin/function_template.h"
12 #include "gin/object_template_builder.h"
13 #include "gin/per_isolate_data.h"
14 #include "gin/public/wrapper_info.h"
15 #include "gin/wrappable.h"
16 #include "testing/gtest/include/gtest/gtest.h"
18 namespace gin {
20 namespace {
21 WrapperInfo g_wrapper_info = { kEmbedderNativeGin };
22 } // namespace
24 const char GC::kModuleName[] = "gc";
26 v8::Local<v8::Value> GC::GetModule(v8::Isolate* isolate) {
27 PerIsolateData* data = PerIsolateData::From(isolate);
28 v8::Local<v8::ObjectTemplate> templ =
29 data->GetObjectTemplate(&g_wrapper_info);
30 if (templ.IsEmpty()) {
31 templ = ObjectTemplateBuilder(isolate)
32 .SetMethod("collectGarbage",
33 base::Bind(&v8::Isolate::LowMemoryNotification,
34 base::Unretained(isolate)))
35 .Build();
36 data->SetObjectTemplate(&g_wrapper_info, templ);
38 return templ->NewInstance();
41 } // namespace gin