Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Side by Side Diff: content/renderer/render_thread_impl.h

Issue 2118903002: scheduler: Move the Blink scheduler into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another GYP fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/scheduler/renderer/renderer_scheduler.h"
26 #include "content/child/child_thread_impl.h" 25 #include "content/child/child_thread_impl.h"
27 #include "content/common/content_export.h" 26 #include "content/common/content_export.h"
28 #include "content/common/frame.mojom.h" 27 #include "content/common/frame.mojom.h"
29 #include "content/common/frame_replication_state.h" 28 #include "content/common/frame_replication_state.h"
30 #include "content/common/gpu_process_launch_causes.h" 29 #include "content/common/gpu_process_launch_causes.h"
31 #include "content/common/storage_partition_service.mojom.h" 30 #include "content/common/storage_partition_service.mojom.h"
32 #include "content/public/renderer/render_thread.h" 31 #include "content/public/renderer/render_thread.h"
33 #include "content/renderer/gpu/compositor_dependencies.h" 32 #include "content/renderer/gpu/compositor_dependencies.h"
34 #include "content/renderer/layout_test_dependencies.h" 33 #include "content/renderer/layout_test_dependencies.h"
35 #include "gpu/ipc/client/gpu_channel_host.h" 34 #include "gpu/ipc/client/gpu_channel_host.h"
36 #include "net/base/network_change_notifier.h" 35 #include "net/base/network_change_notifier.h"
37 #include "third_party/WebKit/public/platform/WebConnectionType.h" 36 #include "third_party/WebKit/public/platform/WebConnectionType.h"
37 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
38 #include "ui/gfx/native_widget_types.h" 38 #include "ui/gfx/native_widget_types.h"
39 39
40 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
41 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h" 41 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h"
42 #endif 42 #endif
43 43
44 class GrContext; 44 class GrContext;
45 class SkBitmap; 45 class SkBitmap;
46 struct FrameMsg_NewFrame_Params; 46 struct FrameMsg_NewFrame_Params;
47 struct ViewMsg_New_Params; 47 struct ViewMsg_New_Params;
48 struct ViewMsg_UpdateScrollbarTheme_Params; 48 struct ViewMsg_UpdateScrollbarTheme_Params;
49 struct WorkerProcessMsg_CreateWorker_Params; 49 struct WorkerProcessMsg_CreateWorker_Params;
50 50
51 namespace blink { 51 namespace blink {
52 namespace scheduler {
53 class WebThreadBase;
54 }
52 class WebGamepads; 55 class WebGamepads;
53 class WebMediaStreamCenter; 56 class WebMediaStreamCenter;
54 class WebMediaStreamCenterClient; 57 class WebMediaStreamCenterClient;
55 } 58 }
56 59
57 namespace base { 60 namespace base {
58 class SingleThreadTaskRunner; 61 class SingleThreadTaskRunner;
59 class Thread; 62 class Thread;
60 } 63 }
61 64
(...skipping 10 matching lines...) Expand all
72 75
73 namespace IPC { 76 namespace IPC {
74 class MessageFilter; 77 class MessageFilter;
75 } 78 }
76 79
77 namespace media { 80 namespace media {
78 class AudioHardwareConfig; 81 class AudioHardwareConfig;
79 class GpuVideoAcceleratorFactories; 82 class GpuVideoAcceleratorFactories;
80 } 83 }
81 84
82 namespace scheduler {
83 class WebThreadBase;
84 }
85
86 namespace v8 { 85 namespace v8 {
87 class Extension; 86 class Extension;
88 } 87 }
89 88
90 namespace content { 89 namespace content {
91 90
92 class AppCacheDispatcher; 91 class AppCacheDispatcher;
93 class AecDumpMessageFilter; 92 class AecDumpMessageFilter;
94 class AudioInputMessageFilter; 93 class AudioInputMessageFilter;
95 class AudioMessageFilter; 94 class AudioMessageFilter;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Likewise, it provides an API for the RenderViews to talk back to the main 138 // Likewise, it provides an API for the RenderViews to talk back to the main
140 // process (i.e., their corresponding WebContentsImpl). 139 // process (i.e., their corresponding WebContentsImpl).
141 // 140 //
142 // Most of the communication occurs in the form of IPC messages. They are 141 // Most of the communication occurs in the form of IPC messages. They are
143 // routed to the RenderThread according to the routing IDs of the messages. 142 // routed to the RenderThread according to the routing IDs of the messages.
144 // The routing IDs correspond to RenderView instances. 143 // The routing IDs correspond to RenderView instances.
145 class CONTENT_EXPORT RenderThreadImpl 144 class CONTENT_EXPORT RenderThreadImpl
146 : public RenderThread, 145 : public RenderThread,
147 public ChildThreadImpl, 146 public ChildThreadImpl,
148 public gpu::GpuChannelHostFactory, 147 public gpu::GpuChannelHostFactory,
149 public scheduler::RendererScheduler::RAILModeObserver, 148 public blink::scheduler::RendererScheduler::RAILModeObserver,
150 NON_EXPORTED_BASE(public CompositorDependencies) { 149 NON_EXPORTED_BASE(public CompositorDependencies) {
151 public: 150 public:
152 static RenderThreadImpl* Create(const InProcessChildThreadParams& params); 151 static RenderThreadImpl* Create(const InProcessChildThreadParams& params);
153 static RenderThreadImpl* Create( 152 static RenderThreadImpl* Create(
154 std::unique_ptr<base::MessageLoop> main_message_loop, 153 std::unique_ptr<base::MessageLoop> main_message_loop,
155 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler); 154 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler);
156 static RenderThreadImpl* current(); 155 static RenderThreadImpl* current();
157 156
158 ~RenderThreadImpl() override; 157 ~RenderThreadImpl() override;
159 void Shutdown() override; 158 void Shutdown() override;
160 159
161 // When initializing WebKit, ensure that any schemes needed for the content 160 // When initializing WebKit, ensure that any schemes needed for the content
162 // module are registered properly. Static to allow sharing with tests. 161 // module are registered properly. Static to allow sharing with tests.
163 static void RegisterSchemes(); 162 static void RegisterSchemes();
164 163
165 // Notify V8 that the date/time configuration of the system might have 164 // Notify V8 that the date/time configuration of the system might have
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 bool IsZeroCopyEnabled() override; 204 bool IsZeroCopyEnabled() override;
206 bool IsPartialRasterEnabled() override; 205 bool IsPartialRasterEnabled() override;
207 bool IsGpuMemoryBufferCompositorResourcesEnabled() override; 206 bool IsGpuMemoryBufferCompositorResourcesEnabled() override;
208 bool IsElasticOverscrollEnabled() override; 207 bool IsElasticOverscrollEnabled() override;
209 std::vector<unsigned> GetImageTextureTargets() override; 208 std::vector<unsigned> GetImageTextureTargets() override;
210 scoped_refptr<base::SingleThreadTaskRunner> 209 scoped_refptr<base::SingleThreadTaskRunner>
211 GetCompositorMainThreadTaskRunner() override; 210 GetCompositorMainThreadTaskRunner() override;
212 scoped_refptr<base::SingleThreadTaskRunner> 211 scoped_refptr<base::SingleThreadTaskRunner>
213 GetCompositorImplThreadTaskRunner() override; 212 GetCompositorImplThreadTaskRunner() override;
214 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override; 213 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
215 scheduler::RendererScheduler* GetRendererScheduler() override; 214 blink::scheduler::RendererScheduler* GetRendererScheduler() override;
216 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource( 215 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
217 int routing_id) override; 216 int routing_id) override;
218 cc::ImageSerializationProcessor* GetImageSerializationProcessor() override; 217 cc::ImageSerializationProcessor* GetImageSerializationProcessor() override;
219 cc::TaskGraphRunner* GetTaskGraphRunner() override; 218 cc::TaskGraphRunner* GetTaskGraphRunner() override;
220 bool AreImageDecodeTasksEnabled() override; 219 bool AreImageDecodeTasksEnabled() override;
221 bool IsThreadedAnimationEnabled() override; 220 bool IsThreadedAnimationEnabled() override;
222 221
223 // scheduler::RendererScheduler::RAILModeObserver implementation. 222 // blink::scheduler::RendererScheduler::RAILModeObserver implementation.
224 void OnRAILModeChanged(v8::RAILMode rail_mode) override; 223 void OnRAILModeChanged(v8::RAILMode rail_mode) override;
225 224
226 // Synchronously establish a channel to the GPU plugin if not previously 225 // Synchronously establish a channel to the GPU plugin if not previously
227 // established or if it has been lost (for example if the GPU plugin crashed). 226 // established or if it has been lost (for example if the GPU plugin crashed).
228 // If there is a pending asynchronous request, it will be completed by the 227 // If there is a pending asynchronous request, it will be completed by the
229 // time this routine returns. 228 // time this routine returns.
230 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync(CauseForGpuLaunch); 229 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync(CauseForGpuLaunch);
231 230
232 std::unique_ptr<cc::OutputSurface> CreateCompositorOutputSurface( 231 std::unique_ptr<cc::OutputSurface> CreateCompositorOutputSurface(
233 bool use_software, 232 bool use_software,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 442
444 void RegisterPendingFrameCreate(int routing_id, 443 void RegisterPendingFrameCreate(int routing_id,
445 mojom::FrameRequest frame, 444 mojom::FrameRequest frame,
446 mojom::FrameHostPtr host); 445 mojom::FrameHostPtr host);
447 446
448 mojom::StoragePartitionService* GetStoragePartitionService(); 447 mojom::StoragePartitionService* GetStoragePartitionService();
449 448
450 protected: 449 protected:
451 RenderThreadImpl( 450 RenderThreadImpl(
452 const InProcessChildThreadParams& params, 451 const InProcessChildThreadParams& params,
453 std::unique_ptr<scheduler::RendererScheduler> scheduler, 452 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler,
454 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue); 453 scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue);
455 RenderThreadImpl(std::unique_ptr<base::MessageLoop> main_message_loop, 454 RenderThreadImpl(
456 std::unique_ptr<scheduler::RendererScheduler> scheduler); 455 std::unique_ptr<base::MessageLoop> main_message_loop,
456 std::unique_ptr<blink::scheduler::RendererScheduler> scheduler);
457 457
458 private: 458 private:
459 // IPC::Listener 459 // IPC::Listener
460 void OnChannelError() override; 460 void OnChannelError() override;
461 461
462 // ChildThread 462 // ChildThread
463 bool OnControlMessageReceived(const IPC::Message& msg) override; 463 bool OnControlMessageReceived(const IPC::Message& msg) override;
464 void OnProcessBackgrounded(bool backgrounded) override; 464 void OnProcessBackgrounded(bool backgrounded) override;
465 void OnProcessPurgeAndSuspend() override; 465 void OnProcessPurgeAndSuspend() override;
466 void RecordAction(const base::UserMetricsAction& action) override; 466 void RecordAction(const base::UserMetricsAction& action) override;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 515
516 void ReleaseFreeMemory(); 516 void ReleaseFreeMemory();
517 517
518 void OnSyncMemoryPressure( 518 void OnSyncMemoryPressure(
519 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); 519 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
520 520
521 // These objects live solely on the render thread. 521 // These objects live solely on the render thread.
522 std::unique_ptr<AppCacheDispatcher> appcache_dispatcher_; 522 std::unique_ptr<AppCacheDispatcher> appcache_dispatcher_;
523 std::unique_ptr<DomStorageDispatcher> dom_storage_dispatcher_; 523 std::unique_ptr<DomStorageDispatcher> dom_storage_dispatcher_;
524 std::unique_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_; 524 std::unique_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_;
525 std::unique_ptr<scheduler::RendererScheduler> renderer_scheduler_; 525 std::unique_ptr<blink::scheduler::RendererScheduler> renderer_scheduler_;
526 std::unique_ptr<RendererBlinkPlatformImpl> blink_platform_impl_; 526 std::unique_ptr<RendererBlinkPlatformImpl> blink_platform_impl_;
527 std::unique_ptr<ResourceDispatchThrottler> resource_dispatch_throttler_; 527 std::unique_ptr<ResourceDispatchThrottler> resource_dispatch_throttler_;
528 std::unique_ptr<CacheStorageDispatcher> main_thread_cache_storage_dispatcher_; 528 std::unique_ptr<CacheStorageDispatcher> main_thread_cache_storage_dispatcher_;
529 std::unique_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_; 529 std::unique_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_;
530 530
531 // Used on the render thread and deleted by WebKit at shutdown. 531 // Used on the render thread and deleted by WebKit at shutdown.
532 blink::WebMediaStreamCenter* media_stream_center_; 532 blink::WebMediaStreamCenter* media_stream_center_;
533 533
534 // Used on the renderer and IPC threads. 534 // Used on the renderer and IPC threads.
535 scoped_refptr<BlobMessageFilter> blob_message_filter_; 535 scoped_refptr<BlobMessageFilter> blob_message_filter_;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 // The message loop of the renderer main thread. 595 // The message loop of the renderer main thread.
596 // This message loop should be destructed before the RenderThreadImpl 596 // This message loop should be destructed before the RenderThreadImpl
597 // shuts down Blink. 597 // shuts down Blink.
598 std::unique_ptr<base::MessageLoop> main_message_loop_; 598 std::unique_ptr<base::MessageLoop> main_message_loop_;
599 599
600 // A lazily initiated thread on which file operations are run. 600 // A lazily initiated thread on which file operations are run.
601 std::unique_ptr<base::Thread> file_thread_; 601 std::unique_ptr<base::Thread> file_thread_;
602 602
603 // May be null if overridden by ContentRendererClient. 603 // May be null if overridden by ContentRendererClient.
604 std::unique_ptr<scheduler::WebThreadBase> compositor_thread_; 604 std::unique_ptr<blink::scheduler::WebThreadBase> compositor_thread_;
605 605
606 // Utility class to provide GPU functionalities to media. 606 // Utility class to provide GPU functionalities to media.
607 // TODO(dcastagna): This should be just one scoped_ptr once 607 // TODO(dcastagna): This should be just one scoped_ptr once
608 // http://crbug.com/580386 is fixed. 608 // http://crbug.com/580386 is fixed.
609 // NOTE(dcastagna): At worst this accumulates a few bytes per context lost. 609 // NOTE(dcastagna): At worst this accumulates a few bytes per context lost.
610 ScopedVector<content::RendererGpuVideoAcceleratorFactories> gpu_factories_; 610 ScopedVector<content::RendererGpuVideoAcceleratorFactories> gpu_factories_;
611 611
612 // Thread for running multimedia operations (e.g., video decoding). 612 // Thread for running multimedia operations (e.g., video decoding).
613 std::unique_ptr<base::Thread> media_thread_; 613 std::unique_ptr<base::Thread> media_thread_;
614 614
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); 699 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
700 }; 700 };
701 701
702 #if defined(COMPILER_MSVC) 702 #if defined(COMPILER_MSVC)
703 #pragma warning(pop) 703 #pragma warning(pop)
704 #endif 704 #endif
705 705
706 } // namespace content 706 } // namespace content
707 707
708 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ 708 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698