Commit 44b1fa51 authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

Create //components/services, move //components/font_service into it

This CL creates //components/services as the canonical location of
Mojo services within //components. It adds documentation and an OWNERS
file.

This CL also moves //components/font_service to
//components/services/font as the first step to getting all existing
services in //components into the canonical location.

The existing code there has a bunch of presubmit warnings. This CL does
not attempt to fix them.

This CL will be followed by changes to restore naming consistency:
- A change that moves the FontService Mojo interface to FontLoader,
  which is a more appropriate name
- A change that renames the font_service service to font and adjusts
  namespaces accordingly

NOPRESUBMIT=true
TBR=dcheng@chromium.org

Change-Id: I0cd668726d9841e6ef47a703c0042a7ec7d17833
Reviewed-on: https://chromium-review.googlesource.com/948855Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542141}
parent 914e0d56
...@@ -444,7 +444,7 @@ service_manifest("chrome_content_packaged_services_manifest_overlay") { ...@@ -444,7 +444,7 @@ service_manifest("chrome_content_packaged_services_manifest_overlay") {
"//ash/components/quick_launch:manifest", "//ash/components/quick_launch:manifest",
"//ash/components/touch_hud:manifest", "//ash/components/touch_hud:manifest",
"//ash:manifest", "//ash:manifest",
"//components/font_service:manifest", "//components/services/font:manifest",
] ]
} }
} }
......
...@@ -2855,8 +2855,8 @@ jumbo_split_static_library("browser") { ...@@ -2855,8 +2855,8 @@ jumbo_split_static_library("browser") {
"//ash/components/quick_launch/public/mojom:constants", "//ash/components/quick_launch/public/mojom:constants",
"//ash/public/cpp", "//ash/public/cpp",
"//chrome/browser/chromeos", "//chrome/browser/chromeos",
"//components/font_service:lib", "//components/services/font:lib",
"//components/font_service/public/interfaces", "//components/services/font/public/interfaces",
"//services/ui/public/cpp/input_devices", "//services/ui/public/cpp/input_devices",
"//services/ui/public/cpp/input_devices:input_device_controller", "//services/ui/public/cpp/input_devices:input_device_controller",
"//services/ui/public/interfaces", "//services/ui/public/interfaces",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "ash/public/interfaces/constants.mojom.h" #include "ash/public/interfaces/constants.mojom.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/font_service/public/interfaces/constants.mojom.h" #include "components/services/font/public/interfaces/constants.mojom.h"
#include "services/ui/public/interfaces/constants.mojom.h" #include "services/ui/public/interfaces/constants.mojom.h"
using content::ContentBrowserClient; using content::ContentBrowserClient;
......
...@@ -154,8 +154,8 @@ static_library("utility") { ...@@ -154,8 +154,8 @@ static_library("utility") {
"//ash/components/quick_launch/public/mojom", "//ash/components/quick_launch/public/mojom",
"//ash/components/touch_hud:lib", "//ash/components/touch_hud:lib",
"//chrome/services/file_util:lib", "//chrome/services/file_util:lib",
"//components/font_service:lib", "//components/services/font:lib",
"//components/font_service/public/interfaces", "//components/services/font/public/interfaces",
"//services/ui:lib", "//services/ui:lib",
"//services/ui/public/interfaces", "//services/ui/public/interfaces",
] ]
......
...@@ -18,7 +18,7 @@ include_rules = [ ...@@ -18,7 +18,7 @@ include_rules = [
"+chrome/services/wifi_util_win/wifi_util_win_service.h", "+chrome/services/wifi_util_win/wifi_util_win_service.h",
"+chrome/services/wifi_util_win/public/mojom", "+chrome/services/wifi_util_win/public/mojom",
"+components/crash/core/common/crash_keys.h", "+components/crash/core/common/crash_keys.h",
"+components/font_service/font_service_app.h", "+components/services/font/font_service_app.h",
"+components/patch_service", "+components/patch_service",
"+components/payments/content/utility", "+components/payments/content/utility",
"+components/printing/service/public/cpp", "+components/printing/service/public/cpp",
...@@ -51,8 +51,8 @@ specific_include_rules = { ...@@ -51,8 +51,8 @@ specific_include_rules = {
"+ash/components/touch_hud/touch_hud_application.h", "+ash/components/touch_hud/touch_hud_application.h",
"+ash/public/interfaces", "+ash/public/interfaces",
"+ash/window_manager_service.h", "+ash/window_manager_service.h",
"+components/font_service/font_service_app.h", "+components/services/font/font_service_app.h",
"+components/font_service/public/interfaces", "+components/services/font/public/interfaces",
"+services/ui/common/image_cursors_set.h", "+services/ui/common/image_cursors_set.h",
"+services/ui/public", "+services/ui/public",
"+services/ui/service.h", "+services/ui/service.h",
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include "ash/window_manager_service.h" #include "ash/window_manager_service.h"
#include "base/bind.h" #include "base/bind.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/font_service/font_service_app.h" #include "components/services/font/font_service_app.h"
#include "components/font_service/public/interfaces/constants.mojom.h" #include "components/services/font/public/interfaces/constants.mojom.h"
#include "services/ui/common/image_cursors_set.h" #include "services/ui/common/image_cursors_set.h"
#include "services/ui/public/interfaces/constants.mojom.h" #include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/service.h" #include "services/ui/service.h"
......
file://services/OWNERS
This directory holds [services](/services) that are:
(a) Not considered part of Chrome's foundation (i.e., //services), but
(b) Still used by multiple embedders
If in doubt about where your service belongs, contact services-dev@chromium.org.
...@@ -13,7 +13,7 @@ source_set("lib") { ...@@ -13,7 +13,7 @@ source_set("lib") {
deps = [ deps = [
"//base", "//base",
"//components/font_service/public/interfaces", "//components/services/font/public/interfaces",
"//mojo/common:common_base", "//mojo/common:common_base",
"//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings",
"//mojo/public/cpp/system", "//mojo/public/cpp/system",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/font_service/font_service_app.h" #include "components/services/font/font_service_app.h"
#include <utility> #include <utility>
...@@ -65,8 +65,7 @@ void FontServiceApp::MatchFamilyName(const std::string& family_name, ...@@ -65,8 +65,7 @@ void FontServiceApp::MatchFamilyName(const std::string& family_name,
SkFontConfigInterface::GetSingletonDirectInterface(); SkFontConfigInterface::GetSingletonDirectInterface();
const bool r = fc->matchFamilyName( const bool r = fc->matchFamilyName(
family_name.data(), family_name.data(),
SkFontStyle(requested_style->weight, SkFontStyle(requested_style->weight, requested_style->width,
requested_style->width,
static_cast<SkFontStyle::Slant>(requested_style->slant)), static_cast<SkFontStyle::Slant>(requested_style->slant)),
&result_identity, &result_family, &result_style); &result_identity, &result_family, &result_style);
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ #ifndef COMPONENTS_SERVICES_FONT_FONT_SERVICE_APP_H_
#define COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ #define COMPONENTS_SERVICES_FONT_FONT_SERVICE_APP_H_
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "components/font_service/public/interfaces/font_service.mojom.h" #include "components/services/font/public/interfaces/font_service.mojom.h"
#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h"
#include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/service.h" #include "services/service_manager/public/cpp/service.h"
...@@ -52,4 +52,4 @@ class FontServiceApp : public service_manager::Service, ...@@ -52,4 +52,4 @@ class FontServiceApp : public service_manager::Service,
} // namespace font_service } // namespace font_service
#endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ #endif // COMPONENTS_SERVICES_FONT_FONT_SERVICE_APP_H_
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/font_service/font_service_app.h"
#include "services/service_manager/public/c/main.h" #include "services/service_manager/public/c/main.h"
#include "components/services/font/font_service_app.h"
#include "services/service_manager/public/cpp/service_runner.h" #include "services/service_manager/public/cpp/service_runner.h"
MojoResult ServiceMain(MojoHandle service_request_handle) { MojoResult ServiceMain(MojoHandle service_request_handle) {
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/font_service/public/cpp/font_loader.h" #include "components/services/font/public/cpp/font_loader.h"
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "components/font_service/public/cpp/font_service_thread.h" #include "components/services/font/public/cpp/font_service_thread.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
namespace font_service { namespace font_service {
...@@ -38,9 +38,8 @@ bool FontLoader::matchFamilyName(const char family_name[], ...@@ -38,9 +38,8 @@ bool FontLoader::matchFamilyName(const char family_name[],
} }
SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) { SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) {
TRACE_EVENT2("font_loader", "FontLoader::openStream", TRACE_EVENT2("font_loader", "FontLoader::openStream", "identity",
"identity", identity.fID, identity.fID, "name", identity.fString.c_str());
"name", identity.fString.c_str());
{ {
base::AutoLock lock(lock_); base::AutoLock lock(lock_);
auto mapped_font_files_it = mapped_font_files_.find(identity.fID); auto mapped_font_files_it = mapped_font_files_.find(identity.fID);
...@@ -59,8 +58,9 @@ SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) { ...@@ -59,8 +58,9 @@ SkStreamAsset* FontLoader::openStream(const FontIdentity& identity) {
{ {
base::AutoLock lock(lock_); base::AutoLock lock(lock_);
auto mapped_font_files_it = auto mapped_font_files_it =
mapped_font_files_.insert(std::make_pair(mapped_font_file->font_id(), mapped_font_files_
mapped_font_file.get())) .insert(std::make_pair(mapped_font_file->font_id(),
mapped_font_file.get()))
.first; .first;
return mapped_font_files_it->second->CreateMemoryStream(); return mapped_font_files_it->second->CreateMemoryStream();
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ #ifndef COMPONENTS_SERVICES_FONT_PUBLIC_CPP_FONT_LOADER_H_
#define COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ #define COMPONENTS_SERVICES_FONT_PUBLIC_CPP_FONT_LOADER_H_
#include <stdint.h> #include <stdint.h>
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "components/font_service/public/cpp/mapped_font_file.h" #include "components/services/font/public/cpp/mapped_font_file.h"
#include "components/font_service/public/interfaces/font_service.mojom.h" #include "components/services/font/public/interfaces/font_service.mojom.h"
#include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/ports/SkFontConfigInterface.h" #include "third_party/skia/include/ports/SkFontConfigInterface.h"
...@@ -70,4 +70,4 @@ class FontLoader : public SkFontConfigInterface, ...@@ -70,4 +70,4 @@ class FontLoader : public SkFontConfigInterface,
} // namespace font_service } // namespace font_service
#endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_LOADER_H_ #endif // COMPONENTS_SERVICES_FONT_PUBLIC_CPP_FONT_LOADER_H_
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/font_service/public/cpp/font_service_thread.h" #include "components/services/font/public/cpp/font_service_thread.h"
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/files/file.h" #include "base/files/file.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "components/font_service/public/cpp/mapped_font_file.h" #include "components/services/font/public/cpp/mapped_font_file.h"
namespace font_service { namespace font_service {
namespace internal { namespace internal {
...@@ -132,8 +132,7 @@ void FontServiceThread::OnMatchFamilyNameComplete( ...@@ -132,8 +132,7 @@ void FontServiceThread::OnMatchFamilyNameComplete(
// behaviour of the current Linux IPC version. // behaviour of the current Linux IPC version.
*out_family_name = family_name.data(); *out_family_name = family_name.data();
*out_style = SkFontStyle(style->weight, *out_style = SkFontStyle(style->weight, style->width,
style->width,
static_cast<SkFontStyle::Slant>(style->slant)); static_cast<SkFontStyle::Slant>(style->slant));
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_SERVICE_THREAD_H_ #ifndef COMPONENTS_SERVICES_FONT_PUBLIC_CPP_FONT_SERVICE_THREAD_H_
#define COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_SERVICE_THREAD_H_ #define COMPONENTS_SERVICES_FONT_PUBLIC_CPP_FONT_SERVICE_THREAD_H_
#include <stdint.h> #include <stdint.h>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "components/font_service/public/interfaces/font_service.mojom.h" #include "components/services/font/public/interfaces/font_service.mojom.h"
#include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/ports/SkFontConfigInterface.h" #include "third_party/skia/include/ports/SkFontConfigInterface.h"
...@@ -114,4 +114,4 @@ class FontServiceThread : public base::Thread, ...@@ -114,4 +114,4 @@ class FontServiceThread : public base::Thread,
} // namespace internal } // namespace internal
} // namespace font_service } // namespace font_service
#endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_FONT_SERVICE_THREAD_H_ #endif // COMPONENTS_SERVICES_FONT_PUBLIC_CPP_FONT_SERVICE_THREAD_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "components/font_service/public/cpp/mapped_font_file.h" #include "components/services/font/public/cpp/mapped_font_file.h"
#include <utility> #include <utility>
...@@ -28,7 +28,7 @@ SkMemoryStream* MappedFontFile::CreateMemoryStream() { ...@@ -28,7 +28,7 @@ SkMemoryStream* MappedFontFile::CreateMemoryStream() {
DCHECK(mapped_font_file_.IsValid()); DCHECK(mapped_font_file_.IsValid());
sk_sp<SkData> data = sk_sp<SkData> data =
SkData::MakeWithProc(mapped_font_file_.data(), mapped_font_file_.length(), SkData::MakeWithProc(mapped_font_file_.data(), mapped_font_file_.length(),
&MappedFontFile::ReleaseProc, this); &MappedFontFile::ReleaseProc, this);
if (!data) if (!data)
return nullptr; return nullptr;
AddRef(); AddRef();
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef COMPONENTS_FONT_SERVICE_PUBLIC_CPP_MAPPED_FONT_FILE_H_ #ifndef COMPONENTS_SERVICES_FONT_PUBLIC_CPP_MAPPED_FONT_FILE_H_
#define COMPONENTS_FONT_SERVICE_PUBLIC_CPP_MAPPED_FONT_FILE_H_ #define COMPONENTS_SERVICES_FONT_PUBLIC_CPP_MAPPED_FONT_FILE_H_
#include <stdint.h> #include <stdint.h>
...@@ -53,4 +53,4 @@ class MappedFontFile : public base::RefCountedThreadSafe<MappedFontFile> { ...@@ -53,4 +53,4 @@ class MappedFontFile : public base::RefCountedThreadSafe<MappedFontFile> {
} // namespace internal } // namespace internal
} // namespace font_service } // namespace font_service
#endif // COMPONENTS_FONT_SERVICE_PUBLIC_CPP_MAPPED_FONT_FILE_H_ #endif // COMPONENTS_SERVICES_FONT_PUBLIC_CPP_MAPPED_FONT_FILE_H_
...@@ -64,7 +64,7 @@ catalog("catalog") { ...@@ -64,7 +64,7 @@ catalog("catalog") {
} }
if (is_linux && !is_android) { if (is_linux && !is_android) {
standalone_services += [ "//components/font_service:manifest" ] standalone_services += [ "//components/services/font:manifest" ]
} }
if (enable_nacl) { if (enable_nacl) {
......
...@@ -80,9 +80,9 @@ jumbo_component("mus") { ...@@ -80,9 +80,9 @@ jumbo_component("mus") {
] ]
if (is_linux && !is_android) { if (is_linux && !is_android) {
deps += [ "//components/font_service/public/cpp" ] deps += [ "//components/services/font/public/cpp" ]
data_deps = [ data_deps = [
"//components/font_service", "//components/services/font:font_service",
] ]
} }
} }
......
include_rules = [ include_rules = [
"+cc", "+cc",
"-cc/blink", "-cc/blink",
"+components/font_service/public", "+components/services/font/public",
"+components/gpu", "+components/gpu",
"+mojo/cc", "+mojo/cc",
"+mojo/common", "+mojo/common",
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "ui/views/views_delegate.h" #include "ui/views/views_delegate.h"
#if defined(OS_LINUX) #if defined(OS_LINUX)
#include "components/font_service/public/cpp/font_loader.h" #include "components/services/font/public/cpp/font_loader.h"
#include "ui/gfx/platform_font_linux.h" #include "ui/gfx/platform_font_linux.h"
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment