| 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 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/cancelable_callback.h" | 16 #include "base/cancelable_callback.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/memory_coordinator_client.h" | 18 #include "base/memory/memory_coordinator_client.h" |
| 19 #include "base/memory/memory_pressure_listener.h" | 19 #include "base/memory/memory_pressure_listener.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/metrics/field_trial.h" |
| 21 #include "base/metrics/user_metrics_action.h" | 22 #include "base/metrics/user_metrics_action.h" |
| 22 #include "base/observer_list.h" | 23 #include "base/observer_list.h" |
| 23 #include "base/strings/string16.h" | 24 #include "base/strings/string16.h" |
| 24 #include "base/threading/thread_checker.h" | 25 #include "base/threading/thread_checker.h" |
| 25 #include "base/timer/timer.h" | 26 #include "base/timer/timer.h" |
| 26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "components/variations/child_process_field_trial_syncer.h" |
| 27 #include "content/child/child_thread_impl.h" | 29 #include "content/child/child_thread_impl.h" |
| 28 #include "content/child/memory/child_memory_coordinator_impl.h" | 30 #include "content/child/memory/child_memory_coordinator_impl.h" |
| 29 #include "content/common/associated_interface_registry_impl.h" | 31 #include "content/common/associated_interface_registry_impl.h" |
| 30 #include "content/common/content_export.h" | 32 #include "content/common/content_export.h" |
| 31 #include "content/common/frame.mojom.h" | 33 #include "content/common/frame.mojom.h" |
| 32 #include "content/common/frame_replication_state.h" | 34 #include "content/common/frame_replication_state.h" |
| 33 #include "content/common/render_frame_message_filter.mojom.h" | 35 #include "content/common/render_frame_message_filter.mojom.h" |
| 34 #include "content/common/render_message_filter.mojom.h" | 36 #include "content/common/render_message_filter.mojom.h" |
| 35 #include "content/common/renderer.mojom.h" | 37 #include "content/common/renderer.mojom.h" |
| 36 #include "content/common/storage_partition_service.mojom.h" | 38 #include "content/common/storage_partition_service.mojom.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // | 153 // |
| 152 // Most of the communication occurs in the form of IPC messages. They are | 154 // Most of the communication occurs in the form of IPC messages. They are |
| 153 // routed to the RenderThread according to the routing IDs of the messages. | 155 // routed to the RenderThread according to the routing IDs of the messages. |
| 154 // The routing IDs correspond to RenderView instances. | 156 // The routing IDs correspond to RenderView instances. |
| 155 class CONTENT_EXPORT RenderThreadImpl | 157 class CONTENT_EXPORT RenderThreadImpl |
| 156 : public RenderThread, | 158 : public RenderThread, |
| 157 public ChildThreadImpl, | 159 public ChildThreadImpl, |
| 158 public blink::scheduler::RendererScheduler::RAILModeObserver, | 160 public blink::scheduler::RendererScheduler::RAILModeObserver, |
| 159 public ChildMemoryCoordinatorDelegate, | 161 public ChildMemoryCoordinatorDelegate, |
| 160 public base::MemoryCoordinatorClient, | 162 public base::MemoryCoordinatorClient, |
| 163 public base::FieldTrialList::Observer, |
| 161 NON_EXPORTED_BASE(public mojom::Renderer), | 164 NON_EXPORTED_BASE(public mojom::Renderer), |
| 162 NON_EXPORTED_BASE(public CompositorDependencies) { | 165 NON_EXPORTED_BASE(public CompositorDependencies) { |
| 163 public: | 166 public: |
| 164 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 167 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
| 165 static RenderThreadImpl* Create( | 168 static RenderThreadImpl* Create( |
| 166 std::unique_ptr<base::MessageLoop> main_message_loop, | 169 std::unique_ptr<base::MessageLoop> main_message_loop, |
| 167 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); | 170 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); |
| 168 static RenderThreadImpl* current(); | 171 static RenderThreadImpl* current(); |
| 169 static mojom::RenderMessageFilter* current_render_message_filter(); | 172 static mojom::RenderMessageFilter* current_render_message_filter(); |
| 170 static const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& | 173 static const scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr>& |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void IdleHandler() override; | 207 void IdleHandler() override; |
| 205 int64_t GetIdleNotificationDelayInMs() const override; | 208 int64_t GetIdleNotificationDelayInMs() const override; |
| 206 void SetIdleNotificationDelayInMs( | 209 void SetIdleNotificationDelayInMs( |
| 207 int64_t idle_notification_delay_in_ms) override; | 210 int64_t idle_notification_delay_in_ms) override; |
| 208 int PostTaskToAllWebWorkers(const base::Closure& closure) override; | 211 int PostTaskToAllWebWorkers(const base::Closure& closure) override; |
| 209 bool ResolveProxy(const GURL& url, std::string* proxy_list) override; | 212 bool ResolveProxy(const GURL& url, std::string* proxy_list) override; |
| 210 base::WaitableEvent* GetShutdownEvent() override; | 213 base::WaitableEvent* GetShutdownEvent() override; |
| 211 int32_t GetClientId() override; | 214 int32_t GetClientId() override; |
| 212 scoped_refptr<base::SingleThreadTaskRunner> GetTimerTaskRunner() override; | 215 scoped_refptr<base::SingleThreadTaskRunner> GetTimerTaskRunner() override; |
| 213 scoped_refptr<base::SingleThreadTaskRunner> GetLoadingTaskRunner() override; | 216 scoped_refptr<base::SingleThreadTaskRunner> GetLoadingTaskRunner() override; |
| 217 void SetFieldTrialGroup(const std::string& trial_name, |
| 218 const std::string& group_name) override; |
| 214 | 219 |
| 215 // IPC::Listener implementation via ChildThreadImpl: | 220 // IPC::Listener implementation via ChildThreadImpl: |
| 216 void OnAssociatedInterfaceRequest( | 221 void OnAssociatedInterfaceRequest( |
| 217 const std::string& name, | 222 const std::string& name, |
| 218 mojo::ScopedInterfaceEndpointHandle handle) override; | 223 mojo::ScopedInterfaceEndpointHandle handle) override; |
| 219 | 224 |
| 220 // CompositorDependencies implementation. | 225 // CompositorDependencies implementation. |
| 221 bool IsGpuRasterizationForced() override; | 226 bool IsGpuRasterizationForced() override; |
| 222 bool IsAsyncWorkerContextEnabled() override; | 227 bool IsAsyncWorkerContextEnabled() override; |
| 223 int GetGpuRasterizationMSAASampleCount() override; | 228 int GetGpuRasterizationMSAASampleCount() override; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); | 538 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); |
| 534 | 539 |
| 535 void InitializeCompositorThread(); | 540 void InitializeCompositorThread(); |
| 536 | 541 |
| 537 void InitializeWebKit( | 542 void InitializeWebKit( |
| 538 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); | 543 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); |
| 539 | 544 |
| 540 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); | 545 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
| 541 void OnGetAccessibilityTree(); | 546 void OnGetAccessibilityTree(); |
| 542 | 547 |
| 548 // base::FieldTrialList::Observer: |
| 549 void OnFieldTrialGroupFinalized(const std::string& trial_name, |
| 550 const std::string& group_name) override; |
| 551 |
| 543 // mojom::Renderer: | 552 // mojom::Renderer: |
| 544 void CreateView(mojom::CreateViewParamsPtr params) override; | 553 void CreateView(mojom::CreateViewParamsPtr params) override; |
| 545 void CreateFrame(mojom::CreateFrameParamsPtr params) override; | 554 void CreateFrame(mojom::CreateFrameParamsPtr params) override; |
| 546 void CreateFrameProxy(int32_t routing_id, | 555 void CreateFrameProxy(int32_t routing_id, |
| 547 int32_t render_view_routing_id, | 556 int32_t render_view_routing_id, |
| 548 int32_t opener_routing_id, | 557 int32_t opener_routing_id, |
| 549 int32_t parent_routing_id, | 558 int32_t parent_routing_id, |
| 550 const FrameReplicationState& replicated_state) override; | 559 const FrameReplicationState& replicated_state) override; |
| 551 void OnNetworkConnectionChanged( | 560 void OnNetworkConnectionChanged( |
| 552 net::NetworkChangeNotifier::ConnectionType type, | 561 net::NetworkChangeNotifier::ConnectionType type, |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr> | 776 scoped_refptr<mojom::ThreadSafeRenderMessageFilterAssociatedPtr> |
| 768 thread_safe_render_message_filter_; | 777 thread_safe_render_message_filter_; |
| 769 | 778 |
| 770 base::CancelableClosure record_purge_suspend_metric_closure_; | 779 base::CancelableClosure record_purge_suspend_metric_closure_; |
| 771 RendererMemoryMetrics purge_and_suspend_memory_metrics_; | 780 RendererMemoryMetrics purge_and_suspend_memory_metrics_; |
| 772 base::CancelableClosure record_purge_suspend_growth_metric_closure_; | 781 base::CancelableClosure record_purge_suspend_growth_metric_closure_; |
| 773 bool needs_to_record_first_active_paint_; | 782 bool needs_to_record_first_active_paint_; |
| 774 | 783 |
| 775 int32_t client_id_; | 784 int32_t client_id_; |
| 776 | 785 |
| 786 variations::ChildProcessFieldTrialSyncer field_trial_syncer_; |
| 787 |
| 777 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 788 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
| 778 }; | 789 }; |
| 779 | 790 |
| 780 #if defined(COMPILER_MSVC) | 791 #if defined(COMPILER_MSVC) |
| 781 #pragma warning(pop) | 792 #pragma warning(pop) |
| 782 #endif | 793 #endif |
| 783 | 794 |
| 784 } // namespace content | 795 } // namespace content |
| 785 | 796 |
| 786 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 797 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| OLD | NEW |