| 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/feature/compositor/blimp_context_provider.h" | 5 #include "blimp/client/feature/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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this))); | 49 base::Bind(&BlimpContextProvider::OnLostContext, base::Unretained(this))); |
| 50 } | 50 } |
| 51 | 51 |
| 52 BlimpContextProvider::~BlimpContextProvider() { | 52 BlimpContextProvider::~BlimpContextProvider() { |
| 53 DCHECK(main_thread_checker_.CalledOnValidThread() || | 53 DCHECK(main_thread_checker_.CalledOnValidThread() || |
| 54 context_thread_checker_.CalledOnValidThread()); | 54 context_thread_checker_.CalledOnValidThread()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool BlimpContextProvider::BindToCurrentThread() { | 57 bool BlimpContextProvider::BindToCurrentThread() { |
| 58 DCHECK(context_thread_checker_.CalledOnValidThread()); | 58 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 59 capabilities_.gpu = context_->GetImplementation()->capabilities(); | |
| 60 capabilities_.gpu.image = true; | |
| 61 return true; | 59 return true; |
| 62 } | 60 } |
| 63 | 61 |
| 64 void BlimpContextProvider::DetachFromThread() { | 62 void BlimpContextProvider::DetachFromThread() { |
| 65 context_thread_checker_.DetachFromThread(); | 63 context_thread_checker_.DetachFromThread(); |
| 66 } | 64 } |
| 67 | 65 |
| 68 cc::ContextProvider::Capabilities BlimpContextProvider::ContextCapabilities() { | 66 gpu::Capabilities BlimpContextProvider::ContextCapabilities() { |
| 69 DCHECK(context_thread_checker_.CalledOnValidThread()); | 67 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 70 return capabilities_; | 68 gpu::Capabilities capabilities = |
| 69 context_->GetImplementation()->capabilities(); |
| 70 // TODO(danakj): Why? Is this even valid? This is the CHROMIUM_image extension |
| 71 // to use GpuMemoryBuffers. Does the context not provide this? |
| 72 capabilities.image = true; |
| 73 return capabilities; |
| 71 } | 74 } |
| 72 | 75 |
| 73 gpu::gles2::GLES2Interface* BlimpContextProvider::ContextGL() { | 76 gpu::gles2::GLES2Interface* BlimpContextProvider::ContextGL() { |
| 74 DCHECK(context_thread_checker_.CalledOnValidThread()); | 77 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 75 return context_->GetImplementation(); | 78 return context_->GetImplementation(); |
| 76 } | 79 } |
| 77 | 80 |
| 78 gpu::ContextSupport* BlimpContextProvider::ContextSupport() { | 81 gpu::ContextSupport* BlimpContextProvider::ContextSupport() { |
| 79 DCHECK(context_thread_checker_.CalledOnValidThread()); | 82 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 80 return context_->GetImplementation(); | 83 return context_->GetImplementation(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void BlimpContextProvider::OnLostContext() { | 125 void BlimpContextProvider::OnLostContext() { |
| 123 DCHECK(context_thread_checker_.CalledOnValidThread()); | 126 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 124 if (!lost_context_callback_.is_null()) | 127 if (!lost_context_callback_.is_null()) |
| 125 lost_context_callback_.Run(); | 128 lost_context_callback_.Run(); |
| 126 if (gr_context_) | 129 if (gr_context_) |
| 127 gr_context_->OnLostContext(); | 130 gr_context_->OnLostContext(); |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace client | 133 } // namespace client |
| 131 } // namespace blimp | 134 } // namespace blimp |
| OLD | NEW |