Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java

Issue 2191033002: Split ServiceRegistryAndroid into InterfaceRegistryAndroid and InterfaceProviderAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java b/content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java
deleted file mode 100644
index b81267b148a2e7494b2d1a30a147b9123ed7c0de..0000000000000000000000000000000000000000
--- a/content/public/android/java/src/org/chromium/content/browser/ServiceRegistry.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// 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.
-
-package org.chromium.content.browser;
-
-import org.chromium.base.annotations.CalledByNative;
-import org.chromium.base.annotations.JNINamespace;
-import org.chromium.mojo.bindings.Interface;
-import org.chromium.mojo.bindings.Interface.Proxy;
-import org.chromium.mojo.bindings.InterfaceRequest;
-import org.chromium.mojo.system.Core;
-import org.chromium.mojo.system.MessagePipeHandle;
-import org.chromium.mojo.system.impl.CoreImpl;
-
-/**
- * Java wrapper over Mojo ServiceRegistry held by the browser.
- */
-@JNINamespace("content")
-public class ServiceRegistry {
-
- /**
- * The interface that a factory should implement.
- */
- public interface ImplementationFactory<I extends Interface> {
- I createImpl();
- }
-
- /**
- * Adds a service factory.
- *
- * @param manager The interface manager.
- * @param factory The service factory.
- */
- public <I extends Interface, P extends Proxy> void addService(
- Interface.Manager<I, P> manager, ImplementationFactory<I> factory) {
- nativeAddService(mNativeServiceRegistryAndroid, manager, factory, manager.getName());
- }
-
- <I extends Interface, P extends Proxy> void removeService(
- Interface.Manager<I, P> manager) {
- nativeRemoveService(mNativeServiceRegistryAndroid, manager.getName());
- }
-
- <I extends Interface, P extends Proxy> void connectToRemoteService(
- Interface.Manager<I, P> manager, InterfaceRequest<I> request) {
- int nativeHandle = request.passHandle().releaseNativeHandle();
- nativeConnectToRemoteService(
- mNativeServiceRegistryAndroid, manager.getName(), nativeHandle);
- }
-
- private long mNativeServiceRegistryAndroid;
- private final Core mCore;
-
- private ServiceRegistry(long nativeServiceRegistryAndroid, Core core) {
- mNativeServiceRegistryAndroid = nativeServiceRegistryAndroid;
- mCore = core;
- }
-
- @CalledByNative
- private static ServiceRegistry create(long nativeServiceRegistryAndroid) {
- return new ServiceRegistry(nativeServiceRegistryAndroid, CoreImpl.getInstance());
- }
-
- @CalledByNative
- private void destroy() {
- mNativeServiceRegistryAndroid = 0;
- }
-
- // Declaring parametrized argument type for manager and factory breaks the JNI generator.
- // TODO(ppi): support parametrized argument types in the JNI generator.
- @SuppressWarnings("unchecked")
- @CalledByNative
- private void createImplAndAttach(int nativeHandle, Interface.Manager manager,
- ImplementationFactory factory) {
- MessagePipeHandle handle = mCore.acquireNativeHandle(nativeHandle).toMessagePipeHandle();
- manager.bind(factory.createImpl(), handle);
- }
-
- private native void nativeAddService(long nativeServiceRegistryAndroid,
- Interface.Manager manager, ImplementationFactory factory, String name);
- private native void nativeRemoveService(long nativeServiceRegistryAndroid, String name);
- private native void nativeConnectToRemoteService(long nativeServiceRegistryAndroid, String name,
- int handle);
-}

Powered by Google App Engine
This is Rietveld 408576698