| 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/global_state.h" | 5 #include "components/html_viewer/global_state.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" |
| 11 #include "base/i18n/icu_util.h" |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "components/html_viewer/blink_platform_impl.h" | 13 #include "components/html_viewer/blink_platform_impl.h" |
| 13 #include "components/html_viewer/blink_settings_impl.h" | 14 #include "components/html_viewer/blink_settings_impl.h" |
| 14 #include "components/html_viewer/media_factory.h" | 15 #include "components/html_viewer/media_factory.h" |
| 15 #include "components/scheduler/renderer/renderer_scheduler.h" | 16 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 16 #include "gin/v8_initializer.h" | 17 #include "gin/v8_initializer.h" |
| 17 #include "mojo/application/public/cpp/application_impl.h" | 18 #include "mojo/application/public/cpp/application_impl.h" |
| 18 #include "mojo/logging/init_logging.h" | 19 #include "mojo/logging/init_logging.h" |
| 19 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 20 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
| 20 #include "third_party/WebKit/public/web/WebKit.h" | 21 #include "third_party/WebKit/public/web/WebKit.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), | 139 resource_loader_.ReleaseFile(kResourceSnapshotBlob).TakePlatformFile(), |
| 139 0u, 0u); | 140 0u, 0u); |
| 140 gin::V8Initializer::LoadV8NativesFromFD( | 141 gin::V8Initializer::LoadV8NativesFromFD( |
| 141 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, | 142 resource_loader_.ReleaseFile(kResourceNativesBlob).TakePlatformFile(), 0u, |
| 142 0u); | 143 0u); |
| 143 #endif | 144 #endif |
| 144 blink::initialize(blink_platform_.get()); | 145 blink::initialize(blink_platform_.get()); |
| 145 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 146 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 146 base::File pak_file = resource_loader_.ReleaseFile(kResourceResourcesPak); | 147 base::File pak_file = resource_loader_.ReleaseFile(kResourceResourcesPak); |
| 147 | 148 |
| 148 bool initialize_ui = true; | 149 bool initialize_icu_and_ui = true; |
| 149 #if defined(COMPONENT_BUILD) | 150 #if defined(COMPONENT_BUILD) |
| 150 if (command_line->HasSwitch("single-process")) | 151 if (command_line->HasSwitch("single-process")) |
| 151 initialize_ui = false; | 152 initialize_icu_and_ui = false; |
| 152 #endif | 153 #endif |
| 153 if (initialize_ui) { | 154 if (initialize_icu_and_ui) { |
| 155 base::i18n::InitializeICUWithFileDescriptor( |
| 156 resource_loader_.GetICUFile().TakePlatformFile(), |
| 157 base::MemoryMappedFile::Region::kWholeFile); |
| 154 ui::RegisterPathProvider(); | 158 ui::RegisterPathProvider(); |
| 155 base::File pak_file_2 = pak_file.Duplicate(); | 159 base::File pak_file_2 = pak_file.Duplicate(); |
| 156 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 160 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 157 pak_file_2.Pass(), base::MemoryMappedFile::Region::kWholeFile); | 161 pak_file_2.Pass(), base::MemoryMappedFile::Region::kWholeFile); |
| 158 } | 162 } |
| 159 | 163 |
| 160 mojo::logging::InitLogging(); | 164 mojo::logging::InitLogging(); |
| 161 | 165 |
| 162 if (command_line->HasSwitch(kDisableEncryptedMedia)) | 166 if (command_line->HasSwitch(kDisableEncryptedMedia)) |
| 163 blink::WebRuntimeFeatures::enableEncryptedMedia(false); | 167 blink::WebRuntimeFeatures::enableEncryptedMedia(false); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 187 return gpu_info_.get(); | 191 return gpu_info_.get(); |
| 188 } | 192 } |
| 189 | 193 |
| 190 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { | 194 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { |
| 191 CHECK(gpu_info); | 195 CHECK(gpu_info); |
| 192 gpu_info_ = gpu_info.Pass(); | 196 gpu_info_ = gpu_info.Pass(); |
| 193 gpu_service_.reset(); | 197 gpu_service_.reset(); |
| 194 } | 198 } |
| 195 | 199 |
| 196 } // namespace html_viewer | 200 } // namespace html_viewer |
| OLD | NEW |