Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1255)

Side by Side Diff: android_webview/browser/aw_render_thread_context_provider.cc

Issue 1900993002: Move SharedMemoryLimits out of WebGraphicsContext3DCommandBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@limits
Patch Set: move-limits: types Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 attributes.sample_buffers = 0; 51 attributes.sample_buffers = 0;
52 attributes.bind_generates_resource = false; 52 attributes.bind_generates_resource = false;
53 context_.reset(gpu::GLInProcessContext::Create( 53 context_.reset(gpu::GLInProcessContext::Create(
54 service, surface, surface->IsOffscreen(), gfx::kNullAcceleratedWidget, 54 service, surface, surface->IsOffscreen(), gfx::kNullAcceleratedWidget,
55 surface->GetSize(), nullptr /* share_context */, attributes, 55 surface->GetSize(), nullptr /* share_context */, attributes,
56 gfx::PreferDiscreteGpu, gpu::GLInProcessContextSharedMemoryLimits(), 56 gfx::PreferDiscreteGpu, gpu::GLInProcessContextSharedMemoryLimits(),
57 nullptr, nullptr)); 57 nullptr, nullptr));
58 58
59 context_->GetImplementation()->SetLostContextCallback(base::Bind( 59 context_->GetImplementation()->SetLostContextCallback(base::Bind(
60 &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); 60 &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this)));
61
62 capabilities_.gpu = context_->GetImplementation()->capabilities();
63 } 61 }
64 62
65 AwRenderThreadContextProvider::~AwRenderThreadContextProvider() { 63 AwRenderThreadContextProvider::~AwRenderThreadContextProvider() {
66 DCHECK(main_thread_checker_.CalledOnValidThread()); 64 DCHECK(main_thread_checker_.CalledOnValidThread());
67 if (gr_context_) 65 if (gr_context_)
68 gr_context_->releaseResourcesAndAbandonContext(); 66 gr_context_->releaseResourcesAndAbandonContext();
69 } 67 }
70 68
71 bool AwRenderThreadContextProvider::BindToCurrentThread() { 69 bool AwRenderThreadContextProvider::BindToCurrentThread() {
72 // This is called on the thread the context will be used. 70 // This is called on the thread the context will be used.
73 DCHECK(main_thread_checker_.CalledOnValidThread()); 71 DCHECK(main_thread_checker_.CalledOnValidThread());
74 72
75 return true; 73 return true;
76 } 74 }
77 75
78 cc::ContextProvider::Capabilities 76 gpu::Capabilities AwRenderThreadContextProvider::ContextCapabilities() {
79 AwRenderThreadContextProvider::ContextCapabilities() {
80 DCHECK(main_thread_checker_.CalledOnValidThread()); 77 DCHECK(main_thread_checker_.CalledOnValidThread());
81 78 return context_->GetImplementation()->capabilities();
82 return capabilities_;
83 } 79 }
84 80
85 gpu::gles2::GLES2Interface* AwRenderThreadContextProvider::ContextGL() { 81 gpu::gles2::GLES2Interface* AwRenderThreadContextProvider::ContextGL() {
86 DCHECK(main_thread_checker_.CalledOnValidThread()); 82 DCHECK(main_thread_checker_.CalledOnValidThread());
87 83
88 return context_->GetImplementation(); 84 return context_->GetImplementation();
89 } 85 }
90 86
91 gpu::ContextSupport* AwRenderThreadContextProvider::ContextSupport() { 87 gpu::ContextSupport* AwRenderThreadContextProvider::ContextSupport() {
92 DCHECK(main_thread_checker_.CalledOnValidThread()); 88 DCHECK(main_thread_checker_.CalledOnValidThread());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void AwRenderThreadContextProvider::OnLostContext() { 140 void AwRenderThreadContextProvider::OnLostContext() {
145 DCHECK(main_thread_checker_.CalledOnValidThread()); 141 DCHECK(main_thread_checker_.CalledOnValidThread());
146 142
147 if (!lost_context_callback_.is_null()) 143 if (!lost_context_callback_.is_null())
148 lost_context_callback_.Run(); 144 lost_context_callback_.Run();
149 if (gr_context_) 145 if (gr_context_)
150 gr_context_->abandonContext(); 146 gr_context_->abandonContext();
151 } 147 }
152 148
153 } // namespace android_webview 149 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_render_thread_context_provider.h ('k') | blimp/client/feature/compositor/blimp_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698