| 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/i18n/icu_util.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "components/html_viewer/blink_platform_impl.h" | 13 #include "components/html_viewer/blink_platform_impl.h" |
| 14 #include "components/html_viewer/blink_settings_impl.h" | 14 #include "components/html_viewer/blink_settings_impl.h" |
| 15 #include "components/html_viewer/media_factory.h" | 15 #include "components/html_viewer/media_factory.h" |
| 16 #include "components/scheduler/renderer/renderer_scheduler.h" | 16 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 17 #include "gin/v8_initializer.h" | 17 #include "gin/v8_initializer.h" |
| 18 #include "mojo/application/public/cpp/application_impl.h" | 18 #include "mojo/application/public/cpp/application_impl.h" |
| 19 #include "mojo/logging/init_logging.h" | 19 #include "mojo/logging/init_logging.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" |
| 21 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 22 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/base/ui_base_paths.h" | 24 #include "ui/base/ui_base_paths.h" |
| 24 #include "ui/gfx/display.h" | 25 #include "ui/gfx/display.h" |
| 25 #include "ui/mojo/init/ui_init.h" | 26 #include "ui/mojo/init/ui_init.h" |
| 26 #include "v8/include/v8.h" | 27 #include "v8/include/v8.h" |
| 27 | 28 |
| 28 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 29 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 29 #include "components/font_service/public/cpp/font_loader.h" | 30 #include "components/font_service/public/cpp/font_loader.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 } // namespace | 73 } // namespace |
| 73 | 74 |
| 74 GlobalState::GlobalState(mojo::ApplicationImpl* app) | 75 GlobalState::GlobalState(mojo::ApplicationImpl* app) |
| 75 : app_(app), | 76 : app_(app), |
| 76 resource_loader_(app, GetResourcePaths()), | 77 resource_loader_(app, GetResourcePaths()), |
| 77 did_init_(false), | 78 did_init_(false), |
| 78 device_pixel_ratio_(1.f), | 79 device_pixel_ratio_(1.f), |
| 79 discardable_memory_allocator_(kDesiredMaxMemory), | 80 discardable_memory_allocator_(kDesiredMaxMemory), |
| 80 compositor_thread_("compositor thread"), | 81 compositor_thread_("compositor thread"), |
| 81 blink_settings_(new BlinkSettingsImpl()) {} | 82 blink_settings_(new BlinkSettingsImpl()) { |
| 83 tracing_.Initialize(app); |
| 84 } |
| 82 | 85 |
| 83 GlobalState::~GlobalState() { | 86 GlobalState::~GlobalState() { |
| 84 if (blink_platform_) { | 87 if (blink_platform_) { |
| 85 renderer_scheduler_->Shutdown(); | 88 renderer_scheduler_->Shutdown(); |
| 86 blink::shutdown(); | 89 blink::shutdown(); |
| 87 } | 90 } |
| 88 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 91 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 89 if (font_loader_.get()) { | 92 if (font_loader_.get()) { |
| 90 SkFontConfigInterface::SetGlobal(nullptr); | 93 SkFontConfigInterface::SetGlobal(nullptr); |
| 91 // FontLoader is ref counted. We need to explicitly shutdown the background | 94 // FontLoader is ref counted. We need to explicitly shutdown the background |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 return gpu_info_.get(); | 185 return gpu_info_.get(); |
| 183 } | 186 } |
| 184 | 187 |
| 185 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { | 188 void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { |
| 186 CHECK(gpu_info); | 189 CHECK(gpu_info); |
| 187 gpu_info_ = gpu_info.Pass(); | 190 gpu_info_ = gpu_info.Pass(); |
| 188 gpu_service_.reset(); | 191 gpu_service_.reset(); |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace html_viewer | 194 } // namespace html_viewer |
| OLD | NEW |