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.
5 #include "mojo/apps/js/bindings/threading.h"
7 #include "base/message_loop/message_loop.h"
8 #include "gin/object_template_builder.h"
9 #include "gin/per_isolate_data.h"
10 #include "mojo/bindings/js/handle.h"
18 base::MessageLoop::current()->QuitNow();
21 gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
25 const char Threading::kModuleName[] = "mojo/apps/js/bindings/threading";
27 v8::Local<v8::Value> Threading::GetModule(v8::Isolate* isolate) {
28 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
29 v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
32 if (templ.IsEmpty()) {
33 templ = gin::ObjectTemplateBuilder(isolate)
34 .SetMethod("quit", Quit)
37 data->SetObjectTemplate(&g_wrapper_info, templ);
40 return templ->NewInstance();
43 Threading::Threading() {