summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2016-03-22 12:58:24 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-22 20:00:16 +0000
commit11e6d011bc903cb926b1b6c40795c14f5af48384 (patch)
tree89a3e3788c6ab1a238ec14a3e2452d575e5e0238 /content/renderer
parent840cab012a5c84ea39f564babc3ea5f92fedf023 (diff)
downloadchromium_src-11e6d011bc903cb926b1b6c40795c14f5af48384.zip
chromium_src-11e6d011bc903cb926b1b6c40795c14f5af48384.tar.gz
chromium_src-11e6d011bc903cb926b1b6c40795c14f5af48384.tar.bz2
Make Platform return a WebGraphicsContext3DProvider* always.
Currently we return a WebGraphicsContext3DProvider* for the shared main thread context (for canvas), but we return a WebGraphicsContext3D* for webgl. After this CL, Platform will return a WebGraphicsContext3DProvider* for webgl also, which can grab the WebGraphicsContext3D* and the GLES2Interface* off it. This is largely in preparation for exposing gpu::ContextSupport (or something wrapping it) on WebGraphicsContext3DProvider so that we can expose lost context callbacks through there instead of on WebGraphicsContext3D. R=kbr@chromium.org, pfeldman@chromium.org, piman@chromium.org TBR=pfeldman BUG=584497 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel Review URL: https://codereview.chromium.org/1822993002 Cr-Commit-Position: refs/heads/master@{#382657}
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/renderer_blink_platform_impl.cc58
-rw-r--r--content/renderer/renderer_blink_platform_impl.h9
2 files changed, 23 insertions, 44 deletions
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index 9409b90..84e9f36 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -944,22 +944,7 @@ blink::WebSpeechSynthesizer* RendererBlinkPlatformImpl::createSpeechSynthesizer(
//------------------------------------------------------------------------------
-blink::WebGraphicsContext3D*
-RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D(
- const blink::WebGraphicsContext3D::Attributes& attributes) {
- return createOffscreenGraphicsContext3D(attributes, NULL);
-}
-
-blink::WebGraphicsContext3D*
-RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- blink::WebGraphicsContext3D* share_context) {
- blink::WebGraphicsContext3D::WebGraphicsInfo gl_info;
- return createOffscreenGraphicsContext3D(attributes, share_context, &gl_info);
-}
-
static void Collect3DContextInformationOnFailure(
- blink::WebGraphicsContext3D* share_context,
blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info,
GpuChannelHost* host) {
DCHECK(gl_info);
@@ -997,44 +982,43 @@ static void Collect3DContextInformationOnFailure(
}
}
-blink::WebGraphicsContext3D*
-RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D(
+blink::WebGraphicsContext3DProvider*
+RendererBlinkPlatformImpl::createOffscreenGraphicsContext3DProvider(
const blink::WebGraphicsContext3D::Attributes& attributes,
- blink::WebGraphicsContext3D* share_context,
+ blink::WebGraphicsContext3DProvider* share_provider,
blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) {
DCHECK(gl_info);
if (!RenderThreadImpl::current()) {
std::string error_message("Failed to run in Current RenderThreadImpl");
gl_info->errorMessage = WebString::fromUTF8(error_message);
- return NULL;
+ return nullptr;
}
scoped_refptr<GpuChannelHost> gpu_channel_host(
RenderThreadImpl::current()->EstablishGpuChannelSync(
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE));
+ WebGraphicsContext3DCommandBufferImpl* share_context =
+ share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>(
+ share_provider->context3d())
+ : nullptr;
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
bool lose_context_when_out_of_memory = false;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
- gpu_channel_host.get(),
- attributes,
- lose_context_when_out_of_memory,
- blink::WebStringToGURL(attributes.topDocumentURL),
- limits,
- static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context)));
-
- // Most likely the GPU process exited and the attempt to reconnect to it
- // failed. Need to try to restore the context again later.
- if (!context || !context->InitializeOnCurrentThread() ||
- gl_info->testFailContext) {
+ gpu_channel_host.get(), attributes, lose_context_when_out_of_memory,
+ blink::WebStringToGURL(attributes.topDocumentURL), limits,
+ share_context));
+ scoped_refptr<ContextProviderCommandBuffer> provider =
+ ContextProviderCommandBuffer::Create(std::move(context),
+ RENDERER_MAINTHREAD_CONTEXT);
+ if (!provider || !provider->BindToCurrentThread()) {
// Collect Graphicsinfo if there is a context failure or it is failed
// purposefully in case of layout tests.
- Collect3DContextInformationOnFailure(share_context, gl_info,
- gpu_channel_host.get());
- return NULL;
+ Collect3DContextInformationOnFailure(gl_info, gpu_channel_host.get());
+ return nullptr;
}
- return context.release();
+ return new WebGraphicsContext3DProviderImpl(std::move(provider));
}
//------------------------------------------------------------------------------
@@ -1043,9 +1027,9 @@ blink::WebGraphicsContext3DProvider*
RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() {
scoped_refptr<cc_blink::ContextProviderWebContext> provider =
RenderThreadImpl::current()->SharedMainThreadContextProvider();
- if (!provider.get())
- return NULL;
- return new WebGraphicsContext3DProviderImpl(provider);
+ if (!provider)
+ return nullptr;
+ return new WebGraphicsContext3DProviderImpl(std::move(provider));
}
//------------------------------------------------------------------------------
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
index 6fc8155..c78d484 100644
--- a/content/renderer/renderer_blink_platform_impl.h
+++ b/content/renderer/renderer_blink_platform_impl.h
@@ -162,14 +162,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
void createHTMLVideoElementCapturer(
blink::WebMediaStream* web_media_stream,
blink::WebMediaPlayer* web_media_player) override;
- blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
- const blink::WebGraphicsContext3D::Attributes& attributes) override;
- blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
+ blink::WebGraphicsContext3DProvider* createOffscreenGraphicsContext3DProvider(
const blink::WebGraphicsContext3D::Attributes& attributes,
- blink::WebGraphicsContext3D* share_context) override;
- blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- blink::WebGraphicsContext3D* share_context,
+ blink::WebGraphicsContext3DProvider* share_provider,
blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) override;
blink::WebGraphicsContext3DProvider*
createSharedOffscreenGraphicsContext3DProvider() override;