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

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

Issue 1949023005: gpu: Add flag for enabling asynchronous worker context. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase fix Created 4 years, 7 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 }; 47 };
48 } 48 }
49 49
50 namespace content { 50 namespace content {
51 51
52 ContextProviderCommandBuffer::SharedProviders::SharedProviders() = default; 52 ContextProviderCommandBuffer::SharedProviders::SharedProviders() = default;
53 ContextProviderCommandBuffer::SharedProviders::~SharedProviders() = default; 53 ContextProviderCommandBuffer::SharedProviders::~SharedProviders() = default;
54 54
55 ContextProviderCommandBuffer::ContextProviderCommandBuffer( 55 ContextProviderCommandBuffer::ContextProviderCommandBuffer(
56 scoped_refptr<gpu::GpuChannelHost> channel, 56 scoped_refptr<gpu::GpuChannelHost> channel,
57 int32_t stream_id,
58 gpu::GpuStreamPriority stream_priority,
57 gpu::SurfaceHandle surface_handle, 59 gpu::SurfaceHandle surface_handle,
58 const GURL& active_url, 60 const GURL& active_url,
59 gfx::GpuPreference gpu_preference, 61 gfx::GpuPreference gpu_preference,
60 bool automatic_flushes, 62 bool automatic_flushes,
61 const gpu::SharedMemoryLimits& memory_limits, 63 const gpu::SharedMemoryLimits& memory_limits,
62 const gpu::gles2::ContextCreationAttribHelper& attributes, 64 const gpu::gles2::ContextCreationAttribHelper& attributes,
63 ContextProviderCommandBuffer* shared_context_provider, 65 ContextProviderCommandBuffer* shared_context_provider,
64 command_buffer_metrics::ContextType type) 66 command_buffer_metrics::ContextType type)
65 : surface_handle_(surface_handle), 67 : stream_id_(stream_id),
68 stream_priority_(stream_priority),
69 surface_handle_(surface_handle),
66 active_url_(active_url), 70 active_url_(active_url),
67 gpu_preference_(gpu_preference), 71 gpu_preference_(gpu_preference),
68 automatic_flushes_(automatic_flushes), 72 automatic_flushes_(automatic_flushes),
69 memory_limits_(memory_limits), 73 memory_limits_(memory_limits),
70 attributes_(attributes), 74 attributes_(attributes),
71 context_type_(type), 75 context_type_(type),
72 shared_providers_(shared_context_provider 76 shared_providers_(shared_context_provider
73 ? shared_context_provider->shared_providers_ 77 ? shared_context_provider->shared_providers_
74 : new SharedProviders), 78 : new SharedProviders),
75 channel_(std::move(channel)) { 79 channel_(std::move(channel)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 DCHECK_EQ(!!shared_command_buffer, !!share_group); 139 DCHECK_EQ(!!shared_command_buffer, !!share_group);
136 } 140 }
137 141
138 DCHECK(attributes_.buffer_preserved); 142 DCHECK(attributes_.buffer_preserved);
139 std::vector<int32_t> serialized_attributes; 143 std::vector<int32_t> serialized_attributes;
140 attributes_.Serialize(&serialized_attributes); 144 attributes_.Serialize(&serialized_attributes);
141 145
142 // This command buffer is a client-side proxy to the command buffer in the 146 // This command buffer is a client-side proxy to the command buffer in the
143 // GPU process. 147 // GPU process.
144 command_buffer_ = channel_->CreateCommandBuffer( 148 command_buffer_ = channel_->CreateCommandBuffer(
145 surface_handle_, gfx::Size(), shared_command_buffer, 149 surface_handle_, gfx::Size(), shared_command_buffer, stream_id_,
146 gpu::GpuChannelHost::kDefaultStreamId, 150 stream_priority_, serialized_attributes, active_url_, gpu_preference_);
147 gpu::GpuChannelHost::kDefaultStreamPriority, serialized_attributes,
148 active_url_, gpu_preference_);
149 // The command buffer takes ownership of the |channel_|, so no need to keep 151 // The command buffer takes ownership of the |channel_|, so no need to keep
150 // a reference around here. 152 // a reference around here.
151 channel_ = nullptr; 153 channel_ = nullptr;
152 if (!command_buffer_) { 154 if (!command_buffer_) {
153 DLOG(ERROR) << "GpuChannelHost failed to create command buffer."; 155 DLOG(ERROR) << "GpuChannelHost failed to create command buffer.";
154 command_buffer_metrics::UmaRecordContextInitFailed(context_type_); 156 command_buffer_metrics::UmaRecordContextInitFailed(context_type_);
155 return false; 157 return false;
156 } 158 }
157 159
158 // The GLES2 helper writes the command buffer protocol. 160 // The GLES2 helper writes the command buffer protocol.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 316
315 void ContextProviderCommandBuffer::SetLostContextCallback( 317 void ContextProviderCommandBuffer::SetLostContextCallback(
316 const LostContextCallback& lost_context_callback) { 318 const LostContextCallback& lost_context_callback) {
317 DCHECK(context_thread_checker_.CalledOnValidThread()); 319 DCHECK(context_thread_checker_.CalledOnValidThread());
318 DCHECK(lost_context_callback_.is_null() || 320 DCHECK(lost_context_callback_.is_null() ||
319 lost_context_callback.is_null()); 321 lost_context_callback.is_null());
320 lost_context_callback_ = lost_context_callback; 322 lost_context_callback_ = lost_context_callback;
321 } 323 }
322 324
323 } // namespace content 325 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/context_provider_command_buffer.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698