| 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 "android_webview/browser/hardware_renderer.h" | 5 #include "android_webview/browser/hardware_renderer.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_gl_surface.h" | 7 #include "android_webview/browser/aw_gl_surface.h" |
| 8 #include "android_webview/browser/deferred_gpu_command_service.h" | 8 #include "android_webview/browser/deferred_gpu_command_service.h" |
| 9 #include "android_webview/browser/parent_output_surface.h" | 9 #include "android_webview/browser/parent_output_surface.h" |
| 10 #include "android_webview/browser/shared_renderer_state.h" | 10 #include "android_webview/browser/shared_renderer_state.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 attributes.antialias = false; | 46 attributes.antialias = false; |
| 47 attributes.depth = false; | 47 attributes.depth = false; |
| 48 attributes.stencil = false; | 48 attributes.stencil = false; |
| 49 attributes.shareResources = true; | 49 attributes.shareResources = true; |
| 50 attributes.noAutomaticFlushes = true; | 50 attributes.noAutomaticFlushes = true; |
| 51 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; | 51 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; |
| 52 WebGraphicsContext3DImpl::ConvertAttributes( | 52 WebGraphicsContext3DImpl::ConvertAttributes( |
| 53 attributes, &attribs_for_gles2); | 53 attributes, &attribs_for_gles2); |
| 54 attribs_for_gles2.lose_context_when_out_of_memory = true; | 54 attribs_for_gles2.lose_context_when_out_of_memory = true; |
| 55 | 55 |
| 56 scoped_ptr<gpu::GLInProcessContext> context( | 56 scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create( |
| 57 gpu::GLInProcessContext::Create(service, | 57 service, |
| 58 surface, | 58 surface, |
| 59 surface->IsOffscreen(), | 59 surface->IsOffscreen(), |
| 60 gfx::kNullAcceleratedWidget, | 60 gfx::kNullAcceleratedWidget, |
| 61 surface->GetSize(), | 61 surface->GetSize(), |
| 62 share_context, | 62 share_context, |
| 63 false /* share_resources */, | 63 false /* share_resources */, |
| 64 attribs_for_gles2, | 64 attribs_for_gles2, |
| 65 gpu_preference)); | 65 gpu_preference, |
| 66 gpu::GLInProcessContextSharedMemoryLimits())); |
| 66 DCHECK(context.get()); | 67 DCHECK(context.get()); |
| 67 | 68 |
| 68 return webkit::gpu::ContextProviderInProcess::Create( | 69 return webkit::gpu::ContextProviderInProcess::Create( |
| 69 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 70 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 70 context.Pass(), attributes), | 71 context.Pass(), attributes), |
| 71 "Parent-Compositor"); | 72 "Parent-Compositor"); |
| 72 } | 73 } |
| 73 | 74 |
| 74 } // namespace | 75 } // namespace |
| 75 | 76 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 248 } |
| 248 | 249 |
| 249 void HardwareRenderer::UnusedResourcesAreAvailable() { | 250 void HardwareRenderer::UnusedResourcesAreAvailable() { |
| 250 cc::ReturnedResourceArray returned_resources; | 251 cc::ReturnedResourceArray returned_resources; |
| 251 resource_collection_->TakeUnusedResourcesForChildCompositor( | 252 resource_collection_->TakeUnusedResourcesForChildCompositor( |
| 252 &returned_resources); | 253 &returned_resources); |
| 253 shared_renderer_state_->InsertReturnedResources(returned_resources); | 254 shared_renderer_state_->InsertReturnedResources(returned_resources); |
| 254 } | 255 } |
| 255 | 256 |
| 256 } // namespace android_webview | 257 } // namespace android_webview |
| OLD | NEW |