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 "webkit/common/gpu/context_provider_in_process.h" | 5 #include "webkit/common/gpu/context_provider_in_process.h" |
6 | 6 |
| 7 #include <set> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/strings/string_split.h" |
9 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
10 #include "cc/output/managed_memory_policy.h" | 13 #include "cc/output/managed_memory_policy.h" |
11 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 14 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
12 #include "webkit/common/gpu/managed_memory_policy_convert.h" | 15 #include "webkit/common/gpu/managed_memory_policy_convert.h" |
13 | 16 |
14 namespace webkit { | 17 namespace webkit { |
15 namespace gpu { | 18 namespace gpu { |
16 | 19 |
17 class ContextProviderInProcess::LostContextCallbackProxy | 20 class ContextProviderInProcess::LostContextCallbackProxy |
18 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 21 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // provides the following capabilities: | 150 // provides the following capabilities: |
148 Capabilities caps; | 151 Capabilities caps; |
149 caps.bind_uniform_location = true; | 152 caps.bind_uniform_location = true; |
150 caps.discard_backbuffer = true; | 153 caps.discard_backbuffer = true; |
151 caps.map_image = true; | 154 caps.map_image = true; |
152 caps.map_sub = true; | 155 caps.map_sub = true; |
153 caps.set_visibility = true; | 156 caps.set_visibility = true; |
154 caps.shallow_flush = true; | 157 caps.shallow_flush = true; |
155 caps.texture_format_bgra8888 = true; | 158 caps.texture_format_bgra8888 = true; |
156 caps.texture_rectangle = true; | 159 caps.texture_rectangle = true; |
| 160 |
| 161 WebKit::WebString extensions = |
| 162 context3d_->getString(0x1F03 /* GL_EXTENSIONS */); |
| 163 std::vector<std::string> extension_list; |
| 164 base::SplitString(extensions.utf8(), ' ', &extension_list); |
| 165 std::set<std::string> extension_set(extension_list.begin(), |
| 166 extension_list.end()); |
| 167 |
| 168 caps.post_sub_buffer = extension_set.count("GL_CHROMIUM_post_sub_buffer") > 0; |
157 return caps; | 169 return caps; |
158 } | 170 } |
159 | 171 |
160 WebKit::WebGraphicsContext3D* ContextProviderInProcess::Context3d() { | 172 WebKit::WebGraphicsContext3D* ContextProviderInProcess::Context3d() { |
161 DCHECK(context3d_); | 173 DCHECK(context3d_); |
162 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 174 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
163 DCHECK(context_thread_checker_.CalledOnValidThread()); | 175 DCHECK(context_thread_checker_.CalledOnValidThread()); |
164 | 176 |
165 return context3d_.get(); | 177 return context3d_.get(); |
166 } | 178 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 264 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
253 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 265 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
254 DCHECK(context_thread_checker_.CalledOnValidThread()); | 266 DCHECK(context_thread_checker_.CalledOnValidThread()); |
255 DCHECK(memory_policy_changed_callback_.is_null() || | 267 DCHECK(memory_policy_changed_callback_.is_null() || |
256 memory_policy_changed_callback.is_null()); | 268 memory_policy_changed_callback.is_null()); |
257 memory_policy_changed_callback_ = memory_policy_changed_callback; | 269 memory_policy_changed_callback_ = memory_policy_changed_callback; |
258 } | 270 } |
259 | 271 |
260 } // namespace gpu | 272 } // namespace gpu |
261 } // namespace webkit | 273 } // namespace webkit |
OLD | NEW |