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