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> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "cc/output/managed_memory_policy.h" | 13 #include "cc/output/managed_memory_policy.h" |
14 #include "gpu/command_buffer/client/gles2_implementation.h" | 14 #include "gpu/command_buffer/client/gles2_implementation.h" |
15 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 15 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
16 | 16 |
| 17 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 18 |
17 namespace webkit { | 19 namespace webkit { |
18 namespace gpu { | 20 namespace gpu { |
19 | 21 |
20 class ContextProviderInProcess::LostContextCallbackProxy | 22 class ContextProviderInProcess::LostContextCallbackProxy |
21 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 23 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
22 public: | 24 public: |
23 explicit LostContextCallbackProxy(ContextProviderInProcess* provider) | 25 explicit LostContextCallbackProxy(ContextProviderInProcess* provider) |
24 : provider_(provider) { | 26 : provider_(provider) { |
25 provider_->context3d_->setContextLostCallback(this); | 27 provider_->context3d_->setContextLostCallback(this); |
26 } | 28 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return context3d_->GetContextSupport(); | 146 return context3d_->GetContextSupport(); |
145 } | 147 } |
146 | 148 |
147 class GrContext* ContextProviderInProcess::GrContext() { | 149 class GrContext* ContextProviderInProcess::GrContext() { |
148 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 150 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
149 DCHECK(context_thread_checker_.CalledOnValidThread()); | 151 DCHECK(context_thread_checker_.CalledOnValidThread()); |
150 | 152 |
151 if (gr_context_) | 153 if (gr_context_) |
152 return gr_context_->get(); | 154 return gr_context_->get(); |
153 | 155 |
154 gr_context_.reset( | 156 gr_context_.reset(new GrContextForWebGraphicsContext3D(context3d_.get())); |
155 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); | |
156 return gr_context_->get(); | 157 return gr_context_->get(); |
157 } | 158 } |
158 | 159 |
159 bool ContextProviderInProcess::IsContextLost() { | 160 bool ContextProviderInProcess::IsContextLost() { |
160 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 161 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
161 DCHECK(context_thread_checker_.CalledOnValidThread()); | 162 DCHECK(context_thread_checker_.CalledOnValidThread()); |
162 | 163 |
163 return context3d_->isContextLost(); | 164 return context3d_->isContextLost(); |
164 } | 165 } |
165 | 166 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 lost_context_callback_ = lost_context_callback; | 208 lost_context_callback_ = lost_context_callback; |
208 } | 209 } |
209 | 210 |
210 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 211 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
211 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 212 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
212 // There's no memory manager for the in-process implementation. | 213 // There's no memory manager for the in-process implementation. |
213 } | 214 } |
214 | 215 |
215 } // namespace gpu | 216 } // namespace gpu |
216 } // namespace webkit | 217 } // namespace webkit |
OLD | NEW |