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

Unified Diff: content/gpu/gpu_child_thread.cc

Issue 2132793002: 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
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/public/browser/render_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_child_thread.cc
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index 2af9cf9fd6a3d26161a3be97b651d4823c3969f5..af207abecc83bbbb6b4f90ae422748405757120e 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -18,13 +18,10 @@
#include "content/child/thread_safe_sender.h"
#include "content/common/establish_channel_params.h"
#include "content/common/gpu_host_messages.h"
-#include "content/common/process_control.mojom.h"
#include "content/gpu/gpu_process_control_impl.h"
#include "content/gpu/gpu_watchdog_thread.h"
-#include "content/public/common/connection_filter.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
-#include "content/public/common/mojo_shell_connection.h"
#include "content/public/gpu/content_gpu_client.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
@@ -39,10 +36,6 @@
#include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
#include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
#include "media/gpu/ipc/service/media_service.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/interface_registry.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gpu_switching_manager.h"
@@ -146,41 +139,6 @@
return builder.Build();
}
-
-// Connection filter for incoming connections from other shell clients.
-class GpuConnectionFilter
- : public ConnectionFilter,
- public shell::InterfaceFactory<mojom::ProcessControl> {
- public:
- GpuConnectionFilter() {}
- ~GpuConnectionFilter() override {}
-
- private:
- // ConnectionFilter:
- bool OnConnect(shell::Connection* connection,
- shell::Connector* connector) override {
- connection->AddInterface<mojom::ProcessControl>(this);
- return true;
- }
-
- // shell::InterfaceFactory<mojom::ProcessControl>:
- void Create(shell::Connection* connection,
- mojom::ProcessControlRequest request) override {
- process_control_bindings_.AddBinding(&process_control_, std::move(request));
- }
-
- // Process control for Mojo application hosting.
- //
- // TODO(rockot): Remove this. To host mojo:media in the gpu process, we should
- // simply package mojo:media in exe:content_gpu and use the ShellClientFactory
- // idiom.
- GpuProcessControlImpl process_control_;
-
- // Bindings to the mojom::ProcessControl impl.
- mojo::BindingSet<mojom::ProcessControl> process_control_bindings_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuConnectionFilter);
-};
} // namespace
@@ -260,14 +218,8 @@
media::SetMediaClientAndroid(GetContentClient()->GetMediaClientAndroid());
#endif
- if (GetContentClient()->gpu()) { // NULL in tests.
- GetContentClient()->gpu()->ExposeInterfacesToBrowser(
- GetInterfaceRegistry());
- }
-
- // We don't want to process any incoming interface requests until
- // OnInitialize() is invoked.
- GetInterfaceRegistry()->PauseBinding();
+ // Only set once per process instance.
+ process_control_.reset(new GpuProcessControlImpl());
if (GetContentClient()->gpu()) // NULL in tests.
GetContentClient()->gpu()->Initialize(this);
@@ -276,10 +228,6 @@
void GpuChildThread::OnFieldTrialGroupFinalized(const std::string& trial_name,
const std::string& group_name) {
Send(new GpuHostMsg_FieldTrialActivated(trial_name));
-}
-
-void GpuChildThread::AddConnectionFilters(MojoShellConnection* connection) {
- connection->AddConnectionFilter(base::MakeUnique<GpuConnectionFilter>());
}
bool GpuChildThread::Send(IPC::Message* msg) {
@@ -342,6 +290,37 @@
return false;
}
+bool GpuChildThread::OnConnect(shell::Connection* connection) {
+ // Use of base::Unretained(this) is safe here because |service_registry()|
+ // will be destroyed before GpuChildThread is destructed.
+ connection->GetInterfaceRegistry()->AddInterface(base::Bind(
+ &GpuChildThread::BindProcessControlRequest, base::Unretained(this)));
+
+ if (GetContentClient()->gpu()) { // NULL in tests.
+ GetContentClient()->gpu()->ExposeInterfacesToBrowser(
+ connection->GetInterfaceRegistry());
+ }
+
+ // We don't want to process any incoming interface requests until
+ // OnInitialize().
+ if (!gpu_channel_manager_) {
+ connection->GetInterfaceRegistry()->PauseBinding();
+ resume_interface_bindings_callback_ = base::Bind(
+ &shell::InterfaceRegistry::ResumeBinding,
+ connection->GetInterfaceRegistry()->GetWeakPtr());
+ }
+
+ return true;
+}
+
+shell::InterfaceRegistry* GpuChildThread::GetInterfaceRegistryForConnection() {
+ return nullptr;
+}
+
+shell::InterfaceProvider* GpuChildThread::GetInterfaceProviderForConnection() {
+ return nullptr;
+}
+
void GpuChildThread::SetActiveURL(const GURL& url) {
GetContentClient()->SetActiveURL(url);
}
@@ -385,7 +364,8 @@
}
void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) {
- GetInterfaceRegistry()->ResumeBinding();
+ if (!resume_interface_bindings_callback_.is_null())
+ base::ResetAndReturn(&resume_interface_bindings_callback_).Run();
gpu_preferences_ = gpu_preferences;
@@ -603,4 +583,12 @@
}
}
+void GpuChildThread::BindProcessControlRequest(
+ mojo::InterfaceRequest<mojom::ProcessControl> request) {
+ DVLOG(1) << "GPU: Binding ProcessControl request";
+ DCHECK(process_control_);
+ process_control_bindings_.AddBinding(process_control_.get(),
+ std::move(request));
+}
+
} // namespace content
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/public/browser/render_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698