| 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" | 7 #include "gin/array_buffer.h" |
| 8 #include "gin/public/isolate_holder.h" | 8 #include "gin/public/isolate_holder.h" |
| 9 #include "mojo/apps/js/js_app.h" | 9 #include "mojo/apps/js/js_app.h" |
| 10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 namespace apps { | 13 namespace apps { |
| 14 | 14 |
| 15 ApplicationDelegateImpl::ApplicationDelegateImpl() | 15 ApplicationDelegateImpl::ApplicationDelegateImpl() |
| 16 : application_impl_(nullptr) { | 16 : application_impl_(nullptr) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 void ApplicationDelegateImpl::Initialize(ApplicationImpl* app) { | 19 void ApplicationDelegateImpl::Initialize(ApplicationImpl* app) { |
| 20 application_impl_ = app; | 20 application_impl_ = app; |
| 21 |
| 22 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 23 gin::IsolateHolder::LoadV8Snapshot(); |
| 24 #endif |
| 21 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 25 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
| 22 gin::ArrayBufferAllocator::SharedInstance()); | 26 gin::ArrayBufferAllocator::SharedInstance()); |
| 23 } | 27 } |
| 24 | 28 |
| 25 ApplicationDelegateImpl::~ApplicationDelegateImpl() { | 29 ApplicationDelegateImpl::~ApplicationDelegateImpl() { |
| 26 } | 30 } |
| 27 | 31 |
| 28 void ApplicationDelegateImpl::StartJSApp(scoped_ptr<JSApp> app_ptr) { | 32 void ApplicationDelegateImpl::StartJSApp(scoped_ptr<JSApp> app_ptr) { |
| 29 JSApp *app = app_ptr.release(); | 33 JSApp *app = app_ptr.release(); |
| 30 app_vector_.push_back(app); | 34 app_vector_.push_back(app); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 const std::string& interface_name) { | 51 const std::string& interface_name) { |
| 48 CHECK(application_impl_); | 52 CHECK(application_impl_); |
| 49 ServiceProvider* service_provider = | 53 ServiceProvider* service_provider = |
| 50 application_impl_->ConnectToApplication(application_url) | 54 application_impl_->ConnectToApplication(application_url) |
| 51 ->GetServiceProvider(); | 55 ->GetServiceProvider(); |
| 52 service_provider->ConnectToService(interface_name, pipe_handle.Pass()); | 56 service_provider->ConnectToService(interface_name, pipe_handle.Pass()); |
| 53 } | 57 } |
| 54 | 58 |
| 55 } // namespace apps | 59 } // namespace apps |
| 56 } // namespace mojo | 60 } // namespace mojo |
| OLD | NEW |