Skip to content

Commit

Permalink
Mojo: Remove InterfaceProvider.
Browse files Browse the repository at this point in the history
Review URL: https://codereview.chromium.org/358743002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280569 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sammc@chromium.org committed Jun 30, 2014
1 parent 45af144 commit 8c4e867
Show file tree
Hide file tree
Showing 32 changed files with 47 additions and 96 deletions.
2 changes: 1 addition & 1 deletion content/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ source_set("app") {
} else {
deps += [
"//mojo/environment:chromium",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//mojo/service_manager",
"//mojo/system",
]
Expand Down
2 changes: 1 addition & 1 deletion content/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ source_set("browser") {
"//cc",
"//cc:cc_surfaces",
"//mojo/public/cpp/bindings",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//mojo/public/js/bindings",
"//net:http_server",
"//third_party/icu",
Expand Down
4 changes: 2 additions & 2 deletions content/browser/frame_host/render_frame_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ RenderFrameHostImpl::RenderFrameHostImpl(

if (GetProcess()->GetServiceRegistry()) {
RenderFrameSetupPtr setup;
GetProcess()->GetServiceRegistry()->GetRemoteInterface(&setup);
mojo::IInterfaceProviderPtr service_provider;
GetProcess()->GetServiceRegistry()->ConnectToRemoteService(&setup);
mojo::ServiceProviderPtr service_provider;
setup->GetServiceProviderForFrame(routing_id_,
mojo::Get(&service_provider));
service_registry_.BindRemoteServiceProvider(
Expand Down
2 changes: 1 addition & 1 deletion content/child/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ source_set("child") {
"//base",
"//components/tracing",
"//mojo/environment:chromium",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//skia",
"//third_party/icu",
"//ui/base",
Expand Down
2 changes: 1 addition & 1 deletion content/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ source_set("common") {
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/service",
"//gpu/ipc",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//ui/gl",
"//webkit/browser:storage",
"//webkit/common",
Expand Down
8 changes: 4 additions & 4 deletions content/common/mojo/service_registry_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void ServiceRegistryImpl::BindRemoteServiceProvider(
bound_ = true;
mojo::BindToPipe(this, handle.Pass());
while (!pending_connects_.empty()) {
client()->GetInterface(
client()->ConnectToService(
mojo::String::From(pending_connects_.front().first),
mojo::ScopedMessagePipeHandle(pending_connects_.front().second));
pending_connects_.pop();
Expand All @@ -52,18 +52,18 @@ void ServiceRegistryImpl::RemoveService(const std::string& service_name) {
service_factories_.erase(service_name);
}

void ServiceRegistryImpl::GetRemoteInterface(
void ServiceRegistryImpl::ConnectToRemoteService(
const base::StringPiece& service_name,
mojo::ScopedMessagePipeHandle handle) {
if (!bound_) {
pending_connects_.push(
std::make_pair(service_name.as_string(), handle.release()));
return;
}
client()->GetInterface(mojo::String::From(service_name), handle.Pass());
client()->ConnectToService(mojo::String::From(service_name), handle.Pass());
}

void ServiceRegistryImpl::GetInterface(
void ServiceRegistryImpl::ConnectToService(
const mojo::String& name,
mojo::ScopedMessagePipeHandle client_handle) {
std::map<std::string,
Expand Down
15 changes: 7 additions & 8 deletions content/common/mojo/service_registry_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
#include "content/public/common/service_registry.h"
#include "mojo/public/cpp/bindings/interface_impl.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/interfaces/interface_provider/interface_provider.mojom.h"
#include "mojo/public/interfaces/service_provider/service_provider.mojom.h"

namespace content {

class ServiceRegistryImpl
: public ServiceRegistry,
public mojo::InterfaceImpl<mojo::IInterfaceProvider> {
class ServiceRegistryImpl : public ServiceRegistry,
public mojo::InterfaceImpl<mojo::ServiceProvider> {
public:
ServiceRegistryImpl();
explicit ServiceRegistryImpl(mojo::ScopedMessagePipeHandle handle);
virtual ~ServiceRegistryImpl();

// Binds to a remote ServiceProvider. This will expose added services to the
// remote ServiceProvider with the corresponding handle and enable
// GetInterface to provide access to services exposed by the remote
// ConnectToRemoteService to provide access to services exposed by the remote
// ServiceProvider.
void BindRemoteServiceProvider(mojo::ScopedMessagePipeHandle handle);

Expand All @@ -38,13 +37,13 @@ class ServiceRegistryImpl
const base::Callback<void(mojo::ScopedMessagePipeHandle)> service_factory)
OVERRIDE;
virtual void RemoveService(const std::string& service_name) OVERRIDE;
virtual void GetRemoteInterface(
virtual void ConnectToRemoteService(
const base::StringPiece& service_name,
mojo::ScopedMessagePipeHandle handle) OVERRIDE;

private:
// mojo::InterfaceImpl<mojo::IInterfaceProvider> overrides.
virtual void GetInterface(
// mojo::InterfaceImpl<mojo::ServiceProvider> overrides.
virtual void ConnectToService(
const mojo::String& name,
mojo::ScopedMessagePipeHandle client_handle) OVERRIDE;
virtual void OnConnectionError() OVERRIDE;
Expand Down
4 changes: 2 additions & 2 deletions content/common/render_frame_setup.mojom
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import "../../mojo/public/interfaces/interface_provider/interface_provider.mojom"
import "../../mojo/public/interfaces/service_provider/service_provider.mojom"

module content {

interface RenderFrameSetup {
GetServiceProviderForFrame(int32 frame_routing_id,
mojo.IInterfaceProvider& service_provider);
mojo.ServiceProvider& service_provider);
};

}
2 changes: 1 addition & 1 deletion content/content_app.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
}, { # OS!="ios"
'dependencies': [
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_manager',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../mojo/mojo.gyp:mojo_system_impl',
],
}],
Expand Down
2 changes: 1 addition & 1 deletion content/content_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -1568,8 +1568,8 @@
'../cc/cc.gyp:cc',
'../cc/cc.gyp:cc_surfaces',
'../mojo/mojo.gyp:mojo_cpp_bindings',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_js_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../net/net.gyp:http_server',
'../third_party/leveldatabase/leveldatabase.gyp:leveldatabase',
'../ui/surface/surface.gyp:surface',
Expand Down
2 changes: 1 addition & 1 deletion content/content_child.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'../base/base.gyp:base',
'../components/tracing.gyp:tracing',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../skia/skia.gyp:skia',
'../ui/base/ui_base.gyp:ui_base',
'../ui/gfx/gfx.gyp:gfx',
Expand Down
2 changes: 1 addition & 1 deletion content/content_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@
'../media/media.gyp:shared_memory_support',
'../mojo/mojo.gyp:mojo_cpp_bindings',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../mojo/mojo.gyp:mojo_system_impl',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../third_party/WebKit/public/blink.gyp:blink',
'../ui/gl/gl.gyp:gl',
'../webkit/common/gpu/webkit_gpu.gyp:webkit_gpu',
Expand Down
4 changes: 2 additions & 2 deletions content/content_common_mojo_bindings.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'dependencies': [
'../mojo/mojo.gyp:mojo_cpp_bindings',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_interface_provider_bindings'
'../mojo/mojo.gyp:mojo_service_provider_bindings'
],
'sources': [
'common/render_frame_setup.mojom',
Expand All @@ -19,7 +19,7 @@
'export_dependent_settings': [
'../mojo/mojo.gyp:mojo_cpp_bindings',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_interface_provider_bindings'
'../mojo/mojo.gyp:mojo_service_provider_bindings'
],
},
],
Expand Down
2 changes: 1 addition & 1 deletion content/content_gpu.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
'dependencies': [
'../base/base.gyp:base',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../skia/skia.gyp:skia',
'../ui/gl/gl.gyp:gl',
],
Expand Down
2 changes: 1 addition & 1 deletion content/content_plugin.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'conditions': [
['enable_plugins==1 and OS!="linux"', {
'dependencies': [
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../skia/skia.gyp:skia',
'../third_party/WebKit/public/blink.gyp:blink',
'../third_party/npapi/npapi.gyp:npapi',
Expand Down
2 changes: 1 addition & 1 deletion content/content_ppapi_plugin.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
['enable_plugins==1', {
'dependencies': [
'../base/base.gyp:base',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../ppapi/ppapi_internal.gyp:ppapi_ipc',
'../ui/base/ui_base.gyp:ui_base',
'../ui/gfx/gfx.gyp:gfx',
Expand Down
2 changes: 1 addition & 1 deletion content/content_renderer.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
'../jingle/jingle.gyp:jingle_glue',
'../media/media.gyp:media',
'../mojo/mojo.gyp:mojo_environment_chromium',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_js_bindings_lib',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../net/net.gyp:net',
'../skia/skia.gyp:skia',
'../third_party/WebKit/public/blink.gyp:blink',
Expand Down
2 changes: 1 addition & 1 deletion content/content_utility.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'dependencies': [
'../base/base.gyp:base',
'../courgette/courgette.gyp:courgette_lib',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
],
'sources': [
'public/utility/content_utility_client.cc',
Expand Down
2 changes: 1 addition & 1 deletion content/content_worker.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
'dependencies': [
'../base/base.gyp:base',
'../mojo/mojo.gyp:mojo_interface_provider_bindings',
'../mojo/mojo.gyp:mojo_service_provider_bindings',
'../skia/skia.gyp:skia',
'../third_party/WebKit/public/blink.gyp:blink',
],
Expand Down
2 changes: 1 addition & 1 deletion content/gpu/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ source_set("gpu") {
deps = [
"//base",
"//content:export",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//skia",
"//ui/gl",
]
Expand Down
2 changes: 1 addition & 1 deletion content/plugin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (enable_plugins && !is_linux) {

deps = [
"//content:export",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//skia",
"//third_party/npapi",
"//third_party/WebKit/public:blink",
Expand Down
2 changes: 1 addition & 1 deletion content/ppapi_plugin/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ source_set("ppapi_plugin") {
deps = [
"//base",
"//content:export",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//ppapi:ppapi_ipc",
"//skia",
"//third_party/icu",
Expand Down
15 changes: 8 additions & 7 deletions content/public/common/service_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ namespace content {

// A ServiceRegistry exposes local services that have been added using
// AddService to a paired remote ServiceRegistry and provides local access to
// services exposed by the remote ServiceRegistry through GetInterface.
// services exposed by the remote ServiceRegistry through
// ConnectToRemoteService.
class CONTENT_EXPORT ServiceRegistry {
public:
virtual ~ServiceRegistry() {}

// Make the service created by |service_factory| available to the remote
// InterfaceProvider. In response to each request for a service,
// ServiceProvider. In response to each request for a service,
// |service_factory| will be run with an InterfaceRequest<Interface>
// representing that request.
template <typename Interface>
Expand All @@ -48,15 +49,15 @@ class CONTENT_EXPORT ServiceRegistry {
}
virtual void RemoveService(const std::string& service_name) = 0;

// Connect to an interface provided by the remote interface provider.
// Connect to an interface provided by the remote service provider.
template <typename Interface>
void GetRemoteInterface(mojo::InterfacePtr<Interface>* ptr) {
void ConnectToRemoteService(mojo::InterfacePtr<Interface>* ptr) {
mojo::MessagePipe pipe;
ptr->Bind(pipe.handle0.Pass());
GetRemoteInterface(Interface::Name_, pipe.handle1.Pass());
ConnectToRemoteService(Interface::Name_, pipe.handle1.Pass());
}
virtual void GetRemoteInterface(const base::StringPiece& name,
mojo::ScopedMessagePipeHandle handle) = 0;
virtual void ConnectToRemoteService(const base::StringPiece& name,
mojo::ScopedMessagePipeHandle handle) = 0;

private:
template <typename Interface>
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ source_set("renderer") {
"//gin",
"//mojo/environment:chromium",
"//mojo/public/js/bindings",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//net",
"//skia",
"//third_party/icu",
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/render_thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class RenderFrameSetupImpl : public mojo::InterfaceImpl<RenderFrameSetup> {
public:
virtual void GetServiceProviderForFrame(
int32_t frame_routing_id,
mojo::InterfaceRequest<mojo::IInterfaceProvider> request) OVERRIDE {
mojo::InterfaceRequest<mojo::ServiceProvider> request) OVERRIDE {
RenderFrameImpl* frame = RenderFrameImpl::FromRoutingID(frame_routing_id);
// We can receive a GetServiceProviderForFrame message for a frame not yet
// created due to a race between the message and a ViewMsg_New IPC that
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/web_ui_mojo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void WebUIMojo::OnDidFinishDocumentLoad() {
SetHandleOnContextState(pipe.handle0.Pass());
RenderFrame::FromWebFrame(render_view()->GetWebView()->mainFrame())->
GetServiceRegistry()->
GetRemoteInterface("webui_controller", pipe.handle1.Pass());
ConnectToRemoteService("webui_controller", pipe.handle1.Pass());
}

void WebUIMojo::SetHandleOnContextState(mojo::ScopedMessagePipeHandle handle) {
Expand Down
2 changes: 1 addition & 1 deletion content/utility/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ source_set("utility") {
"//base",
"//content:export",
"//courgette:courgette_lib",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//third_party/WebKit/public:blink_headers",
]
}
Expand Down
2 changes: 1 addition & 1 deletion content/worker/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ source_set("worker") {

deps = [
"//base",
"//mojo/public/interfaces/interface_provider",
"//mojo/public/interfaces/service_provider",
"//skia",
"//third_party/WebKit/public:blink",
]
Expand Down
15 changes: 0 additions & 15 deletions mojo/mojo_public.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -379,21 +379,6 @@
'..',
],
},
{
# GN version: //mojo/public/interfaces/interface_provider:interface_provider
'target_name': 'mojo_interface_provider_bindings',
'type': 'static_library',
'sources': [
'public/interfaces/interface_provider/interface_provider.mojom',
],
'includes': [ 'public/tools/bindings/mojom_bindings_generator.gypi' ],
'dependencies': [
'mojo_cpp_bindings',
],
'export_dependent_settings': [
'mojo_cpp_bindings',
],
},
{
# GN version: //mojo/public/interfaces/service_provider:service_provider
'target_name': 'mojo_service_provider_bindings',
Expand Down
11 changes: 0 additions & 11 deletions mojo/public/interfaces/interface_provider/BUILD.gn

This file was deleted.

Loading

0 comments on commit 8c4e867

Please sign in to comment.