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

Unified Diff: content/renderer/mus/render_widget_window_tree_client_factory.cc

Issue 2138263002: Revert of 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, 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/renderer/mus/render_widget_window_tree_client_factory.cc
diff --git a/content/renderer/mus/render_widget_window_tree_client_factory.cc b/content/renderer/mus/render_widget_window_tree_client_factory.cc
index a068781875828229fc483370ca6d8b752d7e54a7..ef56edd1be5ddd10bc8fa4a5665ac2064db50596 100644
--- a/content/renderer/mus/render_widget_window_tree_client_factory.cc
+++ b/content/renderer/mus/render_widget_window_tree_client_factory.cc
@@ -9,14 +9,11 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/sequenced_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "content/common/render_widget_window_tree_client_factory.mojom.h"
-#include "content/public/common/connection_filter.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/renderer/mus/render_widget_mus_connection.h"
#include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/shell/public/cpp/connection.h"
#include "services/shell/public/cpp/interface_factory.h"
#include "services/shell/public/cpp/service.h"
#include "services/ui/public/interfaces/window_tree.mojom.h"
@@ -26,34 +23,23 @@
namespace {
-void BindMusConnectionOnMainThread(
- uint32_t routing_id,
- ui::mojom::WindowTreeClientRequest request) {
- RenderWidgetMusConnection* connection =
- RenderWidgetMusConnection::GetOrCreate(routing_id);
- connection->Bind(std::move(request));
-}
-
// This object's lifetime is managed by MojoShellConnection because it's a
// registered with it.
class RenderWidgetWindowTreeClientFactoryImpl
- : public ConnectionFilter,
+ : public shell::Service,
public shell::InterfaceFactory<
mojom::RenderWidgetWindowTreeClientFactory>,
public mojom::RenderWidgetWindowTreeClientFactory {
public:
RenderWidgetWindowTreeClientFactoryImpl() {
DCHECK(MojoShellConnection::GetForProcess());
-
- main_thread_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
~RenderWidgetWindowTreeClientFactoryImpl() override {}
private:
- // ConnectionFilter implementation:
- bool OnConnect(shell::Connection* connection,
- shell::Connector* connector) override {
+ // shell::Service implementation:
+ bool OnConnect(shell::Connection* connection) override {
connection->AddInterface<mojom::RenderWidgetWindowTreeClientFactory>(this);
return true;
}
@@ -68,13 +54,12 @@
// mojom::RenderWidgetWindowTreeClientFactory implementation.
void CreateWindowTreeClientForRenderWidget(
uint32_t routing_id,
- ui::mojom::WindowTreeClientRequest request) override {
- main_thread_task_runner_->PostTask(
- FROM_HERE, base::Bind(&BindMusConnectionOnMainThread, routing_id,
- base::Passed(&request)));
+ mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) override {
+ RenderWidgetMusConnection* connection =
+ RenderWidgetMusConnection::GetOrCreate(routing_id);
+ connection->Bind(std::move(request));
}
- scoped_refptr<base::SequencedTaskRunner> main_thread_task_runner_;
mojo::BindingSet<mojom::RenderWidgetWindowTreeClientFactory> bindings_;
DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl);
@@ -82,10 +67,9 @@
} // namespace
-void CreateRenderWidgetWindowTreeClientFactory(
- MojoShellConnection* connection) {
- connection->AddConnectionFilter(
- base::MakeUnique<RenderWidgetWindowTreeClientFactoryImpl>());
+void CreateRenderWidgetWindowTreeClientFactory() {
+ MojoShellConnection::GetForProcess()->MergeService(
+ base::WrapUnique(new RenderWidgetWindowTreeClientFactoryImpl));
}
} // namespace content
« no previous file with comments | « content/renderer/mus/render_widget_window_tree_client_factory.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698