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

Side by Side Diff: ui/compositor/test/in_process_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 | « gpu/ipc/service/gpu_command_buffer_stub.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/compositor/test/in_process_context_provider.h" 5 #include "ui/compositor/test/in_process_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/macros.h" 10 #include "base/macros.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 InProcessContextProvider::~InProcessContextProvider() { 76 InProcessContextProvider::~InProcessContextProvider() {
77 DCHECK(main_thread_checker_.CalledOnValidThread() || 77 DCHECK(main_thread_checker_.CalledOnValidThread() ||
78 context_thread_checker_.CalledOnValidThread()); 78 context_thread_checker_.CalledOnValidThread());
79 } 79 }
80 80
81 bool InProcessContextProvider::BindToCurrentThread() { 81 bool InProcessContextProvider::BindToCurrentThread() {
82 // This is called on the thread the context will be used. 82 // This is called on the thread the context will be used.
83 DCHECK(context_thread_checker_.CalledOnValidThread()); 83 DCHECK(context_thread_checker_.CalledOnValidThread());
84 84
85 if (!context_) { 85 if (!context_) {
86 gl::GpuPreference gpu_preference = gl::PreferDiscreteGpu;
87 context_.reset(gpu::GLInProcessContext::Create( 86 context_.reset(gpu::GLInProcessContext::Create(
88 nullptr, /* service */ 87 nullptr, /* service */
89 nullptr, /* surface */ 88 nullptr, /* surface */
90 !window_, /* is_offscreen */ 89 !window_, /* is_offscreen */
91 window_, gfx::Size(1, 1), 90 window_, (shared_context_ ? shared_context_->context_.get() : nullptr),
92 (shared_context_ ? shared_context_->context_.get() : nullptr), attribs_, 91 attribs_, gpu::SharedMemoryLimits(), gpu_memory_buffer_manager_,
93 gpu_preference, gpu::SharedMemoryLimits(), gpu_memory_buffer_manager_,
94 image_factory_)); 92 image_factory_));
95 93
96 if (!context_) 94 if (!context_)
97 return false; 95 return false;
98 } 96 }
99 97
100 std::string unique_context_name = 98 std::string unique_context_name =
101 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get()); 99 base::StringPrintf("%s-%p", debug_name_.c_str(), context_.get());
102 context_->GetImplementation()->TraceBeginCHROMIUM( 100 context_->GetImplementation()->TraceBeginCHROMIUM(
103 "gpu_toplevel", unique_context_name.c_str()); 101 "gpu_toplevel", unique_context_name.c_str());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() { 161 uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() {
164 if (attribs_.alpha_size > 0) 162 if (attribs_.alpha_size > 0)
165 return GL_RGBA; 163 return GL_RGBA;
166 DCHECK_NE(attribs_.red_size, 0); 164 DCHECK_NE(attribs_.red_size, 0);
167 DCHECK_NE(attribs_.green_size, 0); 165 DCHECK_NE(attribs_.green_size, 0);
168 DCHECK_NE(attribs_.blue_size, 0); 166 DCHECK_NE(attribs_.blue_size, 0);
169 return GL_RGB; 167 return GL_RGB;
170 } 168 }
171 169
172 } // namespace ui 170 } // namespace ui
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_command_buffer_stub.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698