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

Unified Diff: content/browser/renderer_host/render_process_host_impl.h

Issue 2310563002: Adds routed interface support between RenderFrameHost and RenderFrame (Closed)
Patch Set: Created 4 years, 3 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/browser/renderer_host/render_process_host_impl.h
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index aad3a30c3e4ffb0e12aa8b4ba1a768727f7e3326..f23c8973ac929f2f2b2e83ad342bfcee63ca59e0 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -29,6 +29,8 @@
#include "content/public/common/mojo_shell_connection.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_platform_file.h"
+#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "mojo/public/cpp/bindings/associated_binding_set.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "services/shell/public/cpp/interface_registry.h"
#include "services/shell/public/interfaces/service.mojom.h"
@@ -106,7 +108,8 @@ typedef base::Thread* (*RendererMainThreadFactoryFunction)(
class CONTENT_EXPORT RenderProcessHostImpl
: public RenderProcessHost,
public ChildProcessLauncher::Client,
- public ui::GpuSwitchingObserver {
+ public ui::GpuSwitchingObserver,
+ public NON_EXPORTED_BASE(mojom::RouteProvider) {
public:
RenderProcessHostImpl(BrowserContext* browser_context,
StoragePartitionImpl* storage_partition_impl,
@@ -119,6 +122,9 @@ class CONTENT_EXPORT RenderProcessHostImpl
int GetNextRoutingID() override;
void AddRoute(int32_t routing_id, IPC::Listener* listener) override;
void RemoveRoute(int32_t routing_id) override;
+ void AddRoutedInterfaces(int32_t routing_id,
+ mojom::RoutedInterfaceProvider* provider) override;
+ mojo::AssociatedGroup* GetRoutedInterfaceGroup() override;
void AddObserver(RenderProcessHostObserver* observer) override;
void RemoveObserver(RenderProcessHostObserver* observer) override;
void ShutdownForBadMessage() override;
@@ -165,6 +171,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
void ResumeDeferredNavigation(const GlobalRequestID& request_id) override;
void NotifyTimezoneChange(const std::string& timezone) override;
shell::InterfaceProvider* GetRemoteInterfaces() override;
+ mojom::RouteProvider* GetRemoteRouteProvider() override;
std::unique_ptr<base::SharedPersistentMemoryAllocator> TakeMetricsAllocator()
override;
const base::TimeTicks& GetInitTimeForNavigationMetrics() const override;
@@ -321,6 +328,11 @@ class CONTENT_EXPORT RenderProcessHostImpl
// Registers Mojo interfaces to be exposed to the renderer.
void RegisterMojoInterfaces();
+ // mojom::RouteProvider:
+ void GetRoutedInterfaces(
+ int32_t routing_id,
+ mojom::RoutedInterfaceProviderAssociatedRequest request) override;
+
void CreateStoragePartitionService(
mojo::InterfaceRequest<mojom::StoragePartitionService> request);
@@ -355,6 +367,8 @@ class CONTENT_EXPORT RenderProcessHostImpl
// Handle termination of our process.
void ProcessDied(bool already_dead, RendererClosedDetails* known_details);
+ void OnRouteProviderRequest(mojom::RouteProviderAssociatedRequest request);
+
// GpuSwitchingObserver implementation.
void OnGpuSwitched() override;
@@ -421,6 +435,14 @@ class CONTENT_EXPORT RenderProcessHostImpl
// delete ourselves.
IDMap<IPC::Listener> listeners_;
+ // Registered routed interface providers. These are not owned.
+ std::map<int32_t, mojom::RoutedInterfaceProvider*>
+ routed_interface_providers_;
+
+ mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_;
+ mojo::AssociatedBindingSet<mojom::RoutedInterfaceProvider>
+ routed_interface_provider_bindings_;
+
// The count of currently visible widgets. Since the host can be a container
// for multiple widgets, it uses this count to determine when it should be
// backgrounded.
@@ -457,11 +479,8 @@ class CONTENT_EXPORT RenderProcessHostImpl
// Used to launch and terminate the process without blocking the UI thread.
std::unique_ptr<ChildProcessLauncher> child_process_launcher_;
- // Messages we queue while waiting for the process handle. We queue them here
- // instead of in the channel so that we ensure they're sent after init related
- // messages that are sent once the process handle is available. This is
- // because the queued messages may have dependencies on the init messages.
- std::queue<IPC::Message*> queued_messages_;
+ // Messages we queue before the ChannelProxy is created.
+ std::queue<std::unique_ptr<IPC::Message>> queued_messages_;
// The globally-unique identifier for this RPH.
const int id_;
@@ -568,6 +587,8 @@ class CONTENT_EXPORT RenderProcessHostImpl
scoped_refptr<ResourceMessageFilter> resource_message_filter_;
+ mojom::RouteProviderAssociatedPtr remote_route_provider_;
+
// A WeakPtrFactory which is reset every time Cleanup() runs. Used to vend
// WeakPtrs which are invalidated any time the RPHI is recycled.
std::unique_ptr<base::WeakPtrFactory<RenderProcessHostImpl>>

Powered by Google App Engine
This is Rietveld 408576698