summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2013-10-24 18:26:59 +0200
committerAndras Becsi <andras.becsi@digia.com>2014-06-04 18:10:21 +0200
commit743758ab8a8af172fe8d20b27f53e244ffb8fc05 (patch)
treeac6f0730e3905ef0e94be350f1aed06d197c9872
parentbf1fb16eebf9ca9e29acfa63b42e68c6e96abdf9 (diff)
downloadqtwebengine-chromium-743758ab8a8af172fe8d20b27f53e244ffb8fc05.tar.gz
<chromium> Add seams to setup GL contexts sharing with QtQuick.
This will allow us to know right before the first GL context is instantiated by Chromium so that we can install those contexts to be shared with QtQuick GL contexts as well. Change-Id: Id55337a7b42d25ac084698a23dbfab06cb273505 Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
-rw-r--r--chromium/content/common/gpu/gpu_channel_manager.cc8
-rw-r--r--chromium/content/public/browser/content_browser_client.h5
-rw-r--r--chromium/ui/gl/gl_share_group.cc3
-rw-r--r--chromium/ui/gl/gl_share_group.h7
4 files changed, 20 insertions, 3 deletions
diff --git a/chromium/content/common/gpu/gpu_channel_manager.cc b/chromium/content/common/gpu/gpu_channel_manager.cc
index 8b466bd0b2b..fe3f7b34f12 100644
--- a/chromium/content/common/gpu/gpu_channel_manager.cc
+++ b/chromium/content/common/gpu/gpu_channel_manager.cc
@@ -11,6 +11,7 @@
#include "content/common/gpu/gpu_memory_manager.h"
#include "content/common/gpu/gpu_messages.h"
#include "content/common/gpu/sync_point_manager.h"
+#include "content/public/browser/content_browser_client.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
@@ -124,7 +125,12 @@ void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) {
DCHECK(!mailbox_manager_.get());
mailbox_manager_ = new gpu::gles2::MailboxManager;
}
- share_group = share_group_.get();
+ // Qt: Ask the browser client at the top to manage the context sharing.
+ // This can only work with --in-process-gpu or --single-process.
+ if (GetContentClient()->browser() && GetContentClient()->browser()->GetInProcessGpuShareGroup())
+ share_group = GetContentClient()->browser()->GetInProcessGpuShareGroup();
+ else
+ share_group = share_group_.get();
mailbox_manager = mailbox_manager_.get();
}
diff --git a/chromium/content/public/browser/content_browser_client.h b/chromium/content/public/browser/content_browser_client.h
index 8633105ed1a..639998fa5d9 100644
--- a/chromium/content/public/browser/content_browser_client.h
+++ b/chromium/content/public/browser/content_browser_client.h
@@ -45,6 +45,7 @@ class FilePath;
}
namespace gfx {
+class GLShareGroup;
class ImageSkia;
}
@@ -582,6 +583,10 @@ class CONTENT_EXPORT ContentBrowserClient {
// information.
virtual VibrationProvider* OverrideVibrationProvider();
+ // Allow an embedder to provide a share group reimplementation to connect renderer
+ // GL contexts with the root compositor.
+ virtual gfx::GLShareGroup* GetInProcessGpuShareGroup() { return 0; }
+
#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Populates |mappings| with all files that need to be mapped before launching
// a child process.
diff --git a/chromium/ui/gl/gl_share_group.cc b/chromium/ui/gl/gl_share_group.cc
index 8e8958b49a4..347873dc3ab 100644
--- a/chromium/ui/gl/gl_share_group.cc
+++ b/chromium/ui/gl/gl_share_group.cc
@@ -18,6 +18,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 1deed63c541..f1b03690f34 100644
--- a/chromium/ui/gl/gl_share_group.h
+++ b/chromium/ui/gl/gl_share_group.h
@@ -31,7 +31,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 unique shared GL context. Used for context
// virtualization.
@@ -45,10 +45,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.