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 "ui/views/mus/aura_init.h" | 5 #include "ui/views/mus/aura_init.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 font_loader_->Shutdown(); | 70 font_loader_->Shutdown(); |
71 } | 71 } |
72 #endif | 72 #endif |
73 } | 73 } |
74 | 74 |
75 void AuraInit::InitializeResources(mojo::Shell* shell) { | 75 void AuraInit::InitializeResources(mojo::Shell* shell) { |
76 if (ui::ResourceBundle::HasSharedInstance()) | 76 if (ui::ResourceBundle::HasSharedInstance()) |
77 return; | 77 return; |
78 resource_provider::ResourceLoader resource_loader( | 78 resource_provider::ResourceLoader resource_loader( |
79 shell, GetResourcePaths(resource_file_)); | 79 shell, GetResourcePaths(resource_file_)); |
80 if (!resource_loader.BlockUntilLoaded()) | 80 CHECK(resource_loader.BlockUntilLoaded()); |
81 return; | |
82 CHECK(resource_loader.loaded()); | 81 CHECK(resource_loader.loaded()); |
83 ui::RegisterPathProvider(); | 82 ui::RegisterPathProvider(); |
84 base::File pak_file = resource_loader.ReleaseFile(resource_file_); | 83 base::File pak_file = resource_loader.ReleaseFile(resource_file_); |
85 base::File pak_file_2 = pak_file.Duplicate(); | 84 base::File pak_file_2 = pak_file.Duplicate(); |
86 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 85 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
87 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); | 86 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); |
88 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 87 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
89 std::move(pak_file_2), ui::SCALE_FACTOR_100P); | 88 std::move(pak_file_2), ui::SCALE_FACTOR_100P); |
90 | 89 |
91 // Initialize the skia font code to go ask fontconfig underneath. | 90 // Initialize the skia font code to go ask fontconfig underneath. |
92 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 91 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
93 font_loader_ = skia::AdoptRef(new font_service::FontLoader(shell)); | 92 font_loader_ = skia::AdoptRef(new font_service::FontLoader(shell)); |
94 SkFontConfigInterface::SetGlobal(font_loader_.get()); | 93 SkFontConfigInterface::SetGlobal(font_loader_.get()); |
95 #endif | 94 #endif |
96 | 95 |
97 // There is a bunch of static state in gfx::Font, by running this now, | 96 // There is a bunch of static state in gfx::Font, by running this now, |
98 // before any other apps load, we ensure all the state is set up. | 97 // before any other apps load, we ensure all the state is set up. |
99 gfx::Font(); | 98 gfx::Font(); |
100 } | 99 } |
101 | 100 |
102 } // namespace views | 101 } // namespace views |
OLD | NEW |