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