| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // This context provider is not used on multiple threads. | 101 // This context provider is not used on multiple threads. |
| 102 NOTREACHED(); | 102 NOTREACHED(); |
| 103 return nullptr; | 103 return nullptr; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void BlimpContextProvider::DeleteCachedResources() { | 106 void BlimpContextProvider::DeleteCachedResources() { |
| 107 DCHECK(context_thread_checker_.CalledOnValidThread()); | 107 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 108 | 108 |
| 109 if (gr_context_) | 109 if (gr_context_) |
| 110 gr_context_->FreeGpuResources(); | 110 gr_context_->FreeGpuResources(); |
| 111 |
| 112 ContextSupport()->TrimResources(); |
| 111 } | 113 } |
| 112 | 114 |
| 113 void BlimpContextProvider::SetLostContextCallback( | 115 void BlimpContextProvider::SetLostContextCallback( |
| 114 const LostContextCallback& lost_context_callback) { | 116 const LostContextCallback& lost_context_callback) { |
| 115 DCHECK(context_thread_checker_.CalledOnValidThread()); | 117 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 116 lost_context_callback_ = lost_context_callback; | 118 lost_context_callback_ = lost_context_callback; |
| 117 } | 119 } |
| 118 | 120 |
| 119 void BlimpContextProvider::OnLostContext() { | 121 void BlimpContextProvider::OnLostContext() { |
| 120 DCHECK(context_thread_checker_.CalledOnValidThread()); | 122 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 121 if (!lost_context_callback_.is_null()) | 123 if (!lost_context_callback_.is_null()) |
| 122 lost_context_callback_.Run(); | 124 lost_context_callback_.Run(); |
| 123 if (gr_context_) | 125 if (gr_context_) |
| 124 gr_context_->OnLostContext(); | 126 gr_context_->OnLostContext(); |
| 125 } | 127 } |
| 126 | 128 |
| 127 uint32_t BlimpContextProvider::GetCopyTextureInternalFormat() { | 129 uint32_t BlimpContextProvider::GetCopyTextureInternalFormat() { |
| 128 // The attributes used to create the context in the constructor specify | 130 // The attributes used to create the context in the constructor specify |
| 129 // an alpha channel. | 131 // an alpha channel. |
| 130 return GL_RGBA; | 132 return GL_RGBA; |
| 131 } | 133 } |
| 132 | 134 |
| 133 } // namespace client | 135 } // namespace client |
| 134 } // namespace blimp | 136 } // namespace blimp |
| OLD | NEW |