Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / mojo / apps / js / mojo_runner_delegate.cc
index c160f16..59e9d7c 100644 (file)
 #include "gin/modules/module_registry.h"
 #include "gin/modules/timer.h"
 #include "gin/try_catch.h"
-#include "mojo/apps/js/bindings/core.h"
 #include "mojo/apps/js/bindings/gl/module.h"
 #include "mojo/apps/js/bindings/monotonic_clock.h"
-#include "mojo/apps/js/bindings/support.h"
 #include "mojo/apps/js/bindings/threading.h"
+#include "mojo/bindings/js/core.h"
+#include "mojo/bindings/js/handle.h"
+#include "mojo/bindings/js/support.h"
+#include "mojo/bindings/js/unicode.h"
 
 namespace mojo {
 namespace apps {
@@ -35,11 +37,12 @@ std::vector<base::FilePath> GetModuleSearchPaths() {
 void StartCallback(base::WeakPtr<gin::Runner> runner,
                    MojoHandle pipe,
                    v8::Handle<v8::Value> module) {
-  v8::Isolate* isolate = runner->isolate();
+  v8::Isolate* isolate = runner->GetContextHolder()->isolate();
   v8::Handle<v8::Function> start;
   CHECK(gin::ConvertFromV8(isolate, module, &start));
 
-  v8::Handle<v8::Value> args[] = { gin::ConvertToV8(isolate, pipe) };
+  v8::Handle<v8::Value> args[] = {
+      gin::ConvertToV8(isolate, Handle(pipe)) };
   runner->Call(start, runner->global(), 1, args);
 }
 
@@ -51,7 +54,8 @@ MojoRunnerDelegate::MojoRunnerDelegate()
   AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
   AddBuiltinModule(js::Core::kModuleName, js::Core::GetModule);
   AddBuiltinModule(js::Support::kModuleName, js::Support::GetModule);
-  AddBuiltinModule(mojo::js::gl::kModuleName, mojo::js::gl::GetModule);
+  AddBuiltinModule(js::Unicode::kModuleName, js::Unicode::GetModule);
+  AddBuiltinModule(js::gl::kModuleName, js::gl::GetModule);
   AddBuiltinModule(MonotonicClock::kModuleName, MonotonicClock::GetModule);
   AddBuiltinModule(Threading::kModuleName, Threading::GetModule);
 }
@@ -63,13 +67,14 @@ void MojoRunnerDelegate::Start(gin::Runner* runner,
                                MojoHandle pipe,
                                const std::string& module) {
   gin::Runner::Scope scope(runner);
-  gin::ModuleRegistry* registry = gin::ModuleRegistry::From(runner->context());
-  registry->LoadModule(runner->isolate(), module,
+  gin::ModuleRegistry* registry =
+      gin::ModuleRegistry::From(runner->GetContextHolder()->context());
+  registry->LoadModule(runner->GetContextHolder()->isolate(), module,
                        base::Bind(StartCallback, runner->GetWeakPtr(), pipe));
   AttemptToLoadMoreModules(runner);
 }
 
-void MojoRunnerDelegate::UnhandledException(gin::Runner* runner,
+void MojoRunnerDelegate::UnhandledException(gin::ShellRunner* runner,
                                             gin::TryCatch& try_catch) {
   gin::ModuleRunnerDelegate::UnhandledException(runner, try_catch);
   LOG(ERROR) << try_catch.GetStackTrace();