| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "webkit/common/gpu/context_provider_in_process.h" | 5 #include "webkit/common/gpu/context_provider_in_process.h" |
| 6 | 6 |
| 7 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 7 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
| 8 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 8 | 9 |
| 9 namespace webkit { | 10 namespace webkit { |
| 10 namespace gpu { | 11 namespace gpu { |
| 11 | 12 |
| 12 class ContextProviderInProcess::LostContextCallbackProxy | 13 class ContextProviderInProcess::LostContextCallbackProxy |
| 13 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 14 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| 14 public: | 15 public: |
| 15 explicit LostContextCallbackProxy(ContextProviderInProcess* provider) | 16 explicit LostContextCallbackProxy(ContextProviderInProcess* provider) |
| 16 : provider_(provider) { | 17 : provider_(provider) { |
| 17 provider_->context3d_->setContextLostCallback(this); | 18 provider_->context3d_->setContextLostCallback(this); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DCHECK(!context3d_); | 54 DCHECK(!context3d_); |
| 54 | 55 |
| 55 WebKit::WebGraphicsContext3D::Attributes attributes; | 56 WebKit::WebGraphicsContext3D::Attributes attributes; |
| 56 attributes.depth = false; | 57 attributes.depth = false; |
| 57 attributes.stencil = true; | 58 attributes.stencil = true; |
| 58 attributes.antialias = false; | 59 attributes.antialias = false; |
| 59 attributes.shareResources = true; | 60 attributes.shareResources = true; |
| 60 attributes.noAutomaticFlushes = true; | 61 attributes.noAutomaticFlushes = true; |
| 61 | 62 |
| 62 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 63 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 63 context3d_.reset( | 64 context3d_ = |
| 64 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 65 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
| 65 attributes)); | 66 attributes); |
| 66 | 67 |
| 67 return context3d_; | 68 return context3d_; |
| 68 } | 69 } |
| 69 | 70 |
| 70 bool ContextProviderInProcess::BindToCurrentThread() { | 71 bool ContextProviderInProcess::BindToCurrentThread() { |
| 71 DCHECK(context3d_); | 72 DCHECK(context3d_); |
| 72 | 73 |
| 73 if (lost_context_callback_proxy_) | 74 if (lost_context_callback_proxy_) |
| 74 return true; | 75 return true; |
| 75 | 76 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 126 } |
| 126 | 127 |
| 127 void ContextProviderInProcess::OnMemoryAllocationChanged( | 128 void ContextProviderInProcess::OnMemoryAllocationChanged( |
| 128 bool nonzero_allocation) { | 129 bool nonzero_allocation) { |
| 129 if (gr_context_) | 130 if (gr_context_) |
| 130 gr_context_->SetMemoryLimit(nonzero_allocation); | 131 gr_context_->SetMemoryLimit(nonzero_allocation); |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace gpu | 134 } // namespace gpu |
| 134 } // namespace webkit | 135 } // namespace webkit |
| OLD | NEW |