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

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

Issue 2107783003: Pass initial size and GPU preference via context attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp fix Created 4 years, 5 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
« no previous file with comments | « no previous file | blimp/client/feature/compositor/blimp_context_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // This context is only used for the display compositor, and there are no 55 // This context is only used for the display compositor, and there are no
56 // uploads done with it at all. We choose a small transfer buffer limit 56 // uploads done with it at all. We choose a small transfer buffer limit
57 // here, the minimums match the display compositor context for the android 57 // here, the minimums match the display compositor context for the android
58 // browser. We don't set the max since we expect the transfer buffer to be 58 // browser. We don't set the max since we expect the transfer buffer to be
59 // relatively unused. 59 // relatively unused.
60 limits.start_transfer_buffer_size = 64 * 1024; 60 limits.start_transfer_buffer_size = 64 * 1024;
61 limits.min_transfer_buffer_size = 64 * 1024; 61 limits.min_transfer_buffer_size = 64 * 1024;
62 62
63 context_.reset(gpu::GLInProcessContext::Create( 63 context_.reset(gpu::GLInProcessContext::Create(
64 service, surface, surface->IsOffscreen(), gfx::kNullAcceleratedWidget, 64 service, surface, surface->IsOffscreen(), gfx::kNullAcceleratedWidget,
65 surface->GetSize(), nullptr /* share_context */, attributes, 65 nullptr /* share_context */, attributes, limits, nullptr, nullptr));
66 gl::PreferDiscreteGpu, limits, nullptr, nullptr));
67 66
68 context_->GetImplementation()->SetLostContextCallback(base::Bind( 67 context_->GetImplementation()->SetLostContextCallback(base::Bind(
69 &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); 68 &AwRenderThreadContextProvider::OnLostContext, base::Unretained(this)));
70 } 69 }
71 70
72 AwRenderThreadContextProvider::~AwRenderThreadContextProvider() { 71 AwRenderThreadContextProvider::~AwRenderThreadContextProvider() {
73 DCHECK(main_thread_checker_.CalledOnValidThread()); 72 DCHECK(main_thread_checker_.CalledOnValidThread());
74 if (gr_context_) 73 if (gr_context_)
75 gr_context_->releaseResourcesAndAbandonContext(); 74 gr_context_->releaseResourcesAndAbandonContext();
76 } 75 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void AwRenderThreadContextProvider::OnLostContext() { 148 void AwRenderThreadContextProvider::OnLostContext() {
150 DCHECK(main_thread_checker_.CalledOnValidThread()); 149 DCHECK(main_thread_checker_.CalledOnValidThread());
151 150
152 if (!lost_context_callback_.is_null()) 151 if (!lost_context_callback_.is_null())
153 lost_context_callback_.Run(); 152 lost_context_callback_.Run();
154 if (gr_context_) 153 if (gr_context_)
155 gr_context_->abandonContext(); 154 gr_context_->abandonContext();
156 } 155 }
157 156
158 } // namespace android_webview 157 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | blimp/client/feature/compositor/blimp_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698