| 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 "android_webview/browser/aw_render_thread_context_provider.h" | 5 #include "android_webview/browser/aw_render_thread_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 "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 context_->GetImplementation()->SetLostContextCallback(base::Bind( | 68 context_->GetImplementation()->SetLostContextCallback(base::Bind( |
| 69 &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); | 69 &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); |
| 70 } | 70 } |
| 71 | 71 |
| 72 AwRenderThreadContextProvider::~AwRenderThreadContextProvider() { | 72 AwRenderThreadContextProvider::~AwRenderThreadContextProvider() { |
| 73 DCHECK(main_thread_checker_.CalledOnValidThread()); | 73 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 74 if (gr_context_) | 74 if (gr_context_) |
| 75 gr_context_->releaseResourcesAndAbandonContext(); | 75 gr_context_->releaseResourcesAndAbandonContext(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 uint32_t AwRenderThreadContextProvider::GetCopyTextureInternalFormat() { |
| 79 // The attributes used in the constructor included an alpha channel. |
| 80 return GL_RGBA; |
| 81 } |
| 82 |
| 78 bool AwRenderThreadContextProvider::BindToCurrentThread() { | 83 bool AwRenderThreadContextProvider::BindToCurrentThread() { |
| 79 // This is called on the thread the context will be used. | 84 // This is called on the thread the context will be used. |
| 80 DCHECK(main_thread_checker_.CalledOnValidThread()); | 85 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 81 | 86 |
| 82 return true; | 87 return true; |
| 83 } | 88 } |
| 84 | 89 |
| 85 gpu::Capabilities AwRenderThreadContextProvider::ContextCapabilities() { | 90 gpu::Capabilities AwRenderThreadContextProvider::ContextCapabilities() { |
| 86 DCHECK(main_thread_checker_.CalledOnValidThread()); | 91 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 87 return context_->GetImplementation()->capabilities(); | 92 return context_->GetImplementation()->capabilities(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void AwRenderThreadContextProvider::OnLostContext() { | 149 void AwRenderThreadContextProvider::OnLostContext() { |
| 145 DCHECK(main_thread_checker_.CalledOnValidThread()); | 150 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 146 | 151 |
| 147 if (!lost_context_callback_.is_null()) | 152 if (!lost_context_callback_.is_null()) |
| 148 lost_context_callback_.Run(); | 153 lost_context_callback_.Run(); |
| 149 if (gr_context_) | 154 if (gr_context_) |
| 150 gr_context_->abandonContext(); | 155 gr_context_->abandonContext(); |
| 151 } | 156 } |
| 152 | 157 |
| 153 } // namespace android_webview | 158 } // namespace android_webview |
| OLD | NEW |