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

Unified Diff: content/common/mojo/mojo_shell_connection_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: . Created 4 years, 6 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/common/mojo/mojo_shell_connection_impl.h
diff --git a/content/common/mojo/mojo_shell_connection_impl.h b/content/common/mojo/mojo_shell_connection_impl.h
index b20cd0ad4cb67e410ac21fa20f9b93872646b7ec..813a2254a12e6d6b47d9ee27e1c12dbcce517b70 100644
--- a/content/common/mojo/mojo_shell_connection_impl.h
+++ b/content/common/mojo/mojo_shell_connection_impl.h
@@ -6,69 +6,63 @@
#define CONTENT_COMMON_MOJO_SHELL_CONNECTION_IMPL_H_
#include <memory>
-#include <vector>
#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/sequenced_task_runner.h"
#include "content/public/common/mojo_shell_connection.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "services/shell/public/cpp/shell_client.h"
-#include "services/shell/public/cpp/shell_connection.h"
-#include "services/shell/public/interfaces/shell_client_factory.mojom.h"
+#include "services/shell/public/cpp/identity.h"
+
+namespace shell {
+class Connector;
+}
namespace content {
class EmbeddedApplicationRunner;
-class MojoShellConnectionImpl
- : public MojoShellConnection,
- public shell::ShellClient,
- public shell::InterfaceFactory<shell::mojom::ShellClientFactory>,
- public shell::mojom::ShellClientFactory {
-
+class MojoShellConnectionImpl : public MojoShellConnection {
public:
- explicit MojoShellConnectionImpl(shell::mojom::ShellClientRequest request);
+ explicit MojoShellConnectionImpl(
+ shell::mojom::ShellClientRequest request,
+ scoped_refptr<base::SequencedTaskRunner> iotask_runner);
~MojoShellConnectionImpl() override;
private:
+ class IOThreadContext;
+
// MojoShellConnection:
- shell::ShellConnection* GetShellConnection() override;
+ void SetInitializeHandler(const base::Closure& handler) override;
shell::Connector* GetConnector() override;
const shell::Identity& GetIdentity() const override;
void SetConnectionLostClosure(const base::Closure& closure) override;
- void AddEmbeddedShellClient(
- std::unique_ptr<shell::ShellClient> shell_client) override;
- void AddEmbeddedShellClient(shell::ShellClient* shell_client) override;
+ void AddConnectionFilter(const ConnectionFilter& filter) override;
void AddEmbeddedService(const std::string& name,
const MojoApplicationInfo& info) override;
void AddShellClientRequestHandler(
const std::string& name,
const ShellClientRequestHandler& handler) override;
- // shell::ShellClient:
- void Initialize(shell::Connector* connector,
- const shell::Identity& identity,
- uint32_t id) override;
- bool AcceptConnection(shell::Connection* connection) override;
- shell::InterfaceRegistry* GetInterfaceRegistryForConnection() override;
- shell::InterfaceProvider* GetInterfaceProviderForConnection() override;
+ void OnContextInitialized();
+ void OnConnectionLost();
+ void CreateShellClient(shell::mojom::ShellClientRequest request,
+ const mojo::String& name);
- // shell::InterfaceFactory<shell::mojom::ShellClientFactory>:
- void Create(shell::Connection* connection,
- shell::mojom::ShellClientFactoryRequest request) override;
+ shell::Identity identity_;
- // shell::mojom::ShellClientFactory:
- void CreateShellClient(shell::mojom::ShellClientRequest request,
- const mojo::String& name) override;
+ std::unique_ptr<shell::Connector> connector_;
+ scoped_refptr<IOThreadContext> context_;
+
+ base::Closure initialize_handler_;
+ base::Closure connection_lost_handler_;
- std::unique_ptr<shell::ShellConnection> shell_connection_;
- mojo::BindingSet<shell::mojom::ShellClientFactory> factory_bindings_;
- std::vector<shell::ShellClient*> embedded_shell_clients_;
- std::vector<std::unique_ptr<shell::ShellClient>> owned_shell_clients_;
std::unordered_map<std::string, std::unique_ptr<EmbeddedApplicationRunner>>
embedded_apps_;
std::unordered_map<std::string, ShellClientRequestHandler> request_handlers_;
+ base::WeakPtrFactory<MojoShellConnectionImpl> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MojoShellConnectionImpl);
};

Powered by Google App Engine
This is Rietveld 408576698