OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/html_viewer/setup.h" | 5 #include "components/html_viewer/setup.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 app_->Terminate(); | 107 app_->Terminate(); |
108 return; | 108 return; |
109 } | 109 } |
110 | 110 |
111 ui_setup_.reset(new UISetup(screen_size_in_pixels, device_pixel_ratio)); | 111 ui_setup_.reset(new UISetup(screen_size_in_pixels, device_pixel_ratio)); |
112 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); | 112 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); |
113 | 113 |
114 renderer_scheduler_ = scheduler::RendererScheduler::Create(); | 114 renderer_scheduler_ = scheduler::RendererScheduler::Create(); |
115 blink_platform_.reset(new BlinkPlatformImpl(app_, renderer_scheduler_.get())); | 115 blink_platform_.reset(new BlinkPlatformImpl(app_, renderer_scheduler_.get())); |
116 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 116 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
117 CHECK(gin::V8Initializer::LoadV8SnapshotFromFD( | 117 gin::V8Initializer::LoadV8SnapshotFromFD( |
| 118 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), |
| 119 0u, 0u); |
| 120 gin::V8Initializer::LoadV8NativesFromFD( |
118 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, | 121 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, |
119 0u, | 122 0u); |
120 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), | |
121 0u, 0u)); | |
122 #endif | 123 #endif |
123 blink::initialize(blink_platform_.get()); | 124 blink::initialize(blink_platform_.get()); |
124 base::i18n::InitializeICUWithFileDescriptor( | 125 base::i18n::InitializeICUWithFileDescriptor( |
125 resource_loader_.ReleaseFile(kResourceIcudtl).TakePlatformFile(), | 126 resource_loader_.ReleaseFile(kResourceIcudtl).TakePlatformFile(), |
126 base::MemoryMappedFile::Region::kWholeFile); | 127 base::MemoryMappedFile::Region::kWholeFile); |
127 | 128 |
128 ui::RegisterPathProvider(); | 129 ui::RegisterPathProvider(); |
129 | 130 |
130 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 131 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
131 | 132 |
(...skipping 20 matching lines...) Expand all Loading... |
152 media_factory_.reset( | 153 media_factory_.reset( |
153 new MediaFactory(compositor_thread_.message_loop_proxy(), app_->shell())); | 154 new MediaFactory(compositor_thread_.message_loop_proxy(), app_->shell())); |
154 | 155 |
155 if (command_line->HasSwitch(kJavaScriptFlags)) { | 156 if (command_line->HasSwitch(kJavaScriptFlags)) { |
156 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags)); | 157 std::string flags(command_line->GetSwitchValueASCII(kJavaScriptFlags)); |
157 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); | 158 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); |
158 } | 159 } |
159 } | 160 } |
160 | 161 |
161 } // namespace html_viewer | 162 } // namespace html_viewer |
OLD | NEW |