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 #include "content/browser/gpu/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "components/tracing/tracing_switches.h" | 24 #include "components/tracing/tracing_switches.h" |
25 #include "content/browser/browser_child_process_host_impl.h" | 25 #include "content/browser/browser_child_process_host_impl.h" |
26 #include "content/browser/gpu/compositor_util.h" | 26 #include "content/browser/gpu/compositor_util.h" |
27 #include "content/browser/gpu/gpu_data_manager_impl.h" | 27 #include "content/browser/gpu/gpu_data_manager_impl.h" |
28 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 28 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
29 #include "content/browser/gpu/gpu_surface_tracker.h" | 29 #include "content/browser/gpu/gpu_surface_tracker.h" |
30 #include "content/browser/gpu/shader_disk_cache.h" | 30 #include "content/browser/gpu/shader_disk_cache.h" |
31 #include "content/browser/mojo/mojo_application_host.h" | 31 #include "content/browser/mojo/mojo_application_host.h" |
32 #include "content/browser/renderer_host/render_widget_host_impl.h" | 32 #include "content/browser/renderer_host/render_widget_host_impl.h" |
33 #include "content/common/child_process_host_impl.h" | 33 #include "content/common/child_process_host_impl.h" |
34 #include "content/common/gpu/gpu_messages.h" | 34 #include "content/common/gpu/gpu_browser_messages.h" |
35 #include "content/common/in_process_child_thread_params.h" | 35 #include "content/common/in_process_child_thread_params.h" |
36 #include "content/common/view_messages.h" | 36 #include "content/common/view_messages.h" |
37 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/content_browser_client.h" | 38 #include "content/public/browser/content_browser_client.h" |
39 #include "content/public/browser/render_process_host.h" | 39 #include "content/public/browser/render_process_host.h" |
40 #include "content/public/browser/render_widget_host_view.h" | 40 #include "content/public/browser/render_widget_host_view.h" |
41 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 41 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
42 #include "content/public/common/content_client.h" | 42 #include "content/public/common/content_client.h" |
43 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
44 #include "content/public/common/result_codes.h" | 44 #include "content/public/common/result_codes.h" |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 549 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
550 options.priority = base::ThreadPriority::DISPLAY; | 550 options.priority = base::ThreadPriority::DISPLAY; |
551 #endif | 551 #endif |
552 in_process_gpu_thread_->StartWithOptions(options); | 552 in_process_gpu_thread_->StartWithOptions(options); |
553 | 553 |
554 OnProcessLaunched(); // Fake a callback that the process is ready. | 554 OnProcessLaunched(); // Fake a callback that the process is ready. |
555 } else if (!LaunchGpuProcess(channel_id)) { | 555 } else if (!LaunchGpuProcess(channel_id)) { |
556 return false; | 556 return false; |
557 } | 557 } |
558 | 558 |
559 if (!Send(new GpuMsg_Initialize())) | 559 if (!Send(new GpuBrowserMsg_Initialize())) |
560 return false; | 560 return false; |
561 | 561 |
562 return true; | 562 return true; |
563 } | 563 } |
564 | 564 |
565 bool GpuProcessHost::SetupMojo() { | 565 bool GpuProcessHost::SetupMojo() { |
566 DCHECK(!mojo_application_host_); | 566 DCHECK(!mojo_application_host_); |
567 mojo_application_host_.reset(new MojoApplicationHost); | 567 mojo_application_host_.reset(new MojoApplicationHost); |
568 return mojo_application_host_->Init(); | 568 return mojo_application_host_->Init(); |
569 } | 569 } |
(...skipping 23 matching lines...) Expand all Loading... |
593 } | 593 } |
594 | 594 |
595 void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) { | 595 void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) { |
596 DCHECK(CalledOnValidThread()); | 596 DCHECK(CalledOnValidThread()); |
597 process_->GetHost()->AddFilter(filter); | 597 process_->GetHost()->AddFilter(filter); |
598 } | 598 } |
599 | 599 |
600 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { | 600 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { |
601 DCHECK(CalledOnValidThread()); | 601 DCHECK(CalledOnValidThread()); |
602 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) | 602 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) |
603 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized) | 603 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_Initialized, OnInitialized) |
604 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) | 604 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_ChannelEstablished, |
605 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, | 605 OnChannelEstablished) |
| 606 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_GpuMemoryBufferCreated, |
606 OnGpuMemoryBufferCreated) | 607 OnGpuMemoryBufferCreated) |
607 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, | 608 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_DidCreateOffscreenContext, |
608 OnDidCreateOffscreenContext) | 609 OnDidCreateOffscreenContext) |
609 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) | 610 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_DidLoseContext, OnDidLoseContext) |
610 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, | 611 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_DidDestroyOffscreenContext, |
611 OnDidDestroyOffscreenContext) | 612 OnDidDestroyOffscreenContext) |
612 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, | 613 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_GpuMemoryUmaStats, |
613 OnGpuMemoryUmaStatsReceived) | 614 OnGpuMemoryUmaStatsReceived) |
614 #if defined(OS_MACOSX) | 615 #if defined(OS_MACOSX) |
615 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, | 616 IPC_MESSAGE_HANDLER_GENERIC( |
616 OnAcceleratedSurfaceBuffersSwapped(message)) | 617 GpuBrowserHostMsg_AcceleratedSurfaceBuffersSwapped, |
| 618 OnAcceleratedSurfaceBuffersSwapped(message)) |
617 #endif | 619 #endif |
618 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel, | 620 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_DestroyChannel, OnDestroyChannel) |
619 OnDestroyChannel) | 621 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_CacheShader, OnCacheShader) |
620 IPC_MESSAGE_HANDLER(GpuHostMsg_CacheShader, | |
621 OnCacheShader) | |
622 #if defined(OS_WIN) | 622 #if defined(OS_WIN) |
623 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceCreatedChildWindow, | 623 IPC_MESSAGE_HANDLER(GpuBrowserHostMsg_AcceleratedSurfaceCreatedChildWindow, |
624 OnAcceleratedSurfaceCreatedChildWindow) | 624 OnAcceleratedSurfaceCreatedChildWindow) |
625 #endif | 625 #endif |
626 | 626 |
627 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) | 627 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) |
628 IPC_END_MESSAGE_MAP() | 628 IPC_END_MESSAGE_MAP() |
629 | 629 |
630 return true; | 630 return true; |
631 } | 631 } |
632 | 632 |
633 #if defined(OS_WIN) | 633 #if defined(OS_WIN) |
634 void GpuProcessHost::OnAcceleratedSurfaceCreatedChildWindow( | 634 void GpuProcessHost::OnAcceleratedSurfaceCreatedChildWindow( |
635 const gfx::PluginWindowHandle& parent_handle, | 635 const gfx::PluginWindowHandle& parent_handle, |
636 const gfx::PluginWindowHandle& window_handle) { | 636 const gfx::PluginWindowHandle& window_handle) { |
637 if (!in_process_) { | 637 if (!in_process_) { |
638 DCHECK(process_); | 638 DCHECK(process_); |
639 { | 639 { |
640 DWORD process_id = 0; | 640 DWORD process_id = 0; |
641 DWORD thread_id = GetWindowThreadProcessId(parent_handle, &process_id); | 641 DWORD thread_id = GetWindowThreadProcessId(parent_handle, &process_id); |
642 | 642 |
643 if (!thread_id || process_id != ::GetCurrentProcessId()) { | 643 if (!thread_id || process_id != ::GetCurrentProcessId()) { |
644 process_->TerminateOnBadMessageReceived( | 644 process_->TerminateOnBadMessageReceived( |
645 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | 645 GpuBrowserHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); |
646 return; | 646 return; |
647 } | 647 } |
648 } | 648 } |
649 | 649 |
650 { | 650 { |
651 DWORD process_id = 0; | 651 DWORD process_id = 0; |
652 DWORD thread_id = GetWindowThreadProcessId(window_handle, &process_id); | 652 DWORD thread_id = GetWindowThreadProcessId(window_handle, &process_id); |
653 | 653 |
654 if (!thread_id || process_id != process_->GetProcess().Pid()) { | 654 if (!thread_id || process_id != process_->GetProcess().Pid()) { |
655 process_->TerminateOnBadMessageReceived( | 655 process_->TerminateOnBadMessageReceived( |
656 GpuHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); | 656 GpuBrowserHostMsg_AcceleratedSurfaceCreatedChildWindow::ID); |
657 return; | 657 return; |
658 } | 658 } |
659 } | 659 } |
660 } | 660 } |
661 | 661 |
662 ::SetParent(window_handle, parent_handle); | 662 ::SetParent(window_handle, parent_handle); |
663 } | 663 } |
664 #endif | 664 #endif |
665 | 665 |
666 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { | 666 void GpuProcessHost::OnChannelConnected(int32_t peer_pid) { |
(...skipping 15 matching lines...) Expand all Loading... |
682 DCHECK(CalledOnValidThread()); | 682 DCHECK(CalledOnValidThread()); |
683 TRACE_EVENT0("gpu", "GpuProcessHost::EstablishGpuChannel"); | 683 TRACE_EVENT0("gpu", "GpuProcessHost::EstablishGpuChannel"); |
684 | 684 |
685 // If GPU features are already blacklisted, no need to establish the channel. | 685 // If GPU features are already blacklisted, no need to establish the channel. |
686 if (!GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { | 686 if (!GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { |
687 DVLOG(1) << "GPU blacklisted, refusing to open a GPU channel."; | 687 DVLOG(1) << "GPU blacklisted, refusing to open a GPU channel."; |
688 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); | 688 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); |
689 return; | 689 return; |
690 } | 690 } |
691 | 691 |
692 GpuMsg_EstablishChannel_Params params; | 692 EstablishChannelParams params; |
693 params.client_id = client_id; | 693 params.client_id = client_id; |
694 params.client_tracing_id = client_tracing_id; | 694 params.client_tracing_id = client_tracing_id; |
695 params.preempts = preempts; | 695 params.preempts = preempts; |
696 params.allow_view_command_buffers = allow_view_command_buffers; | 696 params.allow_view_command_buffers = allow_view_command_buffers; |
697 params.allow_real_time_streams = allow_real_time_streams; | 697 params.allow_real_time_streams = allow_real_time_streams; |
698 if (Send(new GpuMsg_EstablishChannel(params))) { | 698 if (Send(new GpuBrowserMsg_EstablishChannel(params))) { |
699 channel_requests_.push(callback); | 699 channel_requests_.push(callback); |
700 } else { | 700 } else { |
701 DVLOG(1) << "Failed to send GpuMsg_EstablishChannel."; | 701 DVLOG(1) << "Failed to send GpuBrowserMsg_EstablishChannel."; |
702 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); | 702 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); |
703 } | 703 } |
704 | 704 |
705 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 705 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
706 switches::kDisableGpuShaderDiskCache)) { | 706 switches::kDisableGpuShaderDiskCache)) { |
707 CreateChannelCache(client_id); | 707 CreateChannelCache(client_id); |
708 } | 708 } |
709 } | 709 } |
710 | 710 |
711 void GpuProcessHost::CreateGpuMemoryBuffer( | 711 void GpuProcessHost::CreateGpuMemoryBuffer( |
712 gfx::GpuMemoryBufferId id, | 712 gfx::GpuMemoryBufferId id, |
713 const gfx::Size& size, | 713 const gfx::Size& size, |
714 gfx::BufferFormat format, | 714 gfx::BufferFormat format, |
715 gfx::BufferUsage usage, | 715 gfx::BufferUsage usage, |
716 int client_id, | 716 int client_id, |
717 int32_t surface_id, | 717 int32_t surface_id, |
718 const CreateGpuMemoryBufferCallback& callback) { | 718 const CreateGpuMemoryBufferCallback& callback) { |
719 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); | 719 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); |
720 | 720 |
721 DCHECK(CalledOnValidThread()); | 721 DCHECK(CalledOnValidThread()); |
722 | 722 |
723 GpuMsg_CreateGpuMemoryBuffer_Params params; | 723 GpuBrowserMsg_CreateGpuMemoryBuffer_Params params; |
724 params.id = id; | 724 params.id = id; |
725 params.size = size; | 725 params.size = size; |
726 params.format = format; | 726 params.format = format; |
727 params.usage = usage; | 727 params.usage = usage; |
728 params.client_id = client_id; | 728 params.client_id = client_id; |
729 params.surface_handle = | 729 params.surface_handle = |
730 GpuSurfaceTracker::GetInstance()->GetSurfaceHandle(surface_id).handle; | 730 GpuSurfaceTracker::GetInstance()->GetSurfaceHandle(surface_id).handle; |
731 if (Send(new GpuMsg_CreateGpuMemoryBuffer(params))) { | 731 if (Send(new GpuBrowserMsg_CreateGpuMemoryBuffer(params))) { |
732 create_gpu_memory_buffer_requests_.push(callback); | 732 create_gpu_memory_buffer_requests_.push(callback); |
733 } else { | 733 } else { |
734 callback.Run(gfx::GpuMemoryBufferHandle()); | 734 callback.Run(gfx::GpuMemoryBufferHandle()); |
735 } | 735 } |
736 } | 736 } |
737 | 737 |
738 void GpuProcessHost::CreateGpuMemoryBufferFromHandle( | 738 void GpuProcessHost::CreateGpuMemoryBufferFromHandle( |
739 const gfx::GpuMemoryBufferHandle& handle, | 739 const gfx::GpuMemoryBufferHandle& handle, |
740 gfx::GpuMemoryBufferId id, | 740 gfx::GpuMemoryBufferId id, |
741 const gfx::Size& size, | 741 const gfx::Size& size, |
742 gfx::BufferFormat format, | 742 gfx::BufferFormat format, |
743 int client_id, | 743 int client_id, |
744 const CreateGpuMemoryBufferCallback& callback) { | 744 const CreateGpuMemoryBufferCallback& callback) { |
745 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBufferFromHandle"); | 745 TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBufferFromHandle"); |
746 | 746 |
747 DCHECK(CalledOnValidThread()); | 747 DCHECK(CalledOnValidThread()); |
748 | 748 |
749 GpuMsg_CreateGpuMemoryBufferFromHandle_Params params; | 749 GpuBrowserMsg_CreateGpuMemoryBufferFromHandle_Params params; |
750 params.handle = handle; | 750 params.handle = handle; |
751 params.id = id; | 751 params.id = id; |
752 params.size = size; | 752 params.size = size; |
753 params.format = format; | 753 params.format = format; |
754 params.client_id = client_id; | 754 params.client_id = client_id; |
755 if (Send(new GpuMsg_CreateGpuMemoryBufferFromHandle(params))) { | 755 if (Send(new GpuBrowserMsg_CreateGpuMemoryBufferFromHandle(params))) { |
756 create_gpu_memory_buffer_requests_.push(callback); | 756 create_gpu_memory_buffer_requests_.push(callback); |
757 } else { | 757 } else { |
758 callback.Run(gfx::GpuMemoryBufferHandle()); | 758 callback.Run(gfx::GpuMemoryBufferHandle()); |
759 } | 759 } |
760 } | 760 } |
761 | 761 |
762 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | 762 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, |
763 int client_id, | 763 int client_id, |
764 const gpu::SyncToken& sync_token) { | 764 const gpu::SyncToken& sync_token) { |
765 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); | 765 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); |
766 | 766 |
767 DCHECK(CalledOnValidThread()); | 767 DCHECK(CalledOnValidThread()); |
768 | 768 |
769 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); | 769 Send(new GpuBrowserMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); |
770 } | 770 } |
771 | 771 |
772 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { | 772 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { |
773 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); | 773 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
774 initialized_ = result; | 774 initialized_ = result; |
775 gpu_info_ = gpu_info; | 775 gpu_info_ = gpu_info; |
776 | 776 |
777 if (!initialized_) | 777 if (!initialized_) |
778 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); | 778 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); |
779 else if (!in_process_) | 779 else if (!in_process_) |
780 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); | 780 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); |
781 } | 781 } |
782 | 782 |
783 void GpuProcessHost::OnChannelEstablished( | 783 void GpuProcessHost::OnChannelEstablished( |
784 const IPC::ChannelHandle& channel_handle) { | 784 const IPC::ChannelHandle& channel_handle) { |
785 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); | 785 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelEstablished"); |
786 | 786 |
787 if (channel_requests_.empty()) { | 787 if (channel_requests_.empty()) { |
788 // This happens when GPU process is compromised. | 788 // This happens when GPU process is compromised. |
789 RouteOnUIThread(GpuHostMsg_OnLogMessage( | 789 RouteOnUIThread(GpuBrowserHostMsg_OnLogMessage( |
790 logging::LOG_WARNING, | 790 logging::LOG_WARNING, "WARNING", |
791 "WARNING", | |
792 "Received a ChannelEstablished message but no requests in queue.")); | 791 "Received a ChannelEstablished message but no requests in queue.")); |
793 return; | 792 return; |
794 } | 793 } |
795 EstablishChannelCallback callback = channel_requests_.front(); | 794 EstablishChannelCallback callback = channel_requests_.front(); |
796 channel_requests_.pop(); | 795 channel_requests_.pop(); |
797 | 796 |
798 // Currently if any of the GPU features are blacklisted, we don't establish a | 797 // Currently if any of the GPU features are blacklisted, we don't establish a |
799 // GPU channel. | 798 // GPU channel. |
800 if (!channel_handle.name.empty() && | 799 if (!channel_handle.name.empty() && |
801 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { | 800 !GpuDataManagerImpl::GetInstance()->GpuAccessAllowed(NULL)) { |
802 Send(new GpuMsg_CloseChannel(channel_handle)); | 801 Send(new GpuBrowserMsg_CloseChannel(channel_handle)); |
803 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); | 802 callback.Run(IPC::ChannelHandle(), gpu::GPUInfo()); |
804 RouteOnUIThread(GpuHostMsg_OnLogMessage( | 803 RouteOnUIThread(GpuBrowserHostMsg_OnLogMessage( |
805 logging::LOG_WARNING, | 804 logging::LOG_WARNING, "WARNING", |
806 "WARNING", | |
807 "Hardware acceleration is unavailable.")); | 805 "Hardware acceleration is unavailable.")); |
808 return; | 806 return; |
809 } | 807 } |
810 | 808 |
811 callback.Run(channel_handle, gpu_info_); | 809 callback.Run(channel_handle, gpu_info_); |
812 } | 810 } |
813 | 811 |
814 void GpuProcessHost::OnGpuMemoryBufferCreated( | 812 void GpuProcessHost::OnGpuMemoryBufferCreated( |
815 const gfx::GpuMemoryBufferHandle& handle) { | 813 const gfx::GpuMemoryBufferHandle& handle) { |
816 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); | 814 TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 void GpuProcessHost::ForceShutdown() { | 916 void GpuProcessHost::ForceShutdown() { |
919 // This is only called on the IO thread so no race against the constructor | 917 // This is only called on the IO thread so no race against the constructor |
920 // for another GpuProcessHost. | 918 // for another GpuProcessHost. |
921 if (g_gpu_process_hosts[kind_] == this) | 919 if (g_gpu_process_hosts[kind_] == this) |
922 g_gpu_process_hosts[kind_] = NULL; | 920 g_gpu_process_hosts[kind_] = NULL; |
923 | 921 |
924 process_->ForceShutdown(); | 922 process_->ForceShutdown(); |
925 } | 923 } |
926 | 924 |
927 void GpuProcessHost::StopGpuProcess() { | 925 void GpuProcessHost::StopGpuProcess() { |
928 Send(new GpuMsg_Finalize()); | 926 Send(new GpuBrowserMsg_Finalize()); |
929 } | 927 } |
930 | 928 |
931 bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { | 929 bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { |
932 if (!(gpu_enabled_ && | 930 if (!(gpu_enabled_ && |
933 GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) && | 931 GpuDataManagerImpl::GetInstance()->ShouldUseSwiftShader()) && |
934 !hardware_gpu_enabled_) { | 932 !hardware_gpu_enabled_) { |
935 SendOutstandingReplies(); | 933 SendOutstandingReplies(); |
936 return false; | 934 return false; |
937 } | 935 } |
938 | 936 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 base::Base64Encode(base::SHA1HashString(in_str), &shader_prefix_key_); | 1111 base::Base64Encode(base::SHA1HashString(in_str), &shader_prefix_key_); |
1114 } | 1112 } |
1115 | 1113 |
1116 return shader_prefix_key_; | 1114 return shader_prefix_key_; |
1117 } | 1115 } |
1118 | 1116 |
1119 void GpuProcessHost::LoadedShader(const std::string& key, | 1117 void GpuProcessHost::LoadedShader(const std::string& key, |
1120 const std::string& data) { | 1118 const std::string& data) { |
1121 std::string prefix = GetShaderPrefixKey(); | 1119 std::string prefix = GetShaderPrefixKey(); |
1122 if (!key.compare(0, prefix.length(), prefix)) | 1120 if (!key.compare(0, prefix.length(), prefix)) |
1123 Send(new GpuMsg_LoadedShader(data)); | 1121 Send(new GpuBrowserMsg_LoadedShader(data)); |
1124 } | 1122 } |
1125 | 1123 |
1126 void GpuProcessHost::CreateChannelCache(int32_t client_id) { | 1124 void GpuProcessHost::CreateChannelCache(int32_t client_id) { |
1127 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); | 1125 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); |
1128 | 1126 |
1129 scoped_refptr<ShaderDiskCache> cache = | 1127 scoped_refptr<ShaderDiskCache> cache = |
1130 ShaderCacheFactory::GetInstance()->Get(client_id); | 1128 ShaderCacheFactory::GetInstance()->Get(client_id); |
1131 if (!cache.get()) | 1129 if (!cache.get()) |
1132 return; | 1130 return; |
1133 | 1131 |
(...skipping 13 matching lines...) Expand all Loading... |
1147 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1145 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1148 ClientIdToShaderCacheMap::iterator iter = | 1146 ClientIdToShaderCacheMap::iterator iter = |
1149 client_id_to_shader_cache_.find(client_id); | 1147 client_id_to_shader_cache_.find(client_id); |
1150 // If the cache doesn't exist then this is an off the record profile. | 1148 // If the cache doesn't exist then this is an off the record profile. |
1151 if (iter == client_id_to_shader_cache_.end()) | 1149 if (iter == client_id_to_shader_cache_.end()) |
1152 return; | 1150 return; |
1153 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1151 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1154 } | 1152 } |
1155 | 1153 |
1156 } // namespace content | 1154 } // namespace content |
OLD | NEW |