Index: gin/test/gc.cc |
diff --git a/gin/modules/console.cc b/gin/test/gc.cc |
similarity index 50% |
copy from gin/modules/console.cc |
copy to gin/test/gc.cc |
index d172373f01df2a0a2d194bfbc866e65f17015087..1ad6cf2576c2bb85b1fbca340d0bd3739dc350c5 100644 |
--- a/gin/modules/console.cc |
+++ b/gin/test/gc.cc |
@@ -1,45 +1,35 @@ |
-// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2014 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 "gin/modules/console.h" |
+#include "gin/test/gc.h" |
-#include <iostream> |
- |
-#include "base/strings/string_util.h" |
+#include "base/bind.h" |
+#include "base/logging.h" |
#include "gin/arguments.h" |
#include "gin/converter.h" |
+#include "gin/function_template.h" |
#include "gin/object_template_builder.h" |
#include "gin/per_isolate_data.h" |
#include "gin/public/wrapper_info.h" |
- |
-using v8::ObjectTemplate; |
+#include "gin/wrappable.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
namespace gin { |
namespace { |
- |
-void Log(Arguments* args) { |
- std::vector<std::string> messages; |
- if (!args->GetRemaining(&messages)) { |
- args->ThrowError(); |
- return; |
- } |
- std::cout << JoinString(messages, ' ') << std::endl; |
-} |
- |
WrapperInfo g_wrapper_info = { kEmbedderNativeGin }; |
- |
} // namespace |
-const char Console::kModuleName[] = "console"; |
+const char GC::kModuleName[] = "gc"; |
-v8::Local<v8::Value> Console::GetModule(v8::Isolate* isolate) { |
+v8::Local<v8::Value> GC::GetModule(v8::Isolate* isolate) { |
PerIsolateData* data = PerIsolateData::From(isolate); |
- v8::Local<ObjectTemplate> templ = data->GetObjectTemplate(&g_wrapper_info); |
+ v8::Local<v8::ObjectTemplate> templ = |
+ data->GetObjectTemplate(&g_wrapper_info); |
if (templ.IsEmpty()) { |
templ = ObjectTemplateBuilder(isolate) |
- .SetMethod("log", Log) |
+ .SetMethod("collectGarbage", v8::V8::LowMemoryNotification) |
.Build(); |
data->SetObjectTemplate(&g_wrapper_info, templ); |
} |