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

Unified Diff: content/child/child_thread_impl.h

Issue 2111353002: Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « content/child/background_sync/background_sync_provider.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.h
diff --git a/content/child/child_thread_impl.h b/content/child/child_thread_impl.h
index 368089076a95972d9a2504d65b3f0b88b0aad6e2..a68a63924d3fdfd99d43f1cb64c0498bf9046169 100644
--- a/content/child/child_thread_impl.h
+++ b/content/child/child_thread_impl.h
@@ -23,7 +23,6 @@
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#include "ipc/ipc_platform_file.h"
#include "ipc/message_router.h"
-#include "services/shell/public/cpp/service.h"
namespace base {
class MessageLoop;
@@ -68,8 +67,7 @@ struct RequestInfo;
// The main thread of a child process derives from this class.
class CONTENT_EXPORT ChildThreadImpl
: public IPC::Listener,
- virtual public ChildThread,
- public NON_EXPORTED_BASE(shell::Service){
+ virtual public ChildThread {
public:
struct CONTENT_EXPORT Options;
@@ -101,10 +99,6 @@ class CONTENT_EXPORT ChildThreadImpl
shell::InterfaceRegistry* GetInterfaceRegistry() override;
shell::InterfaceProvider* GetRemoteInterfaces() override;
- // shell::Service:
- shell::InterfaceRegistry* GetInterfaceRegistryForConnection() override;
- shell::InterfaceProvider* GetInterfaceProviderForConnection() override;
-
IPC::SyncChannel* channel() { return channel_.get(); }
IPC::MessageRouter* GetRouter();
@@ -209,6 +203,11 @@ class CONTENT_EXPORT ChildThreadImpl
// Called when the process refcount is 0.
void OnProcessFinalRelease();
+ // Called by subclasses to manually start the MojoShellConnection. Must only
+ // be called if ChildThreadImpl::Options::auto_start_mojo_shell_connection
+ // was set to |false| on ChildThreadImpl construction.
+ void StartMojoShellConnection();
+
virtual bool OnControlMessageReceived(const IPC::Message& msg);
virtual void OnProcessBackgrounded(bool backgrounded);
virtual void OnProcessPurgeAndSuspend();
@@ -253,9 +252,9 @@ class CONTENT_EXPORT ChildThreadImpl
void EnsureConnected();
std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_;
- std::unique_ptr<MojoShellConnection> mojo_shell_connection_;
std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
+ std::unique_ptr<MojoShellConnection> mojo_shell_connection_;
std::string channel_name_;
std::unique_ptr<IPC::SyncChannel> channel_;
@@ -309,7 +308,10 @@ class CONTENT_EXPORT ChildThreadImpl
scoped_refptr<base::SequencedTaskRunner> browser_process_io_runner_;
- base::WeakPtrFactory<ChildThreadImpl> channel_connected_factory_;
+ std::unique_ptr<base::WeakPtrFactory<ChildThreadImpl>>
+ channel_connected_factory_;
+
+ base::WeakPtrFactory<ChildThreadImpl> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl);
};
@@ -322,6 +324,7 @@ struct ChildThreadImpl::Options {
std::string channel_name;
bool use_mojo_channel;
+ bool auto_start_mojo_shell_connection;
scoped_refptr<base::SequencedTaskRunner> browser_process_io_runner;
std::vector<IPC::MessageFilter*> startup_filters;
std::string in_process_ipc_token;
@@ -337,6 +340,7 @@ class ChildThreadImpl::Options::Builder {
Builder& InBrowserProcess(const InProcessChildThreadParams& params);
Builder& UseMojoChannel(bool use_mojo_channel);
+ Builder& AutoStartMojoShellConnection(bool auto_start);
Builder& WithChannelName(const std::string& channel_name);
Builder& AddStartupFilter(IPC::MessageFilter* filter);
« no previous file with comments | « content/child/background_sync/background_sync_provider.cc ('k') | content/child/child_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698