| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/compositor/blimp_context_provider.h" | 5 #include "blimp/client/compositor/blimp_context_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "gpu/command_buffer/client/gl_in_process_context.h" | 10 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 context_thread_checker_.DetachFromThread(); | 51 context_thread_checker_.DetachFromThread(); |
| 52 | 52 |
| 53 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; | 53 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; |
| 54 attribs_for_gles2.alpha_size = 8; | 54 attribs_for_gles2.alpha_size = 8; |
| 55 attribs_for_gles2.depth_size = 0; | 55 attribs_for_gles2.depth_size = 0; |
| 56 attribs_for_gles2.stencil_size = 0; | 56 attribs_for_gles2.stencil_size = 0; |
| 57 attribs_for_gles2.samples = 0; | 57 attribs_for_gles2.samples = 0; |
| 58 attribs_for_gles2.sample_buffers = 0; | 58 attribs_for_gles2.sample_buffers = 0; |
| 59 attribs_for_gles2.fail_if_major_perf_caveat = false; | 59 attribs_for_gles2.fail_if_major_perf_caveat = false; |
| 60 attribs_for_gles2.bind_generates_resource = false; | 60 attribs_for_gles2.bind_generates_resource = false; |
| 61 attribs_for_gles2.webgl_version = 0; | 61 attribs_for_gles2.context_type = gpu::gles2::CONTEXT_TYPE_OPENGLES2; |
| 62 attribs_for_gles2.lose_context_when_out_of_memory = true; | 62 attribs_for_gles2.lose_context_when_out_of_memory = true; |
| 63 | 63 |
| 64 context_.reset(gpu::GLInProcessContext::Create( | 64 context_.reset(gpu::GLInProcessContext::Create( |
| 65 nullptr /* service */, nullptr /* surface */, false /* is_offscreen */, | 65 nullptr /* service */, nullptr /* surface */, false /* is_offscreen */, |
| 66 widget, gfx::Size(1, 1), nullptr /* share_context */, | 66 widget, gfx::Size(1, 1), nullptr /* share_context */, |
| 67 false /* share_resources */, attribs_for_gles2, gfx::PreferDiscreteGpu, | 67 false /* share_resources */, attribs_for_gles2, gfx::PreferDiscreteGpu, |
| 68 gpu::GLInProcessContextSharedMemoryLimits(), | 68 gpu::GLInProcessContextSharedMemoryLimits(), |
| 69 nullptr /* gpu_memory_buffer_manager */, nullptr /* memory_limits */)); | 69 nullptr /* gpu_memory_buffer_manager */, nullptr /* memory_limits */)); |
| 70 context_->SetContextLostCallback( | 70 context_->SetContextLostCallback( |
| 71 base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this))); | 71 base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this))); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 destroyed_ = true; | 179 destroyed_ = true; |
| 180 } | 180 } |
| 181 | 181 |
| 182 if (!lost_context_callback_.is_null()) | 182 if (!lost_context_callback_.is_null()) |
| 183 base::ResetAndReturn(&lost_context_callback_).Run(); | 183 base::ResetAndReturn(&lost_context_callback_).Run(); |
| 184 if (gr_context_) | 184 if (gr_context_) |
| 185 gr_context_->abandonContext(); | 185 gr_context_->abandonContext(); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace blimp | 188 } // namespace blimp |
| OLD | NEW |