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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 bool parsed_num_raster_threads = | 795 bool parsed_num_raster_threads = |
796 base::StringToInt(string_value, &num_raster_threads); | 796 base::StringToInt(string_value, &num_raster_threads); |
797 DCHECK(parsed_num_raster_threads) << string_value; | 797 DCHECK(parsed_num_raster_threads) << string_value; |
798 DCHECK_GT(num_raster_threads, 0); | 798 DCHECK_GT(num_raster_threads, 0); |
799 | 799 |
800 // Note: Currently, enabling image decode tasks only provides a benefit if | 800 // Note: Currently, enabling image decode tasks only provides a benefit if |
801 // there's more than one raster thread. This might change in the future but we | 801 // there's more than one raster thread. This might change in the future but we |
802 // avoid it for now to reduce the cost of recording. | 802 // avoid it for now to reduce the cost of recording. |
803 are_image_decode_tasks_enabled_ = num_raster_threads > 1; | 803 are_image_decode_tasks_enabled_ = num_raster_threads > 1; |
804 | 804 |
| 805 bool use_single_thread_for_background_raster_tasks = command_line.HasSwitch( |
| 806 switches::kUseSingleThreadForBackgroundRasterTasks); |
| 807 |
805 base::SimpleThread::Options thread_options; | 808 base::SimpleThread::Options thread_options; |
806 #if defined(OS_ANDROID) || defined(OS_LINUX) | 809 #if defined(OS_ANDROID) || defined(OS_LINUX) |
807 if (!command_line.HasSwitch( | 810 if (!command_line.HasSwitch( |
808 switches::kUseNormalPriorityForTileTaskWorkerThreads)) { | 811 switches::kUseNormalPriorityForTileTaskWorkerThreads)) { |
809 thread_options.set_priority(base::ThreadPriority::BACKGROUND); | 812 thread_options.set_priority(base::ThreadPriority::BACKGROUND); |
810 } | 813 } |
811 #endif | 814 #endif |
812 | 815 |
813 raster_worker_pool_->Start(num_raster_threads, thread_options); | 816 raster_worker_pool_->Start(num_raster_threads, |
| 817 use_single_thread_for_background_raster_tasks, |
| 818 thread_options); |
814 | 819 |
815 // TODO(boliu): In single process, browser main loop should set up the | 820 // TODO(boliu): In single process, browser main loop should set up the |
816 // discardable memory manager, and should skip this if kSingleProcess. | 821 // discardable memory manager, and should skip this if kSingleProcess. |
817 // See crbug.com/503724. | 822 // See crbug.com/503724. |
818 base::DiscardableMemoryAllocator::SetInstance( | 823 base::DiscardableMemoryAllocator::SetInstance( |
819 ChildThreadImpl::discardable_shared_memory_manager()); | 824 ChildThreadImpl::discardable_shared_memory_manager()); |
820 | 825 |
821 service_registry()->AddService<RenderFrameSetup>( | 826 service_registry()->AddService<RenderFrameSetup>( |
822 base::Bind(CreateRenderFrameSetup)); | 827 base::Bind(CreateRenderFrameSetup)); |
823 service_registry()->AddService<EmbeddedWorkerSetup>( | 828 service_registry()->AddService<EmbeddedWorkerSetup>( |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 } | 2097 } |
2093 | 2098 |
2094 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2099 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
2095 size_t erased = | 2100 size_t erased = |
2096 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2101 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
2097 routing_id_); | 2102 routing_id_); |
2098 DCHECK_EQ(1u, erased); | 2103 DCHECK_EQ(1u, erased); |
2099 } | 2104 } |
2100 | 2105 |
2101 } // namespace content | 2106 } // namespace content |
OLD | NEW |