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 |