Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 5 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 6 | 6 |
| 7 #include "content/common/gpu/client/context_provider_command_buffer.h" | 7 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 8 #include "gpu/command_buffer/client/context_support.h" | 8 #include "gpu/command_buffer/client/context_support.h" |
| 9 #include "gpu/ipc/client/command_buffer_proxy_impl.h" | |
| 9 #include "third_party/WebKit/public/platform/functional/WebFunction.h" | 10 #include "third_party/WebKit/public/platform/functional/WebFunction.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 WebGraphicsContext3DProviderImpl::WebGraphicsContext3DProviderImpl( | 14 WebGraphicsContext3DProviderImpl::WebGraphicsContext3DProviderImpl( |
| 14 scoped_refptr<ContextProviderCommandBuffer> provider) | 15 scoped_refptr<ContextProviderCommandBuffer> provider) |
| 15 : provider_(std::move(provider)) {} | 16 : provider_(std::move(provider)) {} |
| 16 | 17 |
| 17 WebGraphicsContext3DProviderImpl::~WebGraphicsContext3DProviderImpl() {} | 18 WebGraphicsContext3DProviderImpl::~WebGraphicsContext3DProviderImpl() {} |
| 18 | 19 |
| 19 gpu::gles2::GLES2Interface* WebGraphicsContext3DProviderImpl::contextGL() { | 20 gpu::gles2::GLES2Interface* WebGraphicsContext3DProviderImpl::contextGL() { |
| 20 return provider_->ContextGL(); | 21 return provider_->ContextGL(); |
| 21 } | 22 } |
| 22 | 23 |
| 24 void WebGraphicsContext3DProviderImpl::DetachFromThread() { | |
|
Ken Russell (switch to Gerrit)
2016/05/04 21:02:56
I'm very uncomfortable with using these primitives
| |
| 25 provider_->GetCommandBufferProxy()->DetachFromThread(); | |
| 26 provider_->DetachFromThread(); | |
| 27 provider_->BindToCurrentThread(); | |
| 28 } | |
| 29 | |
| 23 GrContext* WebGraphicsContext3DProviderImpl::grContext() { | 30 GrContext* WebGraphicsContext3DProviderImpl::grContext() { |
| 24 return provider_->GrContext(); | 31 return provider_->GrContext(); |
| 25 } | 32 } |
| 26 | 33 |
| 27 gpu::Capabilities WebGraphicsContext3DProviderImpl::getCapabilities() { | 34 gpu::Capabilities WebGraphicsContext3DProviderImpl::getCapabilities() { |
| 28 return provider_->ContextCapabilities(); | 35 return provider_->ContextCapabilities(); |
| 29 } | 36 } |
| 30 | 37 |
| 31 void WebGraphicsContext3DProviderImpl::setLostContextCallback( | 38 void WebGraphicsContext3DProviderImpl::setLostContextCallback( |
| 32 blink::WebClosure c) { | 39 blink::WebClosure c) { |
| 33 provider_->SetLostContextCallback(c.TakeBaseCallback()); | 40 provider_->SetLostContextCallback(c.TakeBaseCallback()); |
| 34 } | 41 } |
| 35 | 42 |
| 36 void WebGraphicsContext3DProviderImpl::setErrorMessageCallback( | 43 void WebGraphicsContext3DProviderImpl::setErrorMessageCallback( |
| 37 blink::WebFunction<void(const char*, int32_t)> c) { | 44 blink::WebFunction<void(const char*, int32_t)> c) { |
| 38 provider_->ContextSupport()->SetErrorMessageCallback(c.TakeBaseCallback()); | 45 provider_->ContextSupport()->SetErrorMessageCallback(c.TakeBaseCallback()); |
| 39 } | 46 } |
| 40 | 47 |
| 41 } // namespace content | 48 } // namespace content |
| OLD | NEW |