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

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 2106103005: Revert of Pass initial size and GPU preference via context attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 "content/common/gpu/client/context_provider_command_buffer.h" 5 #include "content/common/gpu/client/context_provider_command_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 ContextProviderCommandBuffer::SharedProviders::SharedProviders() = default; 53 ContextProviderCommandBuffer::SharedProviders::SharedProviders() = default;
54 ContextProviderCommandBuffer::SharedProviders::~SharedProviders() = default; 54 ContextProviderCommandBuffer::SharedProviders::~SharedProviders() = default;
55 55
56 ContextProviderCommandBuffer::ContextProviderCommandBuffer( 56 ContextProviderCommandBuffer::ContextProviderCommandBuffer(
57 scoped_refptr<gpu::GpuChannelHost> channel, 57 scoped_refptr<gpu::GpuChannelHost> channel,
58 int32_t stream_id, 58 int32_t stream_id,
59 gpu::GpuStreamPriority stream_priority, 59 gpu::GpuStreamPriority stream_priority,
60 gpu::SurfaceHandle surface_handle, 60 gpu::SurfaceHandle surface_handle,
61 const GURL& active_url, 61 const GURL& active_url,
62 gl::GpuPreference gpu_preference,
62 bool automatic_flushes, 63 bool automatic_flushes,
63 bool support_locking, 64 bool support_locking,
64 const gpu::SharedMemoryLimits& memory_limits, 65 const gpu::SharedMemoryLimits& memory_limits,
65 const gpu::gles2::ContextCreationAttribHelper& attributes, 66 const gpu::gles2::ContextCreationAttribHelper& attributes,
66 ContextProviderCommandBuffer* shared_context_provider, 67 ContextProviderCommandBuffer* shared_context_provider,
67 command_buffer_metrics::ContextType type) 68 command_buffer_metrics::ContextType type)
68 : stream_id_(stream_id), 69 : stream_id_(stream_id),
69 stream_priority_(stream_priority), 70 stream_priority_(stream_priority),
70 surface_handle_(surface_handle), 71 surface_handle_(surface_handle),
71 active_url_(active_url), 72 active_url_(active_url),
73 gpu_preference_(gpu_preference),
72 automatic_flushes_(automatic_flushes), 74 automatic_flushes_(automatic_flushes),
73 support_locking_(support_locking), 75 support_locking_(support_locking),
74 memory_limits_(memory_limits), 76 memory_limits_(memory_limits),
75 attributes_(attributes), 77 attributes_(attributes),
76 context_type_(type), 78 context_type_(type),
77 shared_providers_(shared_context_provider 79 shared_providers_(shared_context_provider
78 ? shared_context_provider->shared_providers_ 80 ? shared_context_provider->shared_providers_
79 : new SharedProviders), 81 : new SharedProviders),
80 channel_(std::move(channel)) { 82 channel_(std::move(channel)) {
81 DCHECK(main_thread_checker_.CalledOnValidThread()); 83 DCHECK(main_thread_checker_.CalledOnValidThread());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 153
152 DCHECK(attributes_.buffer_preserved); 154 DCHECK(attributes_.buffer_preserved);
153 155
154 // This command buffer is a client-side proxy to the command buffer in the 156 // This command buffer is a client-side proxy to the command buffer in the
155 // GPU process. 157 // GPU process.
156 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 158 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
157 default_task_runner_; 159 default_task_runner_;
158 if (!task_runner) 160 if (!task_runner)
159 task_runner = base::ThreadTaskRunnerHandle::Get(); 161 task_runner = base::ThreadTaskRunnerHandle::Get();
160 command_buffer_ = gpu::CommandBufferProxyImpl::Create( 162 command_buffer_ = gpu::CommandBufferProxyImpl::Create(
161 std::move(channel_), surface_handle_, shared_command_buffer, stream_id_, 163 std::move(channel_), surface_handle_, gfx::Size(),
162 stream_priority_, attributes_, active_url_, std::move(task_runner)); 164 shared_command_buffer, stream_id_, stream_priority_,
165 attributes_, active_url_, gpu_preference_,
166 std::move(task_runner));
163 if (!command_buffer_) { 167 if (!command_buffer_) {
164 DLOG(ERROR) << "GpuChannelHost failed to create command buffer."; 168 DLOG(ERROR) << "GpuChannelHost failed to create command buffer.";
165 command_buffer_metrics::UmaRecordContextInitFailed(context_type_); 169 command_buffer_metrics::UmaRecordContextInitFailed(context_type_);
166 return false; 170 return false;
167 } 171 }
168 172
169 // The GLES2 helper writes the command buffer protocol. 173 // The GLES2 helper writes the command buffer protocol.
170 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get())); 174 gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer_.get()));
171 gles2_helper_->SetAutomaticFlushes(automatic_flushes_); 175 gles2_helper_->SetAutomaticFlushes(automatic_flushes_);
172 if (!gles2_helper_->Initialize(memory_limits_.command_buffer_size)) { 176 if (!gles2_helper_->Initialize(memory_limits_.command_buffer_size)) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 337
334 void ContextProviderCommandBuffer::SetLostContextCallback( 338 void ContextProviderCommandBuffer::SetLostContextCallback(
335 const LostContextCallback& lost_context_callback) { 339 const LostContextCallback& lost_context_callback) {
336 DCHECK(context_thread_checker_.CalledOnValidThread()); 340 DCHECK(context_thread_checker_.CalledOnValidThread());
337 DCHECK(lost_context_callback_.is_null() || 341 DCHECK(lost_context_callback_.is_null() ||
338 lost_context_callback.is_null()); 342 lost_context_callback.is_null());
339 lost_context_callback_ = lost_context_callback; 343 lost_context_callback_ = lost_context_callback;
340 } 344 }
341 345
342 } // namespace content 346 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/context_provider_command_buffer.h ('k') | content/renderer/pepper/pepper_video_encoder_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698