| 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" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( | 41 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( |
| 42 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 42 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
| 43 const std::string& debug_name) { | 43 const std::string& debug_name) { |
| 44 if (!context3d) | 44 if (!context3d) |
| 45 return NULL; | 45 return NULL; |
| 46 return new ContextProviderInProcess(context3d.Pass(), debug_name); | 46 return new ContextProviderInProcess(context3d.Pass(), debug_name); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 scoped_refptr<ContextProviderInProcess> | 50 scoped_refptr<ContextProviderInProcess> |
| 51 ContextProviderInProcess::CreateOffscreen( | 51 ContextProviderInProcess::CreateOffscreen() { |
| 52 bool lose_context_when_out_of_memory) { | |
| 53 blink::WebGraphicsContext3D::Attributes attributes; | 52 blink::WebGraphicsContext3D::Attributes attributes; |
| 54 attributes.depth = false; | 53 attributes.depth = false; |
| 55 attributes.stencil = true; | 54 attributes.stencil = true; |
| 56 attributes.antialias = false; | 55 attributes.antialias = false; |
| 57 attributes.shareResources = true; | 56 attributes.shareResources = true; |
| 58 attributes.noAutomaticFlushes = true; | 57 attributes.noAutomaticFlushes = true; |
| 59 | 58 |
| 60 return Create( | 59 return Create( |
| 61 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 60 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
| 62 attributes, lose_context_when_out_of_memory), | 61 attributes), "Offscreen"); |
| 63 "Offscreen"); | |
| 64 } | 62 } |
| 65 | 63 |
| 66 ContextProviderInProcess::ContextProviderInProcess( | 64 ContextProviderInProcess::ContextProviderInProcess( |
| 67 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 65 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
| 68 const std::string& debug_name) | 66 const std::string& debug_name) |
| 69 : context3d_(context3d.Pass()), | 67 : context3d_(context3d.Pass()), |
| 70 destroyed_(false), | 68 destroyed_(false), |
| 71 debug_name_(debug_name) { | 69 debug_name_(debug_name) { |
| 72 DCHECK(main_thread_checker_.CalledOnValidThread()); | 70 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 73 DCHECK(context3d_); | 71 DCHECK(context3d_); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 lost_context_callback_ = lost_context_callback; | 189 lost_context_callback_ = lost_context_callback; |
| 192 } | 190 } |
| 193 | 191 |
| 194 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 192 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
| 195 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 193 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
| 196 // There's no memory manager for the in-process implementation. | 194 // There's no memory manager for the in-process implementation. |
| 197 } | 195 } |
| 198 | 196 |
| 199 } // namespace gpu | 197 } // namespace gpu |
| 200 } // namespace webkit | 198 } // namespace webkit |
| OLD | NEW |