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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 ChildThreadImpl::current()->SetThreadPriority( | 897 ChildThreadImpl::current()->SetThreadPriority( |
897 categorized_worker_pool_->background_worker_thread_id(), | 898 categorized_worker_pool_->background_worker_thread_id(), |
898 base::ThreadPriority::BACKGROUND); | 899 base::ThreadPriority::BACKGROUND); |
899 #endif | 900 #endif |
900 | 901 |
901 record_purge_suspend_metric_closure_.Reset(base::Bind( | 902 record_purge_suspend_metric_closure_.Reset(base::Bind( |
902 &RenderThreadImpl::RecordPurgeAndSuspendMetrics, base::Unretained(this))); | 903 &RenderThreadImpl::RecordPurgeAndSuspendMetrics, base::Unretained(this))); |
903 is_renderer_suspended_ = false; | 904 is_renderer_suspended_ = false; |
904 | 905 |
905 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); | 906 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); |
| 907 |
| 908 // If this renderer doesn't run inside the browser process, enable |
| 909 // SequencedWorkerPool. Otherwise, it should already have been enabled. |
| 910 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler |
| 911 // redirection experiment concludes https://crbug.com/622400. |
| 912 if (!command_line.HasSwitch(switches::kSingleProcess)) |
| 913 base::SequencedWorkerPool::EnableForProcess(); |
906 } | 914 } |
907 | 915 |
908 RenderThreadImpl::~RenderThreadImpl() { | 916 RenderThreadImpl::~RenderThreadImpl() { |
909 } | 917 } |
910 | 918 |
911 void RenderThreadImpl::Shutdown() { | 919 void RenderThreadImpl::Shutdown() { |
912 for (auto& observer : observers_) | 920 for (auto& observer : observers_) |
913 observer.OnRenderProcessShutdown(); | 921 observer.OnRenderProcessShutdown(); |
914 | 922 |
915 if (memory_observer_) { | 923 if (memory_observer_) { |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2478 } | 2486 } |
2479 } | 2487 } |
2480 | 2488 |
2481 void RenderThreadImpl::OnRendererInterfaceRequest( | 2489 void RenderThreadImpl::OnRendererInterfaceRequest( |
2482 mojom::RendererAssociatedRequest request) { | 2490 mojom::RendererAssociatedRequest request) { |
2483 DCHECK(!renderer_binding_.is_bound()); | 2491 DCHECK(!renderer_binding_.is_bound()); |
2484 renderer_binding_.Bind(std::move(request)); | 2492 renderer_binding_.Bind(std::move(request)); |
2485 } | 2493 } |
2486 | 2494 |
2487 } // namespace content | 2495 } // namespace content |
OLD | NEW |