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