summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/font_service/public/cpp/font_loader.cc16
-rw-r--r--components/font_service/public/cpp/font_loader.h2
-rw-r--r--mandoline/app/core_services_initialization.cc9
-rw-r--r--mandoline/services/core_services/BUILD.gn1
-rw-r--r--mandoline/services/core_services/main.cc10
-rw-r--r--mandoline/ui/aura/BUILD.gn4
-rw-r--r--mandoline/ui/aura/DEPS1
-rw-r--r--mandoline/ui/aura/aura_init.cc10
-rw-r--r--mojo/shell/application_manager.cc2
9 files changed, 46 insertions, 9 deletions
diff --git a/components/font_service/public/cpp/font_loader.cc b/components/font_service/public/cpp/font_loader.cc
index 8b63384..5a1e8f5 100644
--- a/components/font_service/public/cpp/font_loader.cc
+++ b/components/font_service/public/cpp/font_loader.cc
@@ -6,9 +6,25 @@
#include "components/font_service/public/cpp/font_service_thread.h"
#include "mojo/application/public/cpp/application_impl.h"
+#include "mojo/application/public/cpp/connect.h"
+#include "mojo/application/public/interfaces/shell.mojom.h"
namespace font_service {
+FontLoader::FontLoader(mojo::Shell* shell) {
+ mojo::ServiceProviderPtr font_service_provider;
+ mojo::URLRequestPtr request(mojo::URLRequest::New());
+ request->url = mojo::String::From("mojo:font_service");
+ FontServicePtr font_service;
+ shell->ConnectToApplication(request.Pass(),
+ GetProxy(&font_service_provider),
+ nullptr,
+ nullptr);
+ mojo::ConnectToService(font_service_provider.get(), &font_service);
+
+ thread_ = new internal::FontServiceThread(font_service.Pass());
+}
+
FontLoader::FontLoader(mojo::ApplicationImpl* application_impl) {
mojo::URLRequestPtr request(mojo::URLRequest::New());
request->url = mojo::String::From("mojo:font_service");
diff --git a/components/font_service/public/cpp/font_loader.h b/components/font_service/public/cpp/font_loader.h
index 38e82e1..363651a 100644
--- a/components/font_service/public/cpp/font_loader.h
+++ b/components/font_service/public/cpp/font_loader.h
@@ -16,6 +16,7 @@
namespace mojo {
class ApplicationImpl;
+class Shell;
}
namespace font_service {
@@ -32,6 +33,7 @@ class FontServiceThread;
class FontLoader : public SkFontConfigInterface,
public internal::MappedFontFile::Observer {
public:
+ explicit FontLoader(mojo::Shell* shell);
explicit FontLoader(mojo::ApplicationImpl* application_impl);
~FontLoader() override;
diff --git a/mandoline/app/core_services_initialization.cc b/mandoline/app/core_services_initialization.cc
index 7f1dd12..a11fb63 100644
--- a/mandoline/app/core_services_initialization.cc
+++ b/mandoline/app/core_services_initialization.cc
@@ -13,7 +13,7 @@ void InitCoreServicesForContext(mojo::runner::Context* context) {
// autogenerated from package manifests.
mojo::shell::ApplicationManager* manager = context->application_manager();
manager->RegisterApplicationPackageAlias(
- GURL("mojo:clipboard"), GURL("mojo:core_services"), "Sandboxed Core");
+ GURL("mojo:clipboard"), GURL("mojo:core_services"), "Core");
manager->RegisterApplicationPackageAlias(GURL("mojo:filesystem"),
GURL("mojo:core_services"), "Files");
#if defined(OS_LINUX) && !defined(OS_ANDROID)
@@ -28,7 +28,7 @@ void InitCoreServicesForContext(mojo::runner::Context* context) {
manager->RegisterApplicationPackageAlias(
GURL("mojo:network_service"), GURL("mojo:core_services"), "Network");
manager->RegisterApplicationPackageAlias(
- GURL("mojo:resource_provider"), GURL("mojo:core_services"), "Core");
+ GURL("mojo:resource_provider"), GURL("mojo:core_services"), "Files");
#endif
#if defined(USE_AURA)
@@ -38,9 +38,10 @@ void InitCoreServicesForContext(mojo::runner::Context* context) {
manager->RegisterApplicationPackageAlias(
GURL("mojo:surfaces_service"), GURL("mojo:core_services"), "Surfaces");
manager->RegisterApplicationPackageAlias(
- GURL("mojo:tracing"), GURL("mojo:core_services"), "Sandboxed Core");
+ GURL("mojo:tracing"), GURL("mojo:core_services"), "Core");
manager->RegisterApplicationPackageAlias(GURL("mojo:browser"),
- GURL("mojo:core_services"), "Core");
+ GURL("mojo:core_services"),
+ "Core");
}
} // namespace mandoline
diff --git a/mandoline/services/core_services/BUILD.gn b/mandoline/services/core_services/BUILD.gn
index 84f6f28..ece8690 100644
--- a/mandoline/services/core_services/BUILD.gn
+++ b/mandoline/services/core_services/BUILD.gn
@@ -50,6 +50,7 @@ source_set("sources") {
"//mojo/common:tracing_impl",
"//mojo/message_pump",
"//mojo/services/tracing:lib",
+ "//third_party/icu",
"//third_party/mojo/src/mojo/public/cpp/bindings",
]
diff --git a/mandoline/services/core_services/main.cc b/mandoline/services/core_services/main.cc
index 91f81e5..e9d36ba 100644
--- a/mandoline/services/core_services/main.cc
+++ b/mandoline/services/core_services/main.cc
@@ -11,6 +11,7 @@
#if defined(OS_LINUX) && !defined(OS_ANDROID)
#include "base/rand_util.h"
#include "base/sys_info.h"
+#include "third_party/icu/source/i18n/unicode/timezone.h"
// TODO(erg): Much of this was coppied from zygote_main_linux.cc
extern "C" {
@@ -20,12 +21,13 @@ void __attribute__((visibility("default"))) MojoSandboxWarm() {
base::SysInfo::MaxSharedMemorySize();
base::SysInfo::NumberOfProcessors();
- // TODO(erg): icu does timezone initialization here.
+ // ICU DateFormat class (used in base/time_format.cc) needs to get the
+ // Olson timezone ID by accessing the zoneinfo files on disk. After
+ // TimeZone::createDefault is called once here, the timezone ID is
+ // cached and there's no more need to access the file system.
+ scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
// TODO(erg): Perform OpenSSL warmup; it wants access to /dev/urandom.
-
- // TODO(erg): Initialize SkFontConfigInterface; it has its own odd IPC system
- // which probably must be ported to mojo.
}
}
#endif // defined(OS_LINUX) && !defined(OS_ANDROID)
diff --git a/mandoline/ui/aura/BUILD.gn b/mandoline/ui/aura/BUILD.gn
index 71226ad..97c0005 100644
--- a/mandoline/ui/aura/BUILD.gn
+++ b/mandoline/ui/aura/BUILD.gn
@@ -50,4 +50,8 @@ source_set("aura") {
"//ui/mojo/init",
"//ui/views",
]
+
+ if (is_linux && !is_android) {
+ deps += [ "//components/font_service/public/cpp" ]
+ }
}
diff --git a/mandoline/ui/aura/DEPS b/mandoline/ui/aura/DEPS
index e7b7185..f7fe88b 100644
--- a/mandoline/ui/aura/DEPS
+++ b/mandoline/ui/aura/DEPS
@@ -1,6 +1,7 @@
include_rules = [
"+cc",
"-cc/blink",
+ "+components/font_service/public",
"+components/gpu",
"+components/resource_provider",
"+components/view_manager",
diff --git a/mandoline/ui/aura/aura_init.cc b/mandoline/ui/aura/aura_init.cc
index 9873aa0..86c65d7 100644
--- a/mandoline/ui/aura/aura_init.cc
+++ b/mandoline/ui/aura/aura_init.cc
@@ -15,6 +15,10 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
+#if defined(OS_LINUX) && !defined(OS_ANDROID)
+#include "components/font_service/public/cpp/font_loader.h"
+#endif
+
namespace mandoline {
namespace {
@@ -60,6 +64,12 @@ void AuraInit::InitializeResources(mojo::Shell* shell) {
ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile(
resource_loader.ReleaseFile(kResourceUIPak),
ui::SCALE_FACTOR_100P);
+
+ // Initialize the skia font code to go ask fontconfig underneath.
+#if defined(OS_LINUX) && !defined(OS_ANDROID)
+ SkFontConfigInterface::SetGlobal(new font_service::FontLoader(shell));
+#endif
+
// There is a bunch of static state in gfx::Font, by running this now,
// before any other apps load, we ensure all the state is set up.
gfx::Font();
diff --git a/mojo/shell/application_manager.cc b/mojo/shell/application_manager.cc
index bbe68cf3..232e4b0 100644
--- a/mojo/shell/application_manager.cc
+++ b/mojo/shell/application_manager.cc
@@ -381,7 +381,7 @@ void ApplicationManager::HandleFetchCallback(
// TODO(erg): Have a better way of switching the sandbox on. For now, switch
// it on hard coded when we're using some of the sandboxable core services.
bool start_sandboxed = false;
- if (app_url == GURL("mojo://core_services/") && qualifier == "Sandboxed Core")
+ if (app_url == GURL("mojo://core_services/") && qualifier == "Core")
start_sandboxed = true;
else if (app_url == GURL("mojo://html_viewer/"))
start_sandboxed = true;