Commit 355e3f19 authored by erg's avatar erg Committed by Commit bot

core_services: Also bundle network_service on android.

This creates an android_hooks.cc file, which we could currently share,
but probably won't want to long term, as every time we add something to
core_services, we'll have to merge their implementation in.

BUG=477435

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

Cr-Commit-Position: refs/heads/master@{#329506}
parent b4f81984
...@@ -14,10 +14,8 @@ void InitCoreServicesForContext(mojo::runner::Context* context) { ...@@ -14,10 +14,8 @@ void InitCoreServicesForContext(mojo::runner::Context* context) {
mojo::shell::ApplicationManager* manager = context->application_manager(); mojo::shell::ApplicationManager* manager = context->application_manager();
manager->RegisterApplicationPackageAlias(GURL("mojo:clipboard"), manager->RegisterApplicationPackageAlias(GURL("mojo:clipboard"),
GURL("mojo:core_services"), "Core"); GURL("mojo:core_services"), "Core");
#if !defined(OS_ANDROID)
manager->RegisterApplicationPackageAlias( manager->RegisterApplicationPackageAlias(
GURL("mojo:network_service"), GURL("mojo:core_services"), "Network"); GURL("mojo:network_service"), GURL("mojo:core_services"), "Network");
#endif
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"),
......
# Copyright 2015 The Chromium Authors. All rights reserved. # Copyright 2015 The Chromium Authors. All rights reserved.
# 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.
#
# core_services should be thought of as a bundle of many of the services which
# we ship with.
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//third_party/mojo/src/mojo/public/mojo_application.gni") import("//third_party/mojo/src/mojo/public/mojo_application.gni")
import("//testing/test.gni") import("//testing/test.gni")
# core_services should be thought of as a bundle of many of the services which if (is_android) {
# we ship with. import("//build/config/android/rules.gni")
mojo_native_application("core_services") {
java_library_path = "$target_out_dir/java_library.dex.jar"
mojo_android_application("core_services") {
input_so = "$root_out_dir/lib.stripped/libcore_services.so"
input_dex_jar = java_library_path
}
shared_library("native_library") {
output_name = "core_services"
sources = [
"android_hooks.cc",
]
deps = [
":sources",
"//base",
"//net",
"//third_party/mojo/src/mojo/public/c/system:for_shared_library",
]
}
android_standalone_library("java_library") {
dex_path = java_library_path
deps = [
"//net/android:net_java",
]
}
} else {
mojo_native_application("core_services") {
deps = [
":sources",
]
}
}
source_set("sources") {
sources = [ sources = [
"core_services_application_delegate.cc", "core_services_application_delegate.cc",
"main.cc", "main.cc",
...@@ -24,15 +65,10 @@ mojo_native_application("core_services") { ...@@ -24,15 +65,10 @@ mojo_native_application("core_services") {
"//mojo/common", "//mojo/common",
"//mojo/common:tracing_impl", "//mojo/common:tracing_impl",
"//mojo/environment:chromium", "//mojo/environment:chromium",
"//mojo/services/network:lib",
"//mojo/services/tracing:lib", "//mojo/services/tracing:lib",
"//third_party/mojo/src/mojo/public/interfaces/application", "//third_party/mojo/src/mojo/public/interfaces/application",
"//third_party/mojo/src/mojo/public/cpp/bindings:bindings", "//third_party/mojo/src/mojo/public/cpp/bindings:bindings",
"//third_party/mojo_services/src/content_handler/public/interfaces", "//third_party/mojo_services/src/content_handler/public/interfaces",
] ]
# TODO(erg): The android network service has some weirdness to let it link
# with java stuff. Someone who understand how that works should look at this.
if (!is_android) {
deps += [ "//mojo/services/network:lib" ]
}
} }
...@@ -7,6 +7,7 @@ include_rules = [ ...@@ -7,6 +7,7 @@ include_rules = [
"+mojo/common", "+mojo/common",
"+mojo/services/network", "+mojo/services/network",
"+mojo/services/tracing", "+mojo/services/tracing",
"+net",
"+third_party/mojo_services/src/clipboard", "+third_party/mojo_services/src/clipboard",
"+third_party/mojo/src/mojo/public", "+third_party/mojo/src/mojo/public",
"+third_party/mojo_services/src/content_handler/public", "+third_party/mojo_services/src/content_handler/public",
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <vector>
#include "base/android/base_jni_onload.h"
#include "base/android/jni_android.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "base/bind.h"
#include "net/android/net_jni_registrar.h"
namespace {
bool RegisterJNI(JNIEnv* env) {
return net::android::RegisterJni(env);
}
bool Init() {
return true;
}
} // namespace
// This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
std::vector<base::android::RegisterCallback> register_callbacks;
register_callbacks.push_back(base::Bind(&RegisterJNI));
std::vector<base::android::InitCallback> init_callbacks;
init_callbacks.push_back(base::Bind(&Init));
if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
!base::android::OnJNIOnLoadInit(init_callbacks)) {
return -1;
}
// There cannot be two AtExitManagers at the same time. Remove the one from
// LibraryLoader as ApplicationRunnerChromium also uses one.
base::android::LibraryLoaderExitHook();
return JNI_VERSION_1_4;
}
extern "C" JNI_EXPORT void InitApplicationContext(
const base::android::JavaRef<jobject>& context) {
JNIEnv* env = base::android::AttachCurrentThread();
base::android::InitApplicationContext(env, context);
}
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