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 <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/cancelable_callback.h" | 15 #include "base/cancelable_callback.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/memory_pressure_listener.h" | 17 #include "base/memory/memory_pressure_listener.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/metrics/user_metrics_action.h" | 19 #include "base/metrics/user_metrics_action.h" |
20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
23 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "components/memory_coordinator/child/child_memory_coordinator_impl.h" |
25 #include "content/child/child_thread_impl.h" | 26 #include "content/child/child_thread_impl.h" |
26 #include "content/common/content_export.h" | 27 #include "content/common/content_export.h" |
27 #include "content/common/frame.mojom.h" | 28 #include "content/common/frame.mojom.h" |
28 #include "content/common/frame_replication_state.h" | 29 #include "content/common/frame_replication_state.h" |
29 #include "content/common/render_frame_message_filter.mojom.h" | 30 #include "content/common/render_frame_message_filter.mojom.h" |
30 #include "content/common/storage_partition_service.mojom.h" | 31 #include "content/common/storage_partition_service.mojom.h" |
31 #include "content/public/renderer/render_thread.h" | 32 #include "content/public/renderer/render_thread.h" |
32 #include "content/renderer/gpu/compositor_dependencies.h" | 33 #include "content/renderer/gpu/compositor_dependencies.h" |
33 #include "content/renderer/layout_test_dependencies.h" | 34 #include "content/renderer/layout_test_dependencies.h" |
34 #include "gpu/ipc/client/gpu_channel_host.h" | 35 #include "gpu/ipc/client/gpu_channel_host.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 75 } |
75 | 76 |
76 namespace IPC { | 77 namespace IPC { |
77 class MessageFilter; | 78 class MessageFilter; |
78 } | 79 } |
79 | 80 |
80 namespace media { | 81 namespace media { |
81 class GpuVideoAcceleratorFactories; | 82 class GpuVideoAcceleratorFactories; |
82 } | 83 } |
83 | 84 |
84 namespace memory_coordinator { | |
85 class ChildMemoryCoordinatorImpl; | |
86 } | |
87 | |
88 namespace ui { | 85 namespace ui { |
89 class GpuService; | 86 class GpuService; |
90 } | 87 } |
91 | 88 |
92 namespace v8 { | 89 namespace v8 { |
93 class Extension; | 90 class Extension; |
94 } | 91 } |
95 | 92 |
96 namespace content { | 93 namespace content { |
97 | 94 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // process (i.e., their corresponding WebContentsImpl). | 143 // process (i.e., their corresponding WebContentsImpl). |
147 // | 144 // |
148 // Most of the communication occurs in the form of IPC messages. They are | 145 // Most of the communication occurs in the form of IPC messages. They are |
149 // routed to the RenderThread according to the routing IDs of the messages. | 146 // routed to the RenderThread according to the routing IDs of the messages. |
150 // The routing IDs correspond to RenderView instances. | 147 // The routing IDs correspond to RenderView instances. |
151 class CONTENT_EXPORT RenderThreadImpl | 148 class CONTENT_EXPORT RenderThreadImpl |
152 : public RenderThread, | 149 : public RenderThread, |
153 public ChildThreadImpl, | 150 public ChildThreadImpl, |
154 public gpu::GpuChannelHostFactory, | 151 public gpu::GpuChannelHostFactory, |
155 public blink::scheduler::RendererScheduler::RAILModeObserver, | 152 public blink::scheduler::RendererScheduler::RAILModeObserver, |
| 153 public memory_coordinator::ChildMemoryCoordinatorDelegate, |
156 NON_EXPORTED_BASE(public CompositorDependencies) { | 154 NON_EXPORTED_BASE(public CompositorDependencies) { |
157 public: | 155 public: |
158 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); | 156 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); |
159 static RenderThreadImpl* Create( | 157 static RenderThreadImpl* Create( |
160 std::unique_ptr<base::MessageLoop> main_message_loop, | 158 std::unique_ptr<base::MessageLoop> main_message_loop, |
161 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); | 159 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler); |
162 static RenderThreadImpl* current(); | 160 static RenderThreadImpl* current(); |
163 | 161 |
164 ~RenderThreadImpl() override; | 162 ~RenderThreadImpl() override; |
165 void Shutdown() override; | 163 void Shutdown() override; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 445 |
448 void AddEmbeddedWorkerRoute(int32_t routing_id, IPC::Listener* listener); | 446 void AddEmbeddedWorkerRoute(int32_t routing_id, IPC::Listener* listener); |
449 void RemoveEmbeddedWorkerRoute(int32_t routing_id); | 447 void RemoveEmbeddedWorkerRoute(int32_t routing_id); |
450 | 448 |
451 void RegisterPendingFrameCreate(int routing_id, | 449 void RegisterPendingFrameCreate(int routing_id, |
452 mojom::FrameRequest frame, | 450 mojom::FrameRequest frame, |
453 mojom::FrameHostPtr host); | 451 mojom::FrameHostPtr host); |
454 | 452 |
455 mojom::StoragePartitionService* GetStoragePartitionService(); | 453 mojom::StoragePartitionService* GetStoragePartitionService(); |
456 | 454 |
| 455 // memory_coordinator::ChildMemoryCoordinatorDelegate implementation. |
| 456 void OnTrimMemoryImmediately() override; |
| 457 |
457 protected: | 458 protected: |
458 RenderThreadImpl( | 459 RenderThreadImpl( |
459 const InProcessChildThreadParams& params, | 460 const InProcessChildThreadParams& params, |
460 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler, | 461 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler, |
461 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); | 462 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); |
462 RenderThreadImpl( | 463 RenderThreadImpl( |
463 std::unique_ptr<base::MessageLoop> main_message_loop, | 464 std::unique_ptr<base::MessageLoop> main_message_loop, |
464 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler); | 465 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler); |
465 | 466 |
466 private: | 467 private: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); | 714 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
714 }; | 715 }; |
715 | 716 |
716 #if defined(COMPILER_MSVC) | 717 #if defined(COMPILER_MSVC) |
717 #pragma warning(pop) | 718 #pragma warning(pop) |
718 #endif | 719 #endif |
719 | 720 |
720 } // namespace content | 721 } // namespace content |
721 | 722 |
722 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ | 723 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
OLD | NEW |