| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/apps/js/application_delegate_impl.h" | 5 #include "mojo/apps/js/application_delegate_impl.h" |
| 6 | 6 |
| 7 #include "gin/array_buffer.h" |
| 8 #include "gin/public/isolate_holder.h" |
| 7 #include "mojo/apps/js/js_app.h" | 9 #include "mojo/apps/js/js_app.h" |
| 8 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 9 | 11 |
| 10 namespace mojo { | 12 namespace mojo { |
| 11 namespace apps { | 13 namespace apps { |
| 12 | 14 |
| 13 ApplicationDelegateImpl::ApplicationDelegateImpl() | 15 ApplicationDelegateImpl::ApplicationDelegateImpl() |
| 14 : application_impl_(nullptr) { | 16 : application_impl_(nullptr) { |
| 15 } | 17 } |
| 16 | 18 |
| 17 void ApplicationDelegateImpl::Initialize(ApplicationImpl* app) { | 19 void ApplicationDelegateImpl::Initialize(ApplicationImpl* app) { |
| 18 application_impl_ = app; | 20 application_impl_ = app; |
| 21 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
| 22 gin::ArrayBufferAllocator::SharedInstance()); |
| 19 } | 23 } |
| 20 | 24 |
| 21 ApplicationDelegateImpl::~ApplicationDelegateImpl() { | 25 ApplicationDelegateImpl::~ApplicationDelegateImpl() { |
| 22 } | 26 } |
| 23 | 27 |
| 24 void ApplicationDelegateImpl::StartJSApp(scoped_ptr<JSApp> app_ptr) { | 28 void ApplicationDelegateImpl::StartJSApp(scoped_ptr<JSApp> app_ptr) { |
| 25 JSApp *app = app_ptr.release(); | 29 JSApp *app = app_ptr.release(); |
| 26 app_vector_.push_back(app); | 30 app_vector_.push_back(app); |
| 27 // TODO(hansmuller): deal with the Start() return value. | 31 // TODO(hansmuller): deal with the Start() return value. |
| 28 app->Start(); | 32 app->Start(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 const std::string& interface_name) { | 45 const std::string& interface_name) { |
| 42 CHECK(application_impl_); | 46 CHECK(application_impl_); |
| 43 ServiceProvider* service_provider = | 47 ServiceProvider* service_provider = |
| 44 application_impl_->ConnectToApplication(application_url) | 48 application_impl_->ConnectToApplication(application_url) |
| 45 ->GetServiceProvider(); | 49 ->GetServiceProvider(); |
| 46 service_provider->ConnectToService(interface_name, pipe_handle.Pass()); | 50 service_provider->ConnectToService(interface_name, pipe_handle.Pass()); |
| 47 } | 51 } |
| 48 | 52 |
| 49 } // namespace apps | 53 } // namespace apps |
| 50 } // namespace mojo | 54 } // namespace mojo |
| OLD | NEW |