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 | 5 |
6 #include "base/i18n/icu_util.h" | 6 #include "base/i18n/icu_util.h" |
7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
8 #include "mojo/apps/js/application_delegate_impl.h" | 8 #include "mojo/apps/js/application_delegate_impl.h" |
9 #include "mojo/apps/js/content_handler_impl.h" | 9 #include "mojo/apps/js/content_handler_impl.h" |
10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
11 #include "mojo/public/cpp/application/application_impl.h" | 11 #include "mojo/public/cpp/application/application_impl.h" |
12 #include "mojo/public/cpp/application/interface_factory_impl.h" | 12 #include "mojo/public/cpp/application/interface_factory_impl.h" |
13 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" | 13 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom.
h" |
14 | 14 |
| 15 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 16 #include "gin/public/isolate_holder.h" |
| 17 #endif |
| 18 |
15 namespace mojo { | 19 namespace mojo { |
16 namespace apps { | 20 namespace apps { |
17 | 21 |
18 class ContentHandlerApplicationDelegateImpl : public ApplicationDelegateImpl { | 22 class ContentHandlerApplicationDelegateImpl : public ApplicationDelegateImpl { |
19 public: | 23 public: |
20 ContentHandlerApplicationDelegateImpl() : content_handler_factory_(this) { | 24 ContentHandlerApplicationDelegateImpl() : content_handler_factory_(this) { |
21 } | 25 } |
22 | 26 |
23 private: | 27 private: |
24 virtual void Initialize(ApplicationImpl* app) override { | 28 virtual void Initialize(ApplicationImpl* app) override { |
25 base::i18n::InitializeICU(); | 29 base::i18n::InitializeICU(); |
26 ApplicationDelegateImpl::Initialize(app); | 30 ApplicationDelegateImpl::Initialize(app); |
27 } | 31 } |
28 | 32 |
29 virtual bool ConfigureIncomingConnection( | 33 virtual bool ConfigureIncomingConnection( |
30 ApplicationConnection* connection) override { | 34 ApplicationConnection* connection) override { |
31 connection->AddService(&content_handler_factory_); | 35 connection->AddService(&content_handler_factory_); |
32 return true; | 36 return true; |
33 } | 37 } |
34 | 38 |
35 InterfaceFactoryImplWithContext<ContentHandlerImpl, ApplicationDelegateImpl> | 39 InterfaceFactoryImplWithContext<ContentHandlerImpl, ApplicationDelegateImpl> |
36 content_handler_factory_; | 40 content_handler_factory_; |
37 }; | 41 }; |
38 | 42 |
39 } // namespace apps | 43 } // namespace apps |
40 } // namespace mojo | 44 } // namespace mojo |
41 | 45 |
42 MojoResult MojoMain(MojoHandle shell_handle) { | 46 MojoResult MojoMain(MojoHandle shell_handle) { |
| 47 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 48 gin::IsolateHolder::LoadV8Snapshot(); |
| 49 #endif |
43 mojo::ApplicationRunnerChromium runner( | 50 mojo::ApplicationRunnerChromium runner( |
44 new mojo::apps::ContentHandlerApplicationDelegateImpl()); | 51 new mojo::apps::ContentHandlerApplicationDelegateImpl()); |
45 return runner.Run(shell_handle); | 52 return runner.Run(shell_handle); |
46 } | 53 } |
OLD | NEW |