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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1703163002: Remove dependency on GURL from content/common/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gpu_command_buffer_stub.h" 5 #include "content/common/gpu/gpu_command_buffer_stub.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; 100 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_;
101 const uint64_t client_tracing_id_; 101 const uint64_t client_tracing_id_;
102 const int client_id_; 102 const int client_id_;
103 const uint64_t share_group_tracing_guid_; 103 const uint64_t share_group_tracing_guid_;
104 104
105 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); 105 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker);
106 }; 106 };
107 107
108 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the 108 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
109 // url_hash matches. 109 // url_hash matches.
110 void FastSetActiveURL(const GURL& url, size_t url_hash) { 110 void FastSetActiveURL(const std::string& url, size_t url_hash) {
111 // Leave the previously set URL in the empty case -- empty URLs are given by 111 // Leave the previously set URL in the empty case -- empty URLs are given by
112 // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the 112 // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the
113 // onscreen context URL was set previously and will show up even when a crash 113 // onscreen context URL was set previously and will show up even when a crash
114 // occurs during offscreen command processing. 114 // occurs during offscreen command processing.
115 if (url.is_empty()) 115 if (url.empty())
116 return; 116 return;
117 static size_t g_last_url_hash = 0; 117 static size_t g_last_url_hash = 0;
118 if (url_hash != g_last_url_hash) { 118 if (url_hash != g_last_url_hash) {
119 g_last_url_hash = url_hash; 119 g_last_url_hash = url_hash;
120 GetContentClient()->SetActiveURL(url); 120 GetContentClient()->SetActiveURL(url);
121 } 121 }
122 } 122 }
123 123
124 // The first time polling a fence, delay some extra time to allow other 124 // The first time polling a fence, delay some extra time to allow other
125 // stubs to process some work, or else the timing of the fences could 125 // stubs to process some work, or else the timing of the fences could
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 gpu::gles2::SubscriptionRefSet* subscription_ref_set, 186 gpu::gles2::SubscriptionRefSet* subscription_ref_set,
187 gpu::ValueStateMap* pending_valuebuffer_state, 187 gpu::ValueStateMap* pending_valuebuffer_state,
188 const gfx::Size& size, 188 const gfx::Size& size,
189 const gpu::gles2::DisallowedFeatures& disallowed_features, 189 const gpu::gles2::DisallowedFeatures& disallowed_features,
190 const std::vector<int32_t>& attribs, 190 const std::vector<int32_t>& attribs,
191 gfx::GpuPreference gpu_preference, 191 gfx::GpuPreference gpu_preference,
192 int32_t stream_id, 192 int32_t stream_id,
193 int32_t route_id, 193 int32_t route_id,
194 bool offscreen, 194 bool offscreen,
195 GpuWatchdog* watchdog, 195 GpuWatchdog* watchdog,
196 const GURL& active_url) 196 const std::string& active_url)
197 : channel_(channel), 197 : channel_(channel),
198 sync_point_manager_(sync_point_manager), 198 sync_point_manager_(sync_point_manager),
199 task_runner_(task_runner), 199 task_runner_(task_runner),
200 initialized_(false), 200 initialized_(false),
201 handle_(handle), 201 handle_(handle),
202 initial_size_(size), 202 initial_size_(size),
203 disallowed_features_(disallowed_features), 203 disallowed_features_(disallowed_features),
204 requested_attribs_(attribs), 204 requested_attribs_(attribs),
205 gpu_preference_(gpu_preference), 205 gpu_preference_(gpu_preference),
206 use_virtualized_gl_context_(false), 206 use_virtualized_gl_context_(false),
207 command_buffer_id_(GetCommandBufferID(channel->client_id(), route_id)), 207 command_buffer_id_(GetCommandBufferID(channel->client_id(), route_id)),
208 stream_id_(stream_id), 208 stream_id_(stream_id),
209 route_id_(route_id), 209 route_id_(route_id),
210 offscreen_(offscreen), 210 offscreen_(offscreen),
211 last_flush_count_(0), 211 last_flush_count_(0),
212 surface_format_(gfx::GLSurface::SURFACE_DEFAULT), 212 surface_format_(gfx::GLSurface::SURFACE_DEFAULT),
213 watchdog_(watchdog), 213 watchdog_(watchdog),
214 waiting_for_sync_point_(false), 214 waiting_for_sync_point_(false),
215 previous_processed_num_(0), 215 previous_processed_num_(0),
216 preemption_flag_(preempt_by_flag), 216 preemption_flag_(preempt_by_flag),
217 active_url_(active_url) { 217 active_url_(active_url) {
218 active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); 218 active_url_hash_ = base::Hash(active_url);
219 FastSetActiveURL(active_url_, active_url_hash_); 219 FastSetActiveURL(active_url_, active_url_hash_);
220 220
221 gpu::gles2::ContextCreationAttribHelper attrib_parser; 221 gpu::gles2::ContextCreationAttribHelper attrib_parser;
222 attrib_parser.Parse(requested_attribs_); 222 attrib_parser.Parse(requested_attribs_);
223 223
224 if (share_group) { 224 if (share_group) {
225 context_group_ = share_group->context_group_; 225 context_group_ = share_group->context_group_;
226 DCHECK(context_group_->bind_generates_resource() == 226 DCHECK(context_group_->bind_generates_resource() ==
227 attrib_parser.bind_generates_resource); 227 attrib_parser.bind_generates_resource);
228 } else { 228 } else {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 Send(wait_for_token_->reply.release()); 463 Send(wait_for_token_->reply.release());
464 wait_for_token_.reset(); 464 wait_for_token_.reset();
465 } 465 }
466 if (wait_for_get_offset_) { 466 if (wait_for_get_offset_) {
467 Send(wait_for_get_offset_->reply.release()); 467 Send(wait_for_get_offset_->reply.release());
468 wait_for_get_offset_.reset(); 468 wait_for_get_offset_.reset();
469 } 469 }
470 470
471 if (initialized_) { 471 if (initialized_) {
472 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); 472 GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
473 if (handle_.is_null() && !active_url_.is_empty()) { 473 if (handle_.is_null() && !active_url_.empty()) {
474 gpu_channel_manager->Send( 474 gpu_channel_manager->Send(
475 new GpuHostMsg_DidDestroyOffscreenContext(active_url_)); 475 new GpuHostMsg_DidDestroyOffscreenContext(active_url_));
476 } 476 }
477 } 477 }
478 478
479 if (decoder_) 479 if (decoder_)
480 decoder_->set_engine(NULL); 480 decoder_->set_engine(NULL);
481 481
482 // The scheduler has raw references to the decoder and the command buffer so 482 // The scheduler has raw references to the decoder and the command buffer so
483 // destroy it before those. 483 // destroy it before those.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 } 666 }
667 command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory( 667 command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory(
668 std::move(shared_state_shm), kSharedStateSize)); 668 std::move(shared_state_shm), kSharedStateSize));
669 669
670 gpu::Capabilities capabilities = decoder_->GetCapabilities(); 670 gpu::Capabilities capabilities = decoder_->GetCapabilities();
671 671
672 GpuCommandBufferMsg_Initialize::WriteReplyParams( 672 GpuCommandBufferMsg_Initialize::WriteReplyParams(
673 reply_message, true, capabilities); 673 reply_message, true, capabilities);
674 Send(reply_message); 674 Send(reply_message);
675 675
676 if (handle_.is_null() && !active_url_.is_empty()) { 676 if (handle_.is_null() && !active_url_.empty()) {
677 manager->Send(new GpuHostMsg_DidCreateOffscreenContext( 677 manager->Send(new GpuHostMsg_DidCreateOffscreenContext(
678 active_url_)); 678 active_url_));
679 } 679 }
680 680
681 initialized_ = true; 681 initialized_ = true;
682 } 682 }
683 683
684 void GpuCommandBufferStub::OnCreateStreamTexture(uint32_t texture_id, 684 void GpuCommandBufferStub::OnCreateStreamTexture(uint32_t texture_id,
685 int32_t stream_id, 685 int32_t stream_id,
686 bool* succeeded) { 686 bool* succeeded) {
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 result)); 1178 result));
1179 } 1179 }
1180 1180
1181 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1181 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1182 base::TimeDelta interval) { 1182 base::TimeDelta interval) {
1183 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1183 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1184 interval)); 1184 interval));
1185 } 1185 }
1186 1186
1187 } // namespace content 1187 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698