OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "android_webview/browser/aw_render_thread_context_provider.h" | 5 #include "android_webview/browser/aw_render_thread_context_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 blink::WebGraphicsContext3D::Attributes attributes; | 53 blink::WebGraphicsContext3D::Attributes attributes; |
54 attributes.antialias = false; | 54 attributes.antialias = false; |
55 attributes.depth = false; | 55 attributes.depth = false; |
56 attributes.stencil = false; | 56 attributes.stencil = false; |
57 attributes.shareResources = true; | 57 attributes.shareResources = true; |
58 attributes.noAutomaticFlushes = true; | 58 attributes.noAutomaticFlushes = true; |
59 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; | 59 gpu::gles2::ContextCreationAttribHelper attribs_for_gles2; |
60 gpu_blink::WebGraphicsContext3DImpl::ConvertAttributes(attributes, | 60 gpu_blink::WebGraphicsContext3DImpl::ConvertAttributes(attributes, |
61 &attribs_for_gles2); | 61 &attribs_for_gles2); |
62 attribs_for_gles2.lose_context_when_out_of_memory = true; | 62 attribs_for_gles2.lose_context_when_out_of_memory = false; |
63 | 63 |
64 context_.reset(gpu::GLInProcessContext::Create( | 64 context_.reset(gpu::GLInProcessContext::Create( |
65 service, | 65 service, |
66 surface, | 66 surface, |
67 surface->IsOffscreen(), | 67 surface->IsOffscreen(), |
68 gfx::kNullAcceleratedWidget, | 68 gfx::kNullAcceleratedWidget, |
69 surface->GetSize(), | 69 surface->GetSize(), |
70 NULL /* share_context */, | 70 NULL /* share_context */, |
71 false /* share_resources */, | 71 false /* share_resources */, |
72 attribs_for_gles2, | 72 attribs_for_gles2, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void AwRenderThreadContextProvider::OnLostContext() { | 174 void AwRenderThreadContextProvider::OnLostContext() { |
175 DCHECK(main_thread_checker_.CalledOnValidThread()); | 175 DCHECK(main_thread_checker_.CalledOnValidThread()); |
176 | 176 |
177 if (!lost_context_callback_.is_null()) | 177 if (!lost_context_callback_.is_null()) |
178 base::ResetAndReturn(&lost_context_callback_).Run(); | 178 base::ResetAndReturn(&lost_context_callback_).Run(); |
179 if (gr_context_) | 179 if (gr_context_) |
180 gr_context_->abandonContext(); | 180 gr_context_->abandonContext(); |
181 } | 181 } |
182 | 182 |
183 } // namespace android_webview | 183 } // namespace android_webview |
OLD | NEW |