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 "third_party/WebKit/public/platform/functional/WebFunction.h" | 9 #include "third_party/WebKit/public/platform/functional/WebFunction.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 WebGraphicsContext3DProviderImpl::WebGraphicsContext3DProviderImpl( | 13 WebGraphicsContext3DProviderImpl::WebGraphicsContext3DProviderImpl( |
14 scoped_refptr<ContextProviderCommandBuffer> provider) | 14 scoped_refptr<ContextProviderCommandBuffer> provider, |
15 : provider_(std::move(provider)) {} | 15 bool software_rendering) |
| 16 : provider_(std::move(provider)), software_rendering_(software_rendering) {} |
16 | 17 |
17 WebGraphicsContext3DProviderImpl::~WebGraphicsContext3DProviderImpl() {} | 18 WebGraphicsContext3DProviderImpl::~WebGraphicsContext3DProviderImpl() {} |
18 | 19 |
19 bool WebGraphicsContext3DProviderImpl::bindToCurrentThread() { | 20 bool WebGraphicsContext3DProviderImpl::bindToCurrentThread() { |
20 return provider_->BindToCurrentThread(); | 21 return provider_->BindToCurrentThread(); |
21 } | 22 } |
22 | 23 |
23 gpu::gles2::GLES2Interface* WebGraphicsContext3DProviderImpl::contextGL() { | 24 gpu::gles2::GLES2Interface* WebGraphicsContext3DProviderImpl::contextGL() { |
24 return provider_->ContextGL(); | 25 return provider_->ContextGL(); |
25 } | 26 } |
26 | 27 |
27 GrContext* WebGraphicsContext3DProviderImpl::grContext() { | 28 GrContext* WebGraphicsContext3DProviderImpl::grContext() { |
28 return provider_->GrContext(); | 29 return provider_->GrContext(); |
29 } | 30 } |
30 | 31 |
31 gpu::Capabilities WebGraphicsContext3DProviderImpl::getCapabilities() { | 32 gpu::Capabilities WebGraphicsContext3DProviderImpl::getCapabilities() { |
32 return provider_->ContextCapabilities(); | 33 return provider_->ContextCapabilities(); |
33 } | 34 } |
34 | 35 |
| 36 bool WebGraphicsContext3DProviderImpl::isSoftwareRendering() const { |
| 37 return software_rendering_; |
| 38 } |
| 39 |
35 void WebGraphicsContext3DProviderImpl::setLostContextCallback( | 40 void WebGraphicsContext3DProviderImpl::setLostContextCallback( |
36 blink::WebClosure c) { | 41 blink::WebClosure c) { |
37 provider_->SetLostContextCallback(c.TakeBaseCallback()); | 42 provider_->SetLostContextCallback(c.TakeBaseCallback()); |
38 } | 43 } |
39 | 44 |
40 void WebGraphicsContext3DProviderImpl::setErrorMessageCallback( | 45 void WebGraphicsContext3DProviderImpl::setErrorMessageCallback( |
41 blink::WebFunction<void(const char*, int32_t)> c) { | 46 blink::WebFunction<void(const char*, int32_t)> c) { |
42 provider_->ContextSupport()->SetErrorMessageCallback(c.TakeBaseCallback()); | 47 provider_->ContextSupport()->SetErrorMessageCallback(c.TakeBaseCallback()); |
43 } | 48 } |
44 | 49 |
45 } // namespace content | 50 } // namespace content |
OLD | NEW |