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

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

Issue 10386185: Add trace events to measure GPU process startup timing and time to first present. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.cc ('k') | content/gpu/gpu_info_collector_linux.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 (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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 FROM_HERE, 172 FROM_HERE,
173 base::Bind(&GpuChannel::HandleMessage, weak_factory_.GetWeakPtr())); 173 base::Bind(&GpuChannel::HandleMessage, weak_factory_.GetWeakPtr()));
174 handle_messages_scheduled_ = true; 174 handle_messages_scheduled_ = true;
175 } 175 }
176 176
177 void GpuChannel::CreateViewCommandBuffer( 177 void GpuChannel::CreateViewCommandBuffer(
178 const gfx::GLSurfaceHandle& window, 178 const gfx::GLSurfaceHandle& window,
179 int32 surface_id, 179 int32 surface_id,
180 const GPUCreateCommandBufferConfig& init_params, 180 const GPUCreateCommandBufferConfig& init_params,
181 int32* route_id) { 181 int32* route_id) {
182 TRACE_EVENT1("gpu",
183 "GpuChannel::CreateViewCommandBuffer",
184 "surface_id",
185 surface_id);
186
182 *route_id = MSG_ROUTING_NONE; 187 *route_id = MSG_ROUTING_NONE;
183 content::GetContentClient()->SetActiveURL(init_params.active_url); 188 content::GetContentClient()->SetActiveURL(init_params.active_url);
184 189
185 #if defined(ENABLE_GPU) 190 #if defined(ENABLE_GPU)
186 WillCreateCommandBuffer(init_params.gpu_preference); 191 WillCreateCommandBuffer(init_params.gpu_preference);
187 192
188 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 193 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
189 194
190 *route_id = GenerateRouteID(); 195 *route_id = GenerateRouteID();
191 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( 196 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub(
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 weak_factory_.GetWeakPtr(), 334 weak_factory_.GetWeakPtr(),
330 stub->route_id()), 335 stub->route_id()),
331 base::TimeDelta::FromMilliseconds(delay)); 336 base::TimeDelta::FromMilliseconds(delay));
332 } 337 }
333 } 338 }
334 339
335 void GpuChannel::OnCreateOffscreenCommandBuffer( 340 void GpuChannel::OnCreateOffscreenCommandBuffer(
336 const gfx::Size& size, 341 const gfx::Size& size,
337 const GPUCreateCommandBufferConfig& init_params, 342 const GPUCreateCommandBufferConfig& init_params,
338 IPC::Message* reply_message) { 343 IPC::Message* reply_message) {
344 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer");
345
339 int32 route_id = MSG_ROUTING_NONE; 346 int32 route_id = MSG_ROUTING_NONE;
340 347
341 content::GetContentClient()->SetActiveURL(init_params.active_url); 348 content::GetContentClient()->SetActiveURL(init_params.active_url);
342 #if defined(ENABLE_GPU) 349 #if defined(ENABLE_GPU)
343 WillCreateCommandBuffer(init_params.gpu_preference); 350 WillCreateCommandBuffer(init_params.gpu_preference);
344 351
345 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); 352 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id);
346 353
347 route_id = GenerateRouteID(); 354 route_id = GenerateRouteID();
348 355
(...skipping 17 matching lines...) Expand all
366 #endif 373 #endif
367 374
368 GpuChannelMsg_CreateOffscreenCommandBuffer::WriteReplyParams( 375 GpuChannelMsg_CreateOffscreenCommandBuffer::WriteReplyParams(
369 reply_message, 376 reply_message,
370 route_id); 377 route_id);
371 Send(reply_message); 378 Send(reply_message);
372 } 379 }
373 380
374 void GpuChannel::OnDestroyCommandBuffer(int32 route_id, 381 void GpuChannel::OnDestroyCommandBuffer(int32 route_id,
375 IPC::Message* reply_message) { 382 IPC::Message* reply_message) {
376 #if defined(ENABLE_GPU)
377 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", 383 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer",
378 "route_id", route_id); 384 "route_id", route_id);
385
386 #if defined(ENABLE_GPU)
piman 2012/05/17 22:30:03 nit: Just remove #ifdef altogether, since we don't
379 if (router_.ResolveRoute(route_id)) { 387 if (router_.ResolveRoute(route_id)) {
380 GpuCommandBufferStub* stub = stubs_.Lookup(route_id); 388 GpuCommandBufferStub* stub = stubs_.Lookup(route_id);
381 bool need_reschedule = (stub && !stub->IsScheduled()); 389 bool need_reschedule = (stub && !stub->IsScheduled());
382 gfx::GpuPreference gpu_preference = 390 gfx::GpuPreference gpu_preference =
383 stub ? stub->gpu_preference() : gfx::PreferIntegratedGpu; 391 stub ? stub->gpu_preference() : gfx::PreferIntegratedGpu;
384 router_.RemoveRoute(route_id); 392 router_.RemoveRoute(route_id);
385 stubs_.Remove(route_id); 393 stubs_.Remove(route_id);
386 // In case the renderer is currently blocked waiting for a sync reply from 394 // In case the renderer is currently blocked waiting for a sync reply from
387 // the stub, we need to make sure to reschedule the GpuChannel here. 395 // the stub, we need to make sure to reschedule the GpuChannel here.
388 if (need_reschedule) 396 if (need_reschedule)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) { 434 void GpuChannel::WillCreateCommandBuffer(gfx::GpuPreference gpu_preference) {
427 if (gpu_preference == gfx::PreferDiscreteGpu) 435 if (gpu_preference == gfx::PreferDiscreteGpu)
428 ++num_contexts_preferring_discrete_gpu_; 436 ++num_contexts_preferring_discrete_gpu_;
429 } 437 }
430 438
431 void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) { 439 void GpuChannel::DidDestroyCommandBuffer(gfx::GpuPreference gpu_preference) {
432 if (gpu_preference == gfx::PreferDiscreteGpu) 440 if (gpu_preference == gfx::PreferDiscreteGpu)
433 --num_contexts_preferring_discrete_gpu_; 441 --num_contexts_preferring_discrete_gpu_;
434 DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0); 442 DCHECK_GE(num_contexts_preferring_discrete_gpu_, 0);
435 } 443 }
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.cc ('k') | content/gpu/gpu_info_collector_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698