Commit b74eff81 authored by erg's avatar erg Committed by Commit bot

core_services: Move resource_provider to core_services.

This moves the resource provider into the main core service process,
too, eliminating one of the processes.

BUG=477435

Review URL: https://codereview.chromium.org/1137223002

Cr-Commit-Position: refs/heads/master@{#329706}
parent fcd926a5
...@@ -186,10 +186,7 @@ mojo_application_package("html_viewer") { ...@@ -186,10 +186,7 @@ mojo_application_package("html_viewer") {
"//third_party/icu:icudata", "//third_party/icu:icudata",
"//ui/resources:ui_test_pak", "//ui/resources:ui_test_pak",
] ]
data_deps = [ data_deps = [ "//mojo/services/network:network" ]
"//mojo/services/network:network",
"//components/resource_provider",
]
resources = [ resources = [
"$root_out_dir/icudtl.dat", "$root_out_dir/icudtl.dat",
"$root_out_dir/ui_test.pak", "$root_out_dir/ui_test.pak",
......
...@@ -20,8 +20,6 @@ if (is_android) { ...@@ -20,8 +20,6 @@ if (is_android) {
sources = [ sources = [
"android/android_hooks.cc", "android/android_hooks.cc",
"main.cc", "main.cc",
"resource_provider_app.cc",
"resource_provider_app.h",
] ]
deps = [ deps = [
...@@ -29,7 +27,6 @@ if (is_android) { ...@@ -29,7 +27,6 @@ if (is_android) {
":lib", ":lib",
"//base", "//base",
"//components/resource_provider/public/interfaces", "//components/resource_provider/public/interfaces",
"//mojo/application",
"//mojo/environment:chromium", "//mojo/environment:chromium",
"//third_party/mojo/src/mojo/public/c/system:for_shared_library", "//third_party/mojo/src/mojo/public/c/system:for_shared_library",
"//url", "//url",
...@@ -62,15 +59,12 @@ if (is_android) { ...@@ -62,15 +59,12 @@ if (is_android) {
mojo_native_application("resource_provider") { mojo_native_application("resource_provider") {
sources = [ sources = [
"main.cc", "main.cc",
"resource_provider_app.cc",
"resource_provider_app.h",
] ]
deps = [ deps = [
":lib", ":lib",
"//base", "//base",
"//components/resource_provider/public/interfaces", "//components/resource_provider/public/interfaces",
"//mojo/application",
"//mojo/environment:chromium", "//mojo/environment:chromium",
"//url", "//url",
] ]
...@@ -81,6 +75,8 @@ source_set("lib") { ...@@ -81,6 +75,8 @@ source_set("lib") {
sources = [ sources = [
"file_utils.cc", "file_utils.cc",
"file_utils.h", "file_utils.h",
"resource_provider_app.cc",
"resource_provider_app.h",
"resource_provider_impl.cc", "resource_provider_impl.cc",
"resource_provider_impl.h", "resource_provider_impl.h",
] ]
...@@ -88,6 +84,7 @@ source_set("lib") { ...@@ -88,6 +84,7 @@ source_set("lib") {
deps = [ deps = [
"//base", "//base",
"//components/resource_provider/public/interfaces", "//components/resource_provider/public/interfaces",
"//mojo/application",
"//mojo/common:common_base", "//mojo/common:common_base",
"//mojo/platform_handle", "//mojo/platform_handle",
"//url", "//url",
......
...@@ -24,7 +24,8 @@ bool Init() { ...@@ -24,7 +24,8 @@ bool Init() {
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
std::vector<base::android::RegisterCallback> register_callbacks; std::vector<base::android::RegisterCallback> register_callbacks;
register_callbacks.push_back(base::Bind(&RegisterJNI)); register_callbacks.push_back(base::Bind(&RegisterJNI));
register_callbacks.push_back(base::Bind(&RegisterNativesImpl)); register_callbacks.push_back(
base::Bind(&resource_provider::RegisterNativesImpl));
std::vector<base::android::InitCallback> init_callbacks; std::vector<base::android::InitCallback> init_callbacks;
init_callbacks.push_back(base::Bind(&Init)); init_callbacks.push_back(base::Bind(&Init));
...@@ -45,5 +46,6 @@ extern "C" JNI_EXPORT void InitApplicationContext( ...@@ -45,5 +46,6 @@ extern "C" JNI_EXPORT void InitApplicationContext(
const base::android::JavaRef<jobject>& context) { const base::android::JavaRef<jobject>& context) {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
base::android::InitApplicationContext(env, context); base::android::InitApplicationContext(env, context);
Java_Main_init(env, base::android::GetApplicationContext()); resource_provider::Java_Main_init(
env, base::android::GetApplicationContext());
} }
...@@ -7,11 +7,13 @@ package org.chromium.resource_provider; ...@@ -7,11 +7,13 @@ package org.chromium.resource_provider;
import android.content.Context; import android.content.Context;
import org.chromium.base.CalledByNative; import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.base.PathUtils; import org.chromium.base.PathUtils;
/** /**
* This class does setup for resource_provider. * This class does setup for resource_provider.
*/ */
@JNINamespace("resource_provider")
public final class Main { public final class Main {
private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "resource_provider"; private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "resource_provider";
......
...@@ -51,7 +51,6 @@ copy_ex("copy_mandoline_assets") { ...@@ -51,7 +51,6 @@ copy_ex("copy_mandoline_assets") {
dest = mandoline_assets_dir dest = mandoline_assets_dir
deps = [ deps = [
"//components/html_viewer", "//components/html_viewer",
"//components/resource_provider",
"//components/surfaces", "//components/surfaces",
"//mandoline/services/core_services", "//mandoline/services/core_services",
] ]
...@@ -61,7 +60,6 @@ copy_ex("copy_mandoline_assets") { ...@@ -61,7 +60,6 @@ copy_ex("copy_mandoline_assets") {
"$root_out_dir/lib.stripped/libbootstrap.so", "$root_out_dir/lib.stripped/libbootstrap.so",
"$root_out_dir/network_service.mojo", "$root_out_dir/network_service.mojo",
"$root_out_dir/obj/mojo/runner/bootstrap_java.dex.jar", "$root_out_dir/obj/mojo/runner/bootstrap_java.dex.jar",
"$root_out_dir/resource_provider.mojo",
"$root_out_dir/surfaces_service.mojo", "$root_out_dir/surfaces_service.mojo",
] ]
} }
......
...@@ -20,6 +20,8 @@ void InitCoreServicesForContext(mojo::runner::Context* context) { ...@@ -20,6 +20,8 @@ void InitCoreServicesForContext(mojo::runner::Context* context) {
manager->RegisterApplicationPackageAlias( manager->RegisterApplicationPackageAlias(
GURL("mojo:omnibox"), GURL("mojo:core_services"), "Core"); GURL("mojo:omnibox"), GURL("mojo:core_services"), "Core");
#endif #endif
manager->RegisterApplicationPackageAlias(
GURL("mojo:resource_provider"), GURL("mojo:core_services"), "Core");
manager->RegisterApplicationPackageAlias( manager->RegisterApplicationPackageAlias(
GURL("mojo:surfaces_service"), GURL("mojo:core_services"), "Surfaces"); GURL("mojo:surfaces_service"), GURL("mojo:core_services"), "Surfaces");
manager->RegisterApplicationPackageAlias(GURL("mojo:tracing"), manager->RegisterApplicationPackageAlias(GURL("mojo:tracing"),
......
...@@ -29,6 +29,7 @@ if (is_android) { ...@@ -29,6 +29,7 @@ if (is_android) {
deps = [ deps = [
":sources", ":sources",
"//base", "//base",
"//components/resource_provider:jni_headers",
"//net", "//net",
"//third_party/mojo/src/mojo/public/c/system:for_shared_library", "//third_party/mojo/src/mojo/public/c/system:for_shared_library",
] ]
...@@ -38,6 +39,7 @@ if (is_android) { ...@@ -38,6 +39,7 @@ if (is_android) {
dex_path = java_library_path dex_path = java_library_path
deps = [ deps = [
"//components/resource_provider:java_library",
"//net/android:net_java", "//net/android:net_java",
] ]
} }
...@@ -59,6 +61,7 @@ source_set("sources") { ...@@ -59,6 +61,7 @@ source_set("sources") {
"//base", "//base",
"//components/clipboard:lib", "//components/clipboard:lib",
"//components/surfaces:lib", "//components/surfaces:lib",
"//components/resource_provider:lib",
"//components/view_manager:view_manager_lib", "//components/view_manager:view_manager_lib",
"//mandoline/ui/browser:kiosk_wm_lib", "//mandoline/ui/browser:kiosk_wm_lib",
"//mojo/application", "//mojo/application",
......
include_rules = [ include_rules = [
"+components/clipboard", "+components/clipboard",
"+components/kiosk_wm", "+components/kiosk_wm",
"+components/resource_provider",
"+components/surfaces", "+components/surfaces",
"+components/view_manager", "+components/view_manager",
"+mojo/application", "+mojo/application",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/android/jni_android.h" #include "base/android/jni_android.h"
#include "base/android/library_loader/library_loader_hooks.h" #include "base/android/library_loader/library_loader_hooks.h"
#include "base/bind.h" #include "base/bind.h"
#include "components/resource_provider/jni/Main_jni.h"
#include "net/android/net_jni_registrar.h" #include "net/android/net_jni_registrar.h"
namespace { namespace {
...@@ -25,6 +26,8 @@ bool Init() { ...@@ -25,6 +26,8 @@ bool Init() {
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
std::vector<base::android::RegisterCallback> register_callbacks; std::vector<base::android::RegisterCallback> register_callbacks;
register_callbacks.push_back(base::Bind(&RegisterJNI)); register_callbacks.push_back(base::Bind(&RegisterJNI));
register_callbacks.push_back(
base::Bind(&resource_provider::RegisterNativesImpl));
std::vector<base::android::InitCallback> init_callbacks; std::vector<base::android::InitCallback> init_callbacks;
init_callbacks.push_back(base::Bind(&Init)); init_callbacks.push_back(base::Bind(&Init));
...@@ -45,4 +48,6 @@ extern "C" JNI_EXPORT void InitApplicationContext( ...@@ -45,4 +48,6 @@ extern "C" JNI_EXPORT void InitApplicationContext(
const base::android::JavaRef<jobject>& context) { const base::android::JavaRef<jobject>& context) {
JNIEnv* env = base::android::AttachCurrentThread(); JNIEnv* env = base::android::AttachCurrentThread();
base::android::InitApplicationContext(env, context); base::android::InitApplicationContext(env, context);
resource_provider::Java_Main_init(
env, base::android::GetApplicationContext());
} }
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "components/clipboard/clipboard_application_delegate.h" #include "components/clipboard/clipboard_application_delegate.h"
#include "components/resource_provider/resource_provider_app.h"
#include "components/surfaces/surfaces_service_application.h" #include "components/surfaces/surfaces_service_application.h"
#include "components/view_manager/view_manager_app.h" #include "components/view_manager/view_manager_app.h"
#include "mandoline/ui/browser/browser.h" #include "mandoline/ui/browser/browser.h"
...@@ -133,6 +134,8 @@ void CoreServicesApplicationDelegate::StartApplication( ...@@ -133,6 +134,8 @@ void CoreServicesApplicationDelegate::StartApplication(
else if (url == "mojo://omnibox/") else if (url == "mojo://omnibox/")
delegate.reset(new mandoline::OmniboxImpl); delegate.reset(new mandoline::OmniboxImpl);
#endif #endif
else if (url == "mojo://resource_provider/")
delegate.reset(new resource_provider::ResourceProviderApp);
else if (url == "mojo://surfaces_service/") else if (url == "mojo://surfaces_service/")
delegate.reset(new surfaces::SurfacesServiceApplication); delegate.reset(new surfaces::SurfacesServiceApplication);
else if (url == "mojo://tracing/") else if (url == "mojo://tracing/")
......
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