| 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 |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
| 17 #include "base/message_loop/message_loop_proxy.h" | 17 #include "base/message_loop/message_loop_proxy.h" |
| 18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
| 21 #include "content/common/gpu/devtools_gpu_agent.h" | 21 #include "content/common/gpu/devtools_gpu_agent.h" |
| 22 #include "content/common/gpu/gpu_channel_manager.h" | 22 #include "content/common/gpu/gpu_channel_manager.h" |
| 23 #include "content/common/gpu/gpu_messages.h" | 23 #include "content/common/gpu/gpu_messages.h" |
| 24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
| 25 #include "gpu/command_buffer/common/mailbox.h" | 25 #include "gpu/command_buffer/common/mailbox.h" |
| 26 #include "gpu/command_buffer/service/gpu_scheduler.h" | 26 #include "gpu/command_buffer/service/gpu_scheduler.h" |
| 27 #include "gpu/command_buffer/service/mailbox_manager_impl.h" | 27 #include "gpu/command_buffer/service/mailbox_manager_impl.h" |
| 28 #include "gpu/command_buffer/service/sync_point_manager.h" | 28 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 29 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
| 29 #include "ipc/ipc_channel.h" | 30 #include "ipc/ipc_channel.h" |
| 30 #include "ipc/message_filter.h" | 31 #include "ipc/message_filter.h" |
| 31 #include "ui/gl/gl_context.h" | 32 #include "ui/gl/gl_context.h" |
| 32 #include "ui/gl/gl_surface.h" | 33 #include "ui/gl/gl_surface.h" |
| 33 | 34 |
| 34 #if defined(OS_POSIX) | 35 #if defined(OS_POSIX) |
| 35 #include "ipc/ipc_channel_posix.h" | 36 #include "ipc/ipc_channel_posix.h" |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 namespace content { | 39 namespace content { |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 shutdown_event); | 443 shutdown_event); |
| 443 | 444 |
| 444 filter_ = | 445 filter_ = |
| 445 new GpuChannelMessageFilter(weak_factory_.GetWeakPtr(), | 446 new GpuChannelMessageFilter(weak_factory_.GetWeakPtr(), |
| 446 gpu_channel_manager_->sync_point_manager(), | 447 gpu_channel_manager_->sync_point_manager(), |
| 447 base::MessageLoopProxy::current(), | 448 base::MessageLoopProxy::current(), |
| 448 allow_future_sync_points_); | 449 allow_future_sync_points_); |
| 449 io_message_loop_ = io_message_loop; | 450 io_message_loop_ = io_message_loop; |
| 450 channel_->AddFilter(filter_.get()); | 451 channel_->AddFilter(filter_.get()); |
| 451 | 452 |
| 453 valuebuffer_manager_ = new gpu::gles2::ValuebufferManager(); |
| 454 |
| 452 devtools_gpu_agent_.reset(new DevToolsGpuAgent(this)); | 455 devtools_gpu_agent_.reset(new DevToolsGpuAgent(this)); |
| 453 } | 456 } |
| 454 | 457 |
| 455 std::string GpuChannel::GetChannelName() { | 458 std::string GpuChannel::GetChannelName() { |
| 456 return channel_id_; | 459 return channel_id_; |
| 457 } | 460 } |
| 458 | 461 |
| 459 #if defined(OS_POSIX) | 462 #if defined(OS_POSIX) |
| 460 base::ScopedFD GpuChannel::TakeRendererFileDescriptor() { | 463 base::ScopedFD GpuChannel::TakeRendererFileDescriptor() { |
| 461 if (!channel_) { | 464 if (!channel_) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 bool use_virtualized_gl_context = false; | 572 bool use_virtualized_gl_context = false; |
| 570 #if defined(OS_MACOSX) | 573 #if defined(OS_MACOSX) |
| 571 use_virtualized_gl_context = true; | 574 use_virtualized_gl_context = true; |
| 572 #endif | 575 #endif |
| 573 | 576 |
| 574 scoped_ptr<GpuCommandBufferStub> stub( | 577 scoped_ptr<GpuCommandBufferStub> stub( |
| 575 new GpuCommandBufferStub(this, | 578 new GpuCommandBufferStub(this, |
| 576 share_group, | 579 share_group, |
| 577 window, | 580 window, |
| 578 mailbox_manager_.get(), | 581 mailbox_manager_.get(), |
| 582 valuebuffer_manager_.get(), |
| 579 gfx::Size(), | 583 gfx::Size(), |
| 580 disallowed_features_, | 584 disallowed_features_, |
| 581 init_params.attribs, | 585 init_params.attribs, |
| 582 init_params.gpu_preference, | 586 init_params.gpu_preference, |
| 583 use_virtualized_gl_context, | 587 use_virtualized_gl_context, |
| 584 route_id, | 588 route_id, |
| 585 surface_id, | 589 surface_id, |
| 586 watchdog_, | 590 watchdog_, |
| 587 software_, | 591 software_, |
| 588 init_params.active_url)); | 592 init_params.active_url)); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 int32 route_id, | 731 int32 route_id, |
| 728 bool* succeeded) { | 732 bool* succeeded) { |
| 729 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer"); | 733 TRACE_EVENT0("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer"); |
| 730 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); | 734 GpuCommandBufferStub* share_group = stubs_.Lookup(init_params.share_group_id); |
| 731 | 735 |
| 732 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( | 736 scoped_ptr<GpuCommandBufferStub> stub(new GpuCommandBufferStub( |
| 733 this, | 737 this, |
| 734 share_group, | 738 share_group, |
| 735 gfx::GLSurfaceHandle(), | 739 gfx::GLSurfaceHandle(), |
| 736 mailbox_manager_.get(), | 740 mailbox_manager_.get(), |
| 741 valuebuffer_manager_.get(), |
| 737 size, | 742 size, |
| 738 disallowed_features_, | 743 disallowed_features_, |
| 739 init_params.attribs, | 744 init_params.attribs, |
| 740 init_params.gpu_preference, | 745 init_params.gpu_preference, |
| 741 false, | 746 false, |
| 742 route_id, | 747 route_id, |
| 743 0, | 748 0, |
| 744 watchdog_, | 749 watchdog_, |
| 745 software_, | 750 software_, |
| 746 init_params.active_url)); | 751 init_params.active_url)); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 817 |
| 813 uint64 GpuChannel::GetMemoryUsage() { | 818 uint64 GpuChannel::GetMemoryUsage() { |
| 814 uint64 size = 0; | 819 uint64 size = 0; |
| 815 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); | 820 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); |
| 816 !it.IsAtEnd(); it.Advance()) { | 821 !it.IsAtEnd(); it.Advance()) { |
| 817 size += it.GetCurrentValue()->GetMemoryUsage(); | 822 size += it.GetCurrentValue()->GetMemoryUsage(); |
| 818 } | 823 } |
| 819 return size; | 824 return size; |
| 820 } | 825 } |
| 821 | 826 |
| 827 void GpuChannel::HandleUpdateValueState( |
| 828 unsigned int target, const gpu::ValueState& state) { |
| 829 valuebuffer_manager_->UpdateValueState(target, state); |
| 830 } |
| 831 |
| 822 } // namespace content | 832 } // namespace content |
| OLD | NEW |