summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-08-04 18:07:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-12-20 13:50:54 +0100
commit543d36d9c21d4e78a8409c46a7a002c651f0e6ce (patch)
tree42281d3f6eb2f28dc96bd69d637143da862aa875
parent918d18d514dea175d8102642628cf4e011991fa7 (diff)
downloadqtwebengine-chromium-543d36d9c21d4e78a8409c46a7a002c651f0e6ce.tar.gz
Add accessors and seams for the Qt delegated renderer integration.
This is needed to fetch the MessageLoop, the MailboxManager and the SyncPointManager of the GPU in-process host. And fetch the right shared context for the in GPU thread. Change-Id: I7f38e32b2df11da5b046f16643841d34260c11fb Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/content/gpu/gpu_child_thread.cc9
-rw-r--r--chromium/content/gpu/gpu_child_thread.h8
-rw-r--r--chromium/content/public/browser/content_browser_client.h8
-rw-r--r--chromium/gpu/ipc/service/gpu_channel_manager.cc4
-rw-r--r--chromium/gpu/ipc/service/gpu_channel_manager.h1
-rw-r--r--chromium/ui/gl/gl_share_group.cc3
-rw-r--r--chromium/ui/gl/gl_share_group.h7
7 files changed, 38 insertions, 2 deletions
diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc
index 66a559d42e7..cb7de7a73a9 100644
--- a/chromium/content/gpu/gpu_child_thread.cc
+++ b/chromium/content/gpu/gpu_child_thread.cc
@@ -20,6 +20,7 @@
#include "components/viz/common/features.h"
#include "content/child/child_process.h"
#include "content/gpu/gpu_service_factory.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/common/connection_filter.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
@@ -157,6 +158,8 @@ viz::VizMainImpl::ExternalDependencies CreateVizMainDependencies(
} // namespace
+GpuChildThread* GpuChildThread::instance_ = 0;
+
GpuChildThread::GpuChildThread(base::RepeatingClosure quit_closure,
std::unique_ptr<gpu::GpuInit> gpu_init,
viz::VizMainImpl::LogMessages log_messages)
@@ -164,6 +167,7 @@ GpuChildThread::GpuChildThread(base::RepeatingClosure quit_closure,
GetOptions(),
std::move(gpu_init)) {
viz_main_.SetLogMessagesForHost(std::move(log_messages));
+ instance_ = this;
}
GpuChildThread::GpuChildThread(const InProcessChildThreadParams& params,
@@ -191,6 +195,7 @@ GpuChildThread::GpuChildThread(base::RepeatingClosure quit_closure,
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kInProcessGPU));
}
+ instance_ = this;
}
GpuChildThread::~GpuChildThread() {
@@ -274,6 +279,10 @@ void GpuChildThread::OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) {
overlay_factory_cb);
#endif
+#if defined(TOOLKIT_QT)
+ gpu_channel_manager()->set_share_group(GetContentClient()->browser()->GetInProcessGpuShareGroup());
+#endif
+
// Only set once per process instance.
service_factory_.reset(new GpuServiceFactory(
gpu_service->gpu_preferences(),
diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h
index 74560c109cd..6910cffedac 100644
--- a/chromium/content/gpu/gpu_child_thread.h
+++ b/chromium/content/gpu/gpu_child_thread.h
@@ -61,6 +61,12 @@ class GpuChildThread : public ChildThreadImpl,
void Init(const base::Time& process_start_time);
+ static GpuChildThread* instance() { return instance_; }
+
+ gpu::GpuChannelManager* gpu_channel_manager() {
+ return viz_main_.gpu_service()->gpu_channel_manager();
+ }
+
private:
GpuChildThread(base::RepeatingClosure quit_closure,
const ChildThreadImpl::Options& options,
@@ -129,6 +135,8 @@ class GpuChildThread : public ChildThreadImpl,
base::WeakPtrFactory<GpuChildThread> weak_factory_;
+ static GpuChildThread* instance_;
+
DISALLOW_COPY_AND_ASSIGN(GpuChildThread);
};
diff --git a/chromium/content/public/browser/content_browser_client.h b/chromium/content/public/browser/content_browser_client.h
index b33545b865e..e65508a9405 100644
--- a/chromium/content/public/browser/content_browser_client.h
+++ b/chromium/content/public/browser/content_browser_client.h
@@ -84,6 +84,10 @@ namespace gfx {
class ImageSkia;
}
+namespace gl {
+class GLShareGroup;
+}
+
namespace media {
class AudioLogFactory;
class AudioManager;
@@ -857,6 +861,10 @@ class CONTENT_EXPORT ContentBrowserClient {
std::vector<std::unique_ptr<storage::FileSystemBackend>>*
additional_backends) {}
+ // Allow an embedder to provide a share group reimplementation to connect renderer
+ // GL contexts with the root compositor.
+ virtual gl::GLShareGroup* GetInProcessGpuShareGroup() { return 0; }
+
// Creates a new DevToolsManagerDelegate. The caller owns the returned value.
// It's valid to return nullptr.
virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate();
diff --git a/chromium/gpu/ipc/service/gpu_channel_manager.cc b/chromium/gpu/ipc/service/gpu_channel_manager.cc
index 43ce4bda0ed..20f24802f5f 100644
--- a/chromium/gpu/ipc/service/gpu_channel_manager.cc
+++ b/chromium/gpu/ipc/service/gpu_channel_manager.cc
@@ -145,6 +145,10 @@ GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const {
return it != gpu_channels_.end() ? it->second.get() : nullptr;
}
+void GpuChannelManager::set_share_group(gl::GLShareGroup* share_group) {
+ share_group_ = share_group;
+}
+
GpuChannel* GpuChannelManager::EstablishChannel(int client_id,
uint64_t client_tracing_id,
bool is_gpu_host,
diff --git a/chromium/gpu/ipc/service/gpu_channel_manager.h b/chromium/gpu/ipc/service/gpu_channel_manager.h
index 1e002bb76b6..89bfbb77407 100644
--- a/chromium/gpu/ipc/service/gpu_channel_manager.h
+++ b/chromium/gpu/ipc/service/gpu_channel_manager.h
@@ -142,6 +142,7 @@ class GPU_IPC_SERVICE_EXPORT GpuChannelManager
MailboxManager* mailbox_manager() { return mailbox_manager_.get(); }
gl::GLShareGroup* share_group() const { return share_group_.get(); }
+ void set_share_group(gl::GLShareGroup* share_group);
SyncPointManager* sync_point_manager() const { return sync_point_manager_; }
diff --git a/chromium/ui/gl/gl_share_group.cc b/chromium/ui/gl/gl_share_group.cc
index e9386c4b03d..83b8618dd52 100644
--- a/chromium/ui/gl/gl_share_group.cc
+++ b/chromium/ui/gl/gl_share_group.cc
@@ -20,6 +20,9 @@ GLShareGroup::GLShareGroup()
}
void GLShareGroup::AddContext(GLContext* context) {
+ if (contexts_.empty())
+ AboutToAddFirstContext();
+
contexts_.insert(context);
}
diff --git a/chromium/ui/gl/gl_share_group.h b/chromium/ui/gl/gl_share_group.h
index 99ce887d9e2..87961c69faa 100644
--- a/chromium/ui/gl/gl_share_group.h
+++ b/chromium/ui/gl/gl_share_group.h
@@ -34,7 +34,7 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> {
// Returns a pointer to any initialized context in the share group
// or NULL if there are no initialized contexts in the share group.
- GLContext* GetContext();
+ virtual GLContext* GetContext();
// Sets and returns the shared GL context. Used for context virtualization.
void SetSharedContext(GLSurface* compatible, GLContext* context);
@@ -47,10 +47,13 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> {
int GetRendererID();
#endif
+ protected:
+ virtual ~GLShareGroup();
+ virtual void AboutToAddFirstContext() { }
+
private:
friend class base::RefCounted<GLShareGroup>;
- ~GLShareGroup();
// References to GLContext are by raw pointer to avoid a reference count
// cycle.