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 "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 5 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return gles2_impl_.get(); | 373 return gles2_impl_.get(); |
374 } | 374 } |
375 | 375 |
376 class GrContext* ContextProviderCommandBuffer::GrContext() { | 376 class GrContext* ContextProviderCommandBuffer::GrContext() { |
377 DCHECK(bind_succeeded_); | 377 DCHECK(bind_succeeded_); |
378 DCHECK(context_thread_checker_.CalledOnValidThread()); | 378 DCHECK(context_thread_checker_.CalledOnValidThread()); |
379 | 379 |
380 if (gr_context_) | 380 if (gr_context_) |
381 return gr_context_->get(); | 381 return gr_context_->get(); |
382 | 382 |
383 gr_context_.reset(new skia_bindings::GrContextForGLES2Interface(ContextGL())); | 383 gr_context_.reset(new skia_bindings::GrContextForGLES2Interface( |
| 384 ContextGL(), ContextCapabilities())); |
384 cache_controller_->SetGrContext(gr_context_->get()); | 385 cache_controller_->SetGrContext(gr_context_->get()); |
385 | 386 |
386 // If GlContext is already lost, also abandon the new GrContext. | 387 // If GlContext is already lost, also abandon the new GrContext. |
387 if (gr_context_->get() && | 388 if (gr_context_->get() && |
388 ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) | 389 ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |
389 gr_context_->get()->abandonContext(); | 390 gr_context_->get()->abandonContext(); |
390 | 391 |
391 return gr_context_->get(); | 392 return gr_context_->get(); |
392 } | 393 } |
393 | 394 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 context_thread_checker_.DetachFromThread(); | 459 context_thread_checker_.DetachFromThread(); |
459 SkiaGpuTraceMemoryDump trace_memory_dump( | 460 SkiaGpuTraceMemoryDump trace_memory_dump( |
460 pmd, gles2_impl_->ShareGroupTracingGUID()); | 461 pmd, gles2_impl_->ShareGroupTracingGUID()); |
461 gr_context_->get()->dumpMemoryStatistics(&trace_memory_dump); | 462 gr_context_->get()->dumpMemoryStatistics(&trace_memory_dump); |
462 context_thread_checker_.DetachFromThread(); | 463 context_thread_checker_.DetachFromThread(); |
463 } | 464 } |
464 return true; | 465 return true; |
465 } | 466 } |
466 | 467 |
467 } // namespace ui | 468 } // namespace ui |
OLD | NEW |