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-05-23 13:31:33 +0200
commitf5884c47c29bc65e6ce78b790a782e5ecf17e3b6 (patch)
tree1c2d29ec59eaca328c17b0c7342336752a48853b
parente6fbb0a33e5d34bcdace02c0eef046a47b563fe8 (diff)
downloadqtwebengine-chromium-f5884c47c29bc65e6ce78b790a782e5ecf17e3b6.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 861c2f856c3..1b64290efe6 100644
--- a/chromium/content/gpu/gpu_child_thread.cc
+++ b/chromium/content/gpu/gpu_child_thread.cc
@@ -19,6 +19,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"
@@ -163,10 +164,13 @@ viz::VizMainImpl::ExternalDependencies CreateVizMainDependencies(
} // namespace
+GpuChildThread* GpuChildThread::instance_ = 0;
+
GpuChildThread::GpuChildThread(std::unique_ptr<gpu::GpuInit> gpu_init,
viz::VizMainImpl::LogMessages log_messages)
: GpuChildThread(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(const ChildThreadImpl::Options& options,
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kInProcessGPU));
}
+ instance_ = this;
}
GpuChildThread::~GpuChildThread() = default;
@@ -271,6 +276,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 417035ddcb0..e75b24091ba 100644
--- a/chromium/content/gpu/gpu_child_thread.h
+++ b/chromium/content/gpu/gpu_child_thread.h
@@ -58,6 +58,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(const ChildThreadImpl::Options& options,
std::unique_ptr<gpu::GpuInit> gpu_init);
@@ -106,6 +112,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 63cb3851db0..d456708668d 100644
--- a/chromium/content/public/browser/content_browser_client.h
+++ b/chromium/content/public/browser/content_browser_client.h
@@ -69,6 +69,10 @@ namespace gfx {
class ImageSkia;
}
+namespace gl {
+class GLShareGroup;
+}
+
namespace media {
class AudioLogFactory;
class AudioManager;
@@ -740,6 +744,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 d055d942177..d518c2f1ea0 100644
--- a/chromium/gpu/ipc/service/gpu_channel_manager.cc
+++ b/chromium/gpu/ipc/service/gpu_channel_manager.cc
@@ -130,6 +130,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 598f39ed4d1..e84560a5b1a 100644
--- a/chromium/gpu/ipc/service/gpu_channel_manager.h
+++ b/chromium/gpu/ipc/service/gpu_channel_manager.h
@@ -130,6 +130,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 94708c09202..2c93a983cb3 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.