OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/gpu/SharedGpuContext.h" | 5 #include "platform/graphics/gpu/SharedGpuContext.h" |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_interface.h" | 7 #include "gpu/command_buffer/client/gles2_interface.h" |
| 8 #include "gpu/command_buffer/common/capabilities.h" |
8 #include "platform/CrossThreadFunctional.h" | 9 #include "platform/CrossThreadFunctional.h" |
9 #include "platform/WaitableEvent.h" | 10 #include "platform/WaitableEvent.h" |
10 #include "platform/WebTaskRunner.h" | 11 #include "platform/WebTaskRunner.h" |
11 #include "public/platform/Platform.h" | 12 #include "public/platform/Platform.h" |
12 #include "public/platform/WebGraphicsContext3DProvider.h" | 13 #include "public/platform/WebGraphicsContext3DProvider.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 SharedGpuContext* SharedGpuContext::GetInstanceForCurrentThread() { | 17 SharedGpuContext* SharedGpuContext::GetInstanceForCurrentThread() { |
17 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<SharedGpuContext>, | 18 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<SharedGpuContext>, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 121 } |
121 | 122 |
122 bool SharedGpuContext::IsValidWithoutRestoring() { | 123 bool SharedGpuContext::IsValidWithoutRestoring() { |
123 SharedGpuContext* this_ptr = GetInstanceForCurrentThread(); | 124 SharedGpuContext* this_ptr = GetInstanceForCurrentThread(); |
124 if (!this_ptr->context_provider_) | 125 if (!this_ptr->context_provider_) |
125 return false; | 126 return false; |
126 return this_ptr->context_provider_->ContextGL() | 127 return this_ptr->context_provider_->ContextGL() |
127 ->GetGraphicsResetStatusKHR() == GL_NO_ERROR; | 128 ->GetGraphicsResetStatusKHR() == GL_NO_ERROR; |
128 } | 129 } |
129 | 130 |
| 131 bool SharedGpuContext::AllowSoftwareToAcceleratedCanvasUpgrade() { |
| 132 if (!IsValid()) |
| 133 return kNoSharedContext; |
| 134 SharedGpuContext* this_ptr = GetInstanceForCurrentThread(); |
| 135 return this_ptr->context_provider_->GetCapabilities() |
| 136 .software_to_accelerated_canvas_upgrade; |
| 137 } |
| 138 |
130 } // blink | 139 } // blink |
OLD | NEW |