OLD | NEW |
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, | 393 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CreateOffscreenCommandBuffer, |
394 OnCreateOffscreenCommandBuffer) | 394 OnCreateOffscreenCommandBuffer) |
395 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, | 395 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_DestroyCommandBuffer, |
396 OnDestroyCommandBuffer) | 396 OnDestroyCommandBuffer) |
397 #if defined(OS_ANDROID) | 397 #if defined(OS_ANDROID) |
398 IPC_MESSAGE_HANDLER(GpuChannelMsg_RegisterStreamTextureProxy, | 398 IPC_MESSAGE_HANDLER(GpuChannelMsg_RegisterStreamTextureProxy, |
399 OnRegisterStreamTextureProxy) | 399 OnRegisterStreamTextureProxy) |
400 IPC_MESSAGE_HANDLER(GpuChannelMsg_EstablishStreamTexture, | 400 IPC_MESSAGE_HANDLER(GpuChannelMsg_EstablishStreamTexture, |
401 OnEstablishStreamTexture) | 401 OnEstablishStreamTexture) |
402 #endif | 402 #endif |
| 403 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuChannelMsg_CollectRenderingStats, |
| 404 OnCollectRenderingStats) |
403 IPC_MESSAGE_UNHANDLED(handled = false) | 405 IPC_MESSAGE_UNHANDLED(handled = false) |
404 IPC_END_MESSAGE_MAP() | 406 IPC_END_MESSAGE_MAP() |
405 DCHECK(handled) << msg.type(); | 407 DCHECK(handled) << msg.type(); |
406 return handled; | 408 return handled; |
407 } | 409 } |
408 | 410 |
409 void GpuChannel::HandleMessage() { | 411 void GpuChannel::HandleMessage() { |
410 handle_messages_scheduled_ = false; | 412 handle_messages_scheduled_ = false; |
411 | 413 |
412 if (!deferred_messages_.empty()) { | 414 if (!deferred_messages_.empty()) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 532 } |
531 | 533 |
532 void GpuChannel::OnEstablishStreamTexture( | 534 void GpuChannel::OnEstablishStreamTexture( |
533 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, | 535 int32 stream_id, content::SurfaceTexturePeer::SurfaceTextureTarget type, |
534 int32 primary_id, int32 secondary_id) { | 536 int32 primary_id, int32 secondary_id) { |
535 stream_texture_manager_->EstablishStreamTexture( | 537 stream_texture_manager_->EstablishStreamTexture( |
536 stream_id, type, primary_id, secondary_id); | 538 stream_id, type, primary_id, secondary_id); |
537 } | 539 } |
538 #endif | 540 #endif |
539 | 541 |
| 542 void GpuChannel::OnCollectRenderingStats( |
| 543 int32 surface_id, IPC::Message* reply_message) { |
| 544 content::GpuRenderingStats stats; |
| 545 |
| 546 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); |
| 547 !it.IsAtEnd(); it.Advance()) { |
| 548 int texture_upload_count = |
| 549 it.GetCurrentValue()->decoder()->GetTextureUploadCount(); |
| 550 base::TimeDelta total_texture_upload_time = |
| 551 it.GetCurrentValue()->decoder()->GetTotalTextureUploadTime(); |
| 552 base::TimeDelta total_processing_commands_time = |
| 553 it.GetCurrentValue()->decoder()->GetTotalProcessingCommandsTime(); |
| 554 |
| 555 stats.global_texture_upload_count += texture_upload_count; |
| 556 stats.global_total_texture_upload_time += total_texture_upload_time; |
| 557 stats.global_total_processing_commands_time += |
| 558 total_processing_commands_time; |
| 559 if (it.GetCurrentValue()->surface_id() == surface_id) { |
| 560 stats.texture_upload_count += texture_upload_count; |
| 561 stats.total_texture_upload_time += total_texture_upload_time; |
| 562 stats.total_processing_commands_time += total_processing_commands_time; |
| 563 } |
| 564 } |
| 565 |
| 566 GpuChannelMsg_CollectRenderingStats::WriteReplyParams( |
| 567 reply_message, |
| 568 stats); |
| 569 Send(reply_message); |
| 570 } |
OLD | NEW |