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 12 matching lines...) Expand all Loading... |
23 #include "base/metrics/field_trial.h" | 23 #include "base/metrics/field_trial.h" |
24 #include "base/metrics/histogram_macros.h" | 24 #include "base/metrics/histogram_macros.h" |
25 #include "base/path_service.h" | 25 #include "base/path_service.h" |
26 #include "base/process/process_metrics.h" | 26 #include "base/process/process_metrics.h" |
27 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
28 #include "base/strings/string16.h" | 28 #include "base/strings/string16.h" |
29 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
30 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
31 #include "base/strings/sys_string_conversions.h" | 31 #include "base/strings/sys_string_conversions.h" |
32 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
| 33 #include "base/threading/sequenced_worker_pool.h" |
33 #include "base/threading/simple_thread.h" | 34 #include "base/threading/simple_thread.h" |
34 #include "base/threading/thread_local.h" | 35 #include "base/threading/thread_local.h" |
35 #include "base/threading/thread_restrictions.h" | 36 #include "base/threading/thread_restrictions.h" |
36 #include "base/threading/thread_task_runner_handle.h" | 37 #include "base/threading/thread_task_runner_handle.h" |
37 #include "base/trace_event/memory_dump_manager.h" | 38 #include "base/trace_event/memory_dump_manager.h" |
38 #include "base/trace_event/trace_event.h" | 39 #include "base/trace_event/trace_event.h" |
39 #include "base/values.h" | 40 #include "base/values.h" |
40 #include "build/build_config.h" | 41 #include "build/build_config.h" |
41 #include "cc/base/histograms.h" | 42 #include "cc/base/histograms.h" |
42 #include "cc/base/switches.h" | 43 #include "cc/base/switches.h" |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 ChildThreadImpl::current()->SetThreadPriority( | 902 ChildThreadImpl::current()->SetThreadPriority( |
902 categorized_worker_pool_->background_worker_thread_id(), | 903 categorized_worker_pool_->background_worker_thread_id(), |
903 base::ThreadPriority::BACKGROUND); | 904 base::ThreadPriority::BACKGROUND); |
904 #endif | 905 #endif |
905 | 906 |
906 record_purge_suspend_metric_closure_.Reset(base::Bind( | 907 record_purge_suspend_metric_closure_.Reset(base::Bind( |
907 &RenderThreadImpl::RecordPurgeAndSuspendMetrics, base::Unretained(this))); | 908 &RenderThreadImpl::RecordPurgeAndSuspendMetrics, base::Unretained(this))); |
908 is_renderer_suspended_ = false; | 909 is_renderer_suspended_ = false; |
909 | 910 |
910 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); | 911 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); |
| 912 |
| 913 // If this renderer doesn't run inside the browser process, enable |
| 914 // SequencedWorkerPool. Otherwise, it should already have been enabled. |
| 915 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler |
| 916 // redirection experiment concludes https://crbug.com/622400. |
| 917 if (!command_line.HasSwitch(switches::kSingleProcess)) |
| 918 base::SequencedWorkerPool::EnableForProcess(); |
911 } | 919 } |
912 | 920 |
913 RenderThreadImpl::~RenderThreadImpl() { | 921 RenderThreadImpl::~RenderThreadImpl() { |
914 } | 922 } |
915 | 923 |
916 void RenderThreadImpl::Shutdown() { | 924 void RenderThreadImpl::Shutdown() { |
917 for (auto& observer : observers_) | 925 for (auto& observer : observers_) |
918 observer.OnRenderProcessShutdown(); | 926 observer.OnRenderProcessShutdown(); |
919 | 927 |
920 if (memory_observer_) { | 928 if (memory_observer_) { |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 } | 2490 } |
2483 } | 2491 } |
2484 | 2492 |
2485 void RenderThreadImpl::OnRendererInterfaceRequest( | 2493 void RenderThreadImpl::OnRendererInterfaceRequest( |
2486 mojom::RendererAssociatedRequest request) { | 2494 mojom::RendererAssociatedRequest request) { |
2487 DCHECK(!renderer_binding_.is_bound()); | 2495 DCHECK(!renderer_binding_.is_bound()); |
2488 renderer_binding_.Bind(std::move(request)); | 2496 renderer_binding_.Bind(std::move(request)); |
2489 } | 2497 } |
2490 | 2498 |
2491 } // namespace content | 2499 } // namespace content |
OLD | NEW |