blob: b1bc912a299d120a8508981c6b01c1ac6f3be133 [file] [log] [blame]
[email protected]d3d6325d2012-01-03 21:17:361// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]f1a29a02011-10-06 23:08:445#ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
6#define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
initial.commit09911bf2008-07-26 23:55:297
avi1023d012015-12-25 02:39:148#include <stddef.h>
9#include <stdint.h>
10
maxmorin017ba8c62017-06-02 10:23:0911#include <map>
leon.han21e0e482017-02-23 04:13:3212#include <memory>
[email protected]6779aa12011-03-29 17:32:2413#include <set>
[email protected]b68d5ed2009-04-16 02:41:2814#include <string>
maxmorin017ba8c62017-06-02 10:23:0915#include <utility>
[email protected]1bc83062009-02-06 00:16:3716#include <vector>
17
jdduke691dd572014-12-02 20:47:5218#include "base/cancelable_callback.h"
avi1023d012015-12-25 02:39:1419#include "base/macros.h"
[email protected]5071cb22013-07-10 02:19:0620#include "base/memory/memory_pressure_listener.h"
rockot775ce0d2015-01-27 18:35:0121#include "base/memory/ref_counted.h"
[email protected]e6e30ac2014-01-13 21:24:3922#include "base/metrics/user_metrics_action.h"
[email protected]1223d6ef2011-03-28 16:47:5023#include "base/observer_list.h"
maxmorin017ba8c62017-06-02 10:23:0924#include "base/optional.h"
[email protected]21aa99682013-06-11 07:17:0125#include "base/strings/string16.h"
[email protected]88105162013-12-05 01:02:1226#include "base/threading/thread_checker.h"
tbansal99d8aeb2017-05-22 19:12:5827#include "base/time/time.h"
[email protected]abb522162013-06-28 01:54:1628#include "base/timer/timer.h"
[email protected]037fce02009-01-22 01:42:1529#include "build/build_config.h"
jam8a021512a2015-02-03 18:16:0830#include "content/child/child_thread_impl.h"
[email protected]8d128d62011-09-13 22:11:5731#include "content/common/content_export.h"
ben76f52b242016-06-18 05:42:4832#include "content/common/frame.mojom.h"
alexmosbc7eafa2014-12-06 01:38:0933#include "content/common/frame_replication_state.h"
samans2040988b2017-04-11 23:58:3534#include "content/common/frame_sink_provider.mojom.h"
jonrossa2ff4f82018-02-16 17:27:4635#include "content/common/render_frame_metadata.mojom.h"
rockote261d2112016-09-21 22:22:2336#include "content/common/render_message_filter.mojom.h"
rockot067ca55f2016-09-30 22:00:1537#include "content/common/renderer.mojom.h"
jam188f19f2017-06-07 03:56:2438#include "content/common/renderer_host.mojom.h"
[email protected]526476902011-10-06 20:34:0639#include "content/public/renderer/render_thread.h"
Yuzhu Shenfe5f3a52018-01-11 21:24:1340#include "content/public/renderer/url_loader_throttle_provider.h"
Sadrul Habib Chowdhury31c98712018-12-11 04:15:1341#include "content/renderer/compositor/compositor_dependencies.h"
Amos Limbcc710e2018-06-08 05:51:1742#include "content/renderer/media/audio/audio_input_ipc_factory.h"
43#include "content/renderer/media/audio/audio_output_ipc_factory.h"
penghuang346a46f92016-03-31 21:37:5244#include "gpu/ipc/client/gpu_channel_host.h"
Antoine Laboure55c9ef82017-11-10 18:51:2345#include "ipc/ipc_sync_channel.h"
Scott Violeta35f9a42018-03-22 22:00:4446#include "media/media_buildflags.h"
Julie Jeongeun Kim4e77af2622019-09-11 03:36:4547#include "mojo/public/cpp/bindings/associated_receiver.h"
blundellc00adf442016-09-16 10:43:4148#include "mojo/public/cpp/bindings/binding.h"
Julie Jeongeun Kim4e77af2622019-09-11 03:36:4549#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
Julie Jeongeun Kim4421c2e2019-09-11 06:34:3950#include "mojo/public/cpp/bindings/pending_receiver.h"
Julie Jeongeun Kim6f4b7e02019-09-11 05:05:4651#include "mojo/public/cpp/bindings/pending_remote.h"
Mario Sanchez Prada5492c9a2019-09-10 20:58:1152#include "mojo/public/cpp/bindings/remote.h"
jcivelli315d17f2016-11-29 16:15:0553#include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h"
[email protected]d7ff5fb2014-05-29 19:50:2554#include "net/base/network_change_notifier.h"
tbansalb612c5d2017-05-25 18:53:0655#include "net/nqe/effective_connection_type.h"
Ken Rockot54311e62018-02-10 19:01:5256#include "services/network/public/mojom/url_loader_factory.mojom.h"
Ben Goodger21ada1e2017-07-19 14:53:0157#include "services/service_manager/public/cpp/bind_source_info.h"
Ken Rockot510c5972017-12-05 16:37:0458#include "services/service_manager/public/cpp/binder_registry.h"
Miyoung Shin99505dd2019-07-27 12:45:3559#include "services/viz/public/mojom/compositing/compositing_mode_watcher.mojom.h"
Ken Rockot26e4e802018-07-31 15:03:3360#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
Mike West6e4cbb32019-02-13 09:40:1761#include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
Kent Tamura38fb4342018-07-25 12:47:5362#include "third_party/blink/public/platform/scheduler/web_rail_mode_observer.h"
Daniel Murphy738378c2019-05-31 21:59:2563#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h"
Blink Reformata30d4232018-04-07 15:31:0664#include "third_party/blink/public/platform/web_connection_type.h"
65#include "third_party/blink/public/web/web_memory_statistics.h"
[email protected]08397d52011-02-05 01:53:3866#include "ui/gfx/native_widget_types.h"
initial.commit09911bf2008-07-26 23:55:2967
[email protected]291857a2014-01-23 17:49:1168#if defined(OS_MACOSX)
Blink Reformata30d4232018-04-07 15:31:0669#include "third_party/blink/public/platform/mac/web_scrollbar_theme.h"
[email protected]291857a2014-01-23 17:49:1170#endif
71
[email protected]39008c02009-02-11 23:59:2572class SkBitmap;
[email protected]46f36a492010-07-28 19:36:4173
[email protected]180ef242013-11-07 06:50:4674namespace blink {
Antonio Gomes925f9b92019-07-30 23:23:2375class WebVideoCaptureImplManager;
[email protected]b7c7bcf2009-10-03 07:07:3476}
77
[email protected]64ffa0442011-10-03 22:08:3678namespace base {
skyostil457b0a12014-09-09 10:12:0779class SingleThreadTaskRunner;
[email protected]64ffa0442011-10-03 22:08:3680class Thread;
81}
82
[email protected]c29b7ff2013-03-06 03:51:0483namespace cc {
jbrianceed975022016-11-04 09:14:2584class BeginFrameSource;
samans09812d32017-03-27 19:51:5085class SyntheticBeginFrameSource;
reveman34b7a1522015-03-23 20:27:4786class TaskGraphRunner;
[email protected]c29b7ff2013-03-06 03:51:0487}
88
penghuang342762b2016-12-02 21:04:5889namespace discardable_memory {
90class ClientDiscardableSharedMemoryManager;
91}
92
penghuang346a46f92016-03-31 21:37:5293namespace gpu {
94class GpuChannelHost;
95}
96
[email protected]1842fe22012-08-13 23:24:3597namespace IPC {
[email protected]74122042014-04-25 00:07:3098class MessageFilter;
[email protected]1842fe22012-08-13 23:24:3599}
100
[email protected]563d665f2013-02-01 04:42:39101namespace media {
[email protected]2329bfc72014-02-28 02:03:21102class GpuVideoAcceleratorFactories;
[email protected]563d665f2013-02-01 04:42:39103}
104
[email protected]e9ff79c2012-10-19 21:31:26105namespace v8 {
106class Extension;
107}
108
danakj92429852017-06-29 00:19:03109namespace viz {
Fady Samuelc645ffe2017-07-24 17:28:20110class BeginFrameSource;
Scott Violet7e33efc2018-08-29 22:30:15111class ContextProviderCommandBuffer;
112class Gpu;
Scott Violet703b8242019-06-11 19:34:36113class RasterContextProvider;
114class SyntheticBeginFrameSource;
115} // namespace viz
Scott Violet7e33efc2018-08-29 22:30:15116
[email protected]64ffa0442011-10-03 22:08:36117namespace content {
[email protected]3958e972012-07-17 00:25:41118class AudioRendererMixerManager;
fsamuel6c1dfeb2014-12-18 19:21:33119class BrowserPluginManager;
John Abd-El-Maleke1d4de32017-10-21 16:14:29120class CategorizedWorkerPool;
John Abd-El-Maleke1d4de32017-10-21 16:14:29121class GpuVideoAcceleratorFactoriesImpl;
Robert Sesek6e3d725c2018-06-06 14:38:02122class LowMemoryModeController;
jsbellabadb9b2015-03-23 21:03:44123class PeerConnectionDependencyFactory;
[email protected]af089972013-01-10 04:04:40124class PeerConnectionTracker;
tyoshino832a58a2016-04-18 08:14:08125class RenderThreadObserver;
tfarina556a7232014-10-05 01:02:09126class RendererBlinkPlatformImpl;
John Abd-El-Malek6b56ef712017-10-21 22:52:46127class ResourceDispatcher;
[email protected]cb25aa12012-08-07 19:13:43128
boliubee541f42015-11-05 00:52:53129#if defined(OS_ANDROID)
siva.gunturi5d4feb052015-11-15 16:15:31130class StreamTextureFactory;
boliubee541f42015-11-05 00:52:53131#endif
132
jam8a021512a2015-02-03 18:16:08133#if defined(COMPILER_MSVC)
134// See explanation for other RenderViewHostImpl which is the same issue.
135#pragma warning(push)
136#pragma warning(disable: 4250)
137#endif
138
Matt Falkenhagenef13d782019-05-30 21:02:12139// The RenderThreadImpl class represents the main thread, where RenderView
initial.commit09911bf2008-07-26 23:55:29140// instances live. The RenderThread supports an API that is used by its
141// consumer to talk indirectly to the RenderViews and supporting objects.
142// Likewise, it provides an API for the RenderViews to talk back to the main
[email protected]770005b2012-04-16 15:58:13143// process (i.e., their corresponding WebContentsImpl).
initial.commit09911bf2008-07-26 23:55:29144//
145// Most of the communication occurs in the form of IPC messages. They are
146// routed to the RenderThread according to the routing IDs of the messages.
147// The routing IDs correspond to RenderView instances.
danakj6e3bf8012014-12-16 18:27:53148class CONTENT_EXPORT RenderThreadImpl
149 : public RenderThread,
jam8a021512a2015-02-03 18:16:08150 public ChildThreadImpl,
Nico Weber43ddd7a32017-08-15 19:19:27151 public mojom::Renderer,
danakjab9ef4d2017-10-31 23:38:33152 public viz::mojom::CompositingModeWatcher,
Nico Weber43ddd7a32017-08-15 19:19:27153 public CompositorDependencies {
initial.commit09911bf2008-07-26 23:55:29154 public:
[email protected]f1a29a02011-10-06 23:08:44155 static RenderThreadImpl* current();
rockot5c478a72016-09-28 23:14:18156 static mojom::RenderMessageFilter* current_render_message_filter();
olegmax045f7fb12017-05-19 07:58:55157 static RendererBlinkPlatformImpl* current_blink_platform_impl();
rockot5c478a72016-09-28 23:14:18158
159 static void SetRenderMessageFilterForTesting(
160 mojom::RenderMessageFilter* render_message_filter);
olegmax045f7fb12017-05-19 07:58:55161 static void SetRendererBlinkPlatformImplForTesting(
162 RendererBlinkPlatformImpl* blink_platform_impl);
[email protected]526476902011-10-06 20:34:06163
John Abd-El-Malekd4882642017-12-04 21:45:19164 // Returns the task runner for the main thread where the RenderThread lives.
Hajime Hoshi20578c62018-01-12 09:43:26165 static scoped_refptr<base::SingleThreadTaskRunner>
166 DeprecatedGetMainTaskRunner();
John Abd-El-Malekd4882642017-12-04 21:45:19167
Wez6979109b2018-09-07 17:30:56168 RenderThreadImpl(
169 base::RepeatingClosure quit_closure,
Greg Kraynovf5d60272018-08-10 12:28:51170 std::unique_ptr<blink::scheduler::WebThreadScheduler> scheduler);
171 RenderThreadImpl(
172 const InProcessChildThreadParams& params,
173 std::unique_ptr<blink::scheduler::WebThreadScheduler> scheduler);
dcheng6d18e402014-10-21 12:32:52174 ~RenderThreadImpl() override;
175 void Shutdown() override;
harakenbbfdd9f02017-01-12 07:14:04176 bool ShouldBeDestroyed() override;
initial.commit09911bf2008-07-26 23:55:29177
[email protected]58436a12012-03-21 17:10:26178 // When initializing WebKit, ensure that any schemes needed for the content
179 // module are registered properly. Static to allow sharing with tests.
180 static void RegisterSchemes();
181
[email protected]e9ff79c2012-10-19 21:31:26182 // RenderThread implementation:
dcheng6d18e402014-10-21 12:32:52183 bool Send(IPC::Message* msg) override;
dcheng6d18e402014-10-21 12:32:52184 IPC::SyncChannel* GetChannel() override;
185 std::string GetLocale() override;
186 IPC::SyncMessageFilter* GetSyncMessageFilter() override;
avi1023d012015-12-25 02:39:14187 void AddRoute(int32_t routing_id, IPC::Listener* listener) override;
188 void RemoveRoute(int32_t routing_id) override;
dcheng6d18e402014-10-21 12:32:52189 int GenerateRoutingID() override;
190 void AddFilter(IPC::MessageFilter* filter) override;
191 void RemoveFilter(IPC::MessageFilter* filter) override;
tyoshino832a58a2016-04-18 08:14:08192 void AddObserver(RenderThreadObserver* observer) override;
193 void RemoveObserver(RenderThreadObserver* observer) override;
dcheng6d18e402014-10-21 12:32:52194 void SetResourceDispatcherDelegate(
mohan.reddyee0b42a2014-10-08 04:53:14195 ResourceDispatcherDelegate* delegate) override;
dchengcedca5612016-04-09 01:40:15196 std::unique_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer(
mohan.reddyee0b42a2014-10-08 04:53:14197 size_t buffer_size) override;
Clemens Hammacher38b6a762019-02-05 13:07:22198 void RegisterExtension(std::unique_ptr<v8::Extension> extension) override;
danakj8bda2712019-05-24 23:20:44199 int PostTaskToAllWebWorkers(const base::RepeatingClosure& closure) override;
dcheng6d18e402014-10-21 12:32:52200 bool ResolveProxy(const GURL& url, std::string* proxy_list) override;
201 base::WaitableEvent* GetShutdownEvent() override;
staraz067f58242016-11-07 21:06:41202 int32_t GetClientId() override;
Nasko Oskov3d0d1dc2018-09-25 03:57:13203 bool IsOnline() override;
Karan Bhatiac89897f2017-08-10 01:06:40204 void SetRendererProcessType(
Yuta Kitamura63593502018-11-12 09:27:13205 blink::scheduler::WebRendererProcessType type) override;
Lucas Furukawa Gadanid51ff5d62018-12-07 21:26:49206 blink::WebString GetUserAgent() override;
Mike West6e4cbb32019-02-13 09:40:17207 const blink::UserAgentMetadata& GetUserAgentMetadata() override;
[email protected]1223d6ef2011-03-28 16:47:50208
rockot067ca55f2016-09-30 22:00:15209 // IPC::Listener implementation via ChildThreadImpl:
210 void OnAssociatedInterfaceRequest(
211 const std::string& name,
212 mojo::ScopedInterfaceEndpointHandle handle) override;
213
weilifabbf7572017-05-22 19:05:16214 // ChildThread implementation via ChildThreadImpl:
215 scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override;
216
Ken Rockotc185b2a2019-08-01 22:19:48217 // ChildThreadImpl implementation:
218 void OnBindReceiver(mojo::GenericPendingReceiver receiver) override;
219
danakj6e3bf8012014-12-16 18:27:53220 // CompositorDependencies implementation.
danakj6e3bf8012014-12-16 18:27:53221 bool IsGpuRasterizationForced() override;
senorblancob60ba952015-01-27 19:12:36222 int GetGpuRasterizationMSAASampleCount() override;
danakj6e3bf8012014-12-16 18:27:53223 bool IsLcdTextEnabled() override;
danakj6e3bf8012014-12-16 18:27:53224 bool IsZeroCopyEnabled() override;
ericrk1d17f752015-10-20 03:03:07225 bool IsPartialRasterEnabled() override;
ccameronc7fcd132015-11-03 20:14:31226 bool IsGpuMemoryBufferCompositorResourcesEnabled() override;
ccamerona7644752014-12-30 01:16:31227 bool IsElasticOverscrollEnabled() override;
danakj4b347212018-07-04 17:55:17228 bool IsUseZoomForDSFEnabled() override;
danakj6e3bf8012014-12-16 18:27:53229 scoped_refptr<base::SingleThreadTaskRunner>
230 GetCompositorMainThreadTaskRunner() override;
231 scoped_refptr<base::SingleThreadTaskRunner>
232 GetCompositorImplThreadTaskRunner() override;
Yuta Kitamuradeb91bb2018-05-29 05:53:20233 blink::scheduler::WebThreadScheduler* GetWebMainThreadScheduler() override;
reveman34b7a1522015-03-23 20:27:47234 cc::TaskGraphRunner* GetTaskGraphRunner() override;
wjmaclean1d970622017-01-21 22:28:24235 bool IsScrollAnimatorEnabled() override;
Khushal3e96e662017-10-30 23:16:50236 std::unique_ptr<cc::UkmRecorderFactory> CreateUkmRecorderFactory() override;
danakj2d2889a2019-04-05 21:22:08237 void RequestNewLayerTreeFrameSink(
238 int widget_routing_id,
239 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue,
240 const GURL& url,
241 LayerTreeFrameSinkCallback callback,
Julie Jeongeun Kim4421c2e2019-09-11 06:34:39242 mojo::PendingReceiver<mojom::RenderFrameMetadataObserverClient>
243 render_frame_metadata_observer_client_receiver,
Julie Jeongeun Kim6f4b7e02019-09-11 05:05:46244 mojo::PendingRemote<mojom::RenderFrameMetadataObserver>
245 render_frame_metadata_observer_remote,
danakj2d2889a2019-04-05 21:22:08246 const char* client_name) override;
danakj4b347212018-07-04 17:55:17247#ifdef OS_ANDROID
248 bool UsingSynchronousCompositing() override;
249#endif
danakj6e3bf8012014-12-16 18:27:53250
danakje6da4f12018-07-04 17:41:30251 bool IsThreadedAnimationEnabled();
252
danakjab9ef4d2017-10-31 23:38:33253 // viz::mojom::CompositingModeWatcher implementation.
254 void CompositingModeFallbackToSoftware() override;
255
256 // Whether gpu compositing is being used or is disabled for software
257 // compositing. Clients of the compositor should give resources that match
258 // the appropriate mode.
259 bool IsGpuCompositingDisabled() { return is_gpu_compositing_disabled_; }
260
[email protected]b3e83de2012-02-07 03:33:28261 // Synchronously establish a channel to the GPU plugin if not previously
262 // established or if it has been lost (for example if the GPU plugin crashed).
263 // If there is a pending asynchronous request, it will be completed by the
Bo Liud1ef1c32017-12-08 06:15:50264 // time this routine returns.
265 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync();
[email protected]b3e83de2012-02-07 03:33:28266
pimanc44437a22016-10-29 00:09:22267 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager();
268
Sam McNally52e50282017-11-29 00:54:02269 blink::AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry();
rockot067ca55f2016-09-30 22:00:15270
Kent Tamura2eab5b12018-12-07 04:31:23271 // True if we are running web tests. This currently disables forwarding
[email protected]70dee7e2013-05-29 18:28:30272 // various status messages to the console, skips network error pages, and
273 // short circuits size update and focus events.
danakjbecba322019-03-29 17:13:46274 bool web_test_mode() const { return web_test_mode_; }
275 void enable_web_test_mode() { web_test_mode_ = true; }
[email protected]ac7f5a02013-03-16 16:14:41276
penghuang342762b2016-12-02 21:04:58277 discardable_memory::ClientDiscardableSharedMemoryManager*
278 GetDiscardableSharedMemoryManagerForTest() {
279 return discardable_shared_memory_manager_.get();
280 }
281
tfarina556a7232014-10-05 01:02:09282 RendererBlinkPlatformImpl* blink_platform_impl() const {
283 DCHECK(blink_platform_impl_);
284 return blink_platform_impl_.get();
[email protected]078780b2014-06-20 16:57:06285 }
286
Yuta Kitamura4e256bfc2018-09-27 06:32:35287 // Returns the task runner on the compositor thread.
288 //
danakj6e3bf8012014-12-16 18:27:53289 // Will be null if threaded compositing has not been enabled.
skyostil2d3b5bd2015-05-27 15:40:59290 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner() const {
291 return compositor_task_runner_;
[email protected]a9fb30aa2011-10-06 06:58:46292 }
293
John Abd-El-Malek6b56ef712017-10-21 22:52:46294 ResourceDispatcher* resource_dispatcher() const {
295 return resource_dispatcher_.get();
296 }
297
Yuzhu Shenfe5f3a52018-01-11 21:24:13298 URLLoaderThrottleProvider* url_loader_throttle_provider() const {
299 return url_loader_throttle_provider_.get();
300 }
301
[email protected]6ca6a082013-09-22 20:10:05302#if defined(OS_ANDROID)
siva.gunturi5d4feb052015-11-15 16:15:31303 scoped_refptr<StreamTextureFactory> GetStreamTexureFactory();
boliuf8753bf62016-02-11 20:09:42304 bool EnableStreamTextureCopy();
[email protected]6ca6a082013-09-22 20:10:05305#endif
306
fsamuel6c1dfeb2014-12-18 19:21:33307 BrowserPluginManager* browser_plugin_manager() const {
308 return browser_plugin_manager_.get();
309 }
310
[email protected]6ee10bd2012-09-13 09:01:53311 // Returns a factory used for creating RTC PeerConnection objects.
[email protected]0107d8a2014-05-16 10:20:34312 PeerConnectionDependencyFactory* GetPeerConnectionDependencyFactory();
[email protected]6ee10bd2012-09-13 09:01:53313
[email protected]af089972013-01-10 04:04:40314 PeerConnectionTracker* peer_connection_tracker() {
315 return peer_connection_tracker_.get();
316 }
317
Antonio Gomes925f9b92019-07-30 23:23:23318 blink::WebVideoCaptureImplManager* video_capture_impl_manager() const {
[email protected]80b161a2011-06-27 17:42:11319 return vc_manager_.get();
320 }
321
Robert Sesek6e3d725c2018-06-06 14:38:02322 LowMemoryModeController* low_memory_mode_controller() const {
323 return low_memory_mode_controller_.get();
324 }
325
rockote261d2112016-09-21 22:22:23326 mojom::RenderMessageFilter* render_message_filter();
rockot1587e332016-07-27 17:44:14327
[email protected]6217d392010-03-25 22:08:35328 // Get the GPU channel. Returns NULL if the channel is not established or
329 // has been lost.
penghuang346a46f92016-03-31 21:37:52330 gpu::GpuChannelHost* GetGpuChannel();
[email protected]6217d392010-03-25 22:08:35331
skyostil2d3b5bd2015-05-27 15:40:59332 // Returns a SingleThreadTaskRunner instance corresponding to the message loop
[email protected]c1330c82013-06-06 02:23:25333 // of the thread on which media operations should be run. Must be called
334 // on the renderer's main thread.
acolwellb4034942014-08-28 15:42:43335 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner();
[email protected]c1330c82013-06-06 02:23:25336
dcastagna4517a182015-08-05 19:51:03337 // A TaskRunner instance that runs tasks on the raster worker pool.
338 base::TaskRunner* GetWorkerTaskRunner();
dcastagnab880e8f2015-06-30 20:16:06339
CJ DiMeglio79f7c91a22018-08-30 22:24:43340 // Creates a ContextProvider if yet created, and returns it to be used for
341 // video frame compositing. The ContextProvider given as an argument is
342 // one that has been lost, and is a hint to the RenderThreadImpl to clear
343 // it's |video_frame_compositor_context_provider_| if it matches.
Sergey Ulanov83f4a152019-02-14 03:54:25344 scoped_refptr<viz::RasterContextProvider>
345 GetVideoFrameCompositorContextProvider(
346 scoped_refptr<viz::RasterContextProvider>);
CJ DiMeglio79f7c91a22018-08-30 22:24:43347
danakj0b4b94e32016-05-10 22:33:01348 // Returns a worker context provider that will be bound on the compositor
349 // thread.
Victor Miuraff6488612017-12-21 04:16:15350 scoped_refptr<viz::RasterContextProvider>
Jonathan Backer8e4f35d2018-10-15 20:56:42351 SharedCompositorWorkerContextProvider(bool try_gpu_rasterization);
revemand180dfc32015-09-24 00:19:43352
dcastagna7f45dada2015-10-19 20:17:35353 media::GpuVideoAcceleratorFactories* GetGpuFactories();
[email protected]3bb8bb32013-07-11 13:13:03354
Scott Violet703b8242019-06-11 19:34:36355 scoped_refptr<viz::ContextProviderCommandBuffer>
sadrul85cc5d82016-12-20 03:37:41356 SharedMainThreadContextProvider();
[email protected]c29b7ff2013-03-06 03:51:04357
[email protected]3958e972012-07-17 00:25:41358 // AudioRendererMixerManager instance which manages renderer side mixer
359 // instances shared based on configured audio parameters. Lazily created on
360 // first call.
[email protected]e9ff79c2012-10-19 21:31:26361 AudioRendererMixerManager* GetAudioRendererMixerManager();
[email protected]3958e972012-07-17 00:25:41362
[email protected]feb32372012-11-21 01:14:56363#if defined(OS_WIN)
[email protected]fcf75d42013-12-03 20:11:26364 void PreCacheFontCharacters(const LOGFONT& log_font,
365 const base::string16& str);
[email protected]feb32372012-11-21 01:14:56366#endif
367
Yuzu Saijo9acd7e62019-06-12 10:05:31368 class UnfreezableMessageFilter : public IPC::MessageFilter {
369 public:
370 explicit UnfreezableMessageFilter(RenderThreadImpl* render_thread_impl);
371 bool OnMessageReceived(const IPC::Message& message) override;
372
373 // Adds |unfreezable_task_runner| for the task to be executed later.
374 void AddListenerUnfreezableTaskRunner(
375 int32_t routing_id,
376 scoped_refptr<base::SingleThreadTaskRunner> unfreezable_task_runner);
377
378 // Called on the I/O thread.
379 // Returns the unfreezable task runner associated with |routing_id|.
380 scoped_refptr<base::SingleThreadTaskRunner> GetUnfreezableTaskRunner(
381 int32_t routing_id);
382
383 private:
384 ~UnfreezableMessageFilter() override;
385 RenderThreadImpl* render_thread_impl_;
386 base::Lock unfreezable_task_runners_lock_;
387 // Map of routing_id and listener's thread unfreezable task runner.
388 std::map<int32_t, scoped_refptr<base::SingleThreadTaskRunner>>
389 unfreezable_task_runners_ GUARDED_BY(unfreezable_task_runners_lock_);
390 };
391
[email protected]b2d98762012-09-03 17:04:06392 // For producing custom V8 histograms. Custom histograms are produced if all
393 // RenderViews share the same host, and the host is in the pre-specified set
394 // of hosts we want to produce custom diagrams for. The name for a custom
395 // diagram is the name of the corresponding generic diagram plus a
396 // host-specific suffix.
397 class CONTENT_EXPORT HistogramCustomizer {
398 public:
399 HistogramCustomizer();
400 ~HistogramCustomizer();
401
402 // Called when a top frame of a RenderView navigates. This function updates
403 // RenderThreadImpl's information about whether all RenderViews are
404 // displaying a page from the same host. |host| is the host where a
405 // RenderView navigated, and |view_count| is the number of RenderViews in
406 // this process.
407 void RenderViewNavigatedToHost(const std::string& host, size_t view_count);
408
409 // Used for customizing some histograms if all RenderViews share the same
410 // host. Returns the current custom histogram name to use for
411 // |histogram_name|, or |histogram_name| if it shouldn't be customized.
412 std::string ConvertToCustomHistogramName(const char* histogram_name) const;
413
414 private:
hablichd6a4f122015-10-28 11:34:49415 FRIEND_TEST_ALL_PREFIXES(RenderThreadImplUnittest,
416 IdentifyAlexaTop10NonGoogleSite);
[email protected]b2d98762012-09-03 17:04:06417 friend class RenderThreadImplUnittest;
Yuzu Saijo9acd7e62019-06-12 10:05:31418 friend class UnfreezableMessageFilter;
[email protected]b2d98762012-09-03 17:04:06419
hablichd6a4f122015-10-28 11:34:49420 // Converts a host name to a suffix for histograms
421 std::string HostToCustomHistogramSuffix(const std::string& host);
422
423 // Helper function to identify a certain set of top pages
424 bool IsAlexaTop10NonGoogleSite(const std::string& host);
425
[email protected]b2d98762012-09-03 17:04:06426 // Used for updating the information on which is the common host which all
427 // RenderView's share (if any). If there is no common host, this function is
428 // called with an empty string.
429 void SetCommonHost(const std::string& host);
430
431 // The current common host of the RenderViews; empty string if there is no
432 // common host.
433 std::string common_host_;
434 // The corresponding suffix.
435 std::string common_host_histogram_suffix_;
436 // Set of histograms for which we want to produce a custom histogram if
437 // possible.
438 std::set<std::string> custom_histograms_;
439
440 DISALLOW_COPY_AND_ASSIGN(HistogramCustomizer);
441 };
442
443 HistogramCustomizer* histogram_customizer() {
444 return &histogram_customizer_;
445 }
446
benf28ce882017-05-02 16:15:49447 void RegisterPendingFrameCreate(
448 const service_manager::BindSourceInfo& source_info,
449 int routing_id,
Balazs Engedyba034e72017-10-27 22:26:28450 mojom::FrameRequest frame);
rockotf8fdd9b2015-12-16 22:22:35451
jam188f19f2017-06-07 03:56:24452 mojom::RendererHost* GetRendererHost();
jamc912ca32016-02-24 20:17:31453
keishi51ed0d52017-01-12 10:04:46454 struct RendererMemoryMetrics {
455 size_t partition_alloc_kb;
456 size_t blink_gc_kb;
457 size_t malloc_mb;
458 size_t discardable_kb;
459 size_t v8_main_thread_isolate_mb;
460 size_t total_allocated_mb;
461 size_t non_discardable_total_allocated_mb;
462 size_t total_allocated_per_render_view_mb;
463 };
bashia0ba0d42017-04-03 08:11:06464 bool GetRendererMemoryMetrics(RendererMemoryMetrics* memory_metrics) const;
keishi51ed0d52017-01-12 10:04:46465
Takashi SAKAMOTO870f6262017-08-22 04:08:27466 bool NeedsToRecordFirstActivePaint(int metric_type) const;
tasakb95dbb50c2017-02-08 18:07:50467
Aditya Keerthie84331b32019-03-20 15:25:52468 void RecordMetricsForBackgroundedRendererPurge();
469
Miguel Casas5e1018052018-01-09 19:17:36470 // Sets the current pipeline rendering color space.
471 void SetRenderingColorSpace(const gfx::ColorSpace& color_space);
472
CJ DiMeglio79f7c91a22018-08-30 22:24:43473 scoped_refptr<base::SingleThreadTaskRunner>
474 CreateVideoFrameCompositorTaskRunner();
475
CJ DiMegliob6eb9cd2018-11-06 23:44:01476 // In the case of kOnDemand, we wont be using the task_runner created in
477 // CreateVideoFrameCompositorTaskRunner.
478 // TODO(https://crbug/901513): Remove once kOnDemand is removed.
479 void SetVideoFrameCompositorTaskRunner(
480 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
481 video_frame_compositor_task_runner_ = task_runner;
482 }
483
[email protected]8930d472009-02-21 08:05:28484 private:
Aditya Keerthic0d45b42019-02-25 18:53:00485 friend class RenderThreadImplBrowserTest;
486
Nicholas Verne06de8122017-11-16 04:47:38487 void OnProcessFinalRelease() override;
torne88b66452016-05-03 13:22:14488 // IPC::Listener
489 void OnChannelError() override;
490
[email protected]57cf97882013-06-26 20:39:01491 // ChildThread
dcheng6d18e402014-10-21 12:32:52492 bool OnControlMessageReceived(const IPC::Message& msg) override;
liberato3aeeb2c2016-02-25 17:54:38493 void RecordAction(const base::UserMetricsAction& action) override;
494 void RecordComputedAction(const std::string& action) override;
initial.commit09911bf2008-07-26 23:55:29495
sadrul53546592016-12-17 01:44:21496 bool IsMainThread();
[email protected]57cf97882013-06-26 20:39:01497
bashib9058f282017-03-30 01:55:24498 void RecordPurgeMemory(RendererMemoryMetrics before);
499
Greg Kraynovf5d60272018-08-10 12:28:51500 void Init();
vollick1050cc62015-12-03 07:04:54501 void InitializeCompositorThread();
Greg Kraynovf5d60272018-08-10 12:28:51502 void InitializeWebKit(service_manager::BinderRegistry* registry);
jam75c44222016-03-23 05:34:24503
initial.commit09911bf2008-07-26 23:55:29504 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
[email protected]b3df5a42010-05-11 14:31:09505 void OnGetAccessibilityTree();
blundellc00adf442016-09-16 10:43:41506
rockot067ca55f2016-09-30 22:00:15507 // mojom::Renderer:
rockot067ca55f2016-09-30 22:00:15508 void CreateView(mojom::CreateViewParamsPtr params) override;
Erik Chen3433ee02019-08-05 20:14:26509 void DestroyView(int32_t view_id) override;
rockot53be7caf2016-10-04 20:17:08510 void CreateFrame(mojom::CreateFrameParamsPtr params) override;
Dmitry Gozman89361212018-02-13 16:10:44511 void CreateFrameProxy(
512 int32_t routing_id,
513 int32_t render_view_routing_id,
514 int32_t opener_routing_id,
515 int32_t parent_routing_id,
516 const FrameReplicationState& replicated_state,
517 const base::UnguessableToken& devtools_frame_token) override;
rockota2db0da2016-10-18 17:39:11518 void OnNetworkConnectionChanged(
519 net::NetworkChangeNotifier::ConnectionType type,
520 double max_bandwidth_mbps) override;
tbansalb612c5d2017-05-25 18:53:06521 void OnNetworkQualityChanged(net::EffectiveConnectionType type,
522 base::TimeDelta http_rtt,
tbansal99d8aeb2017-05-22 19:12:58523 base::TimeDelta transport_rtt,
tbansal15973c32017-05-10 18:40:44524 double bandwidth_kbps) override;
rockota2db0da2016-10-18 17:39:11525 void SetWebKitSharedTimersSuspended(bool suspend) override;
Yutaka Hiranob0465f72018-05-17 05:48:25526 void SetUserAgent(const std::string& user_agent) override;
Mike West6e4cbb32019-02-13 09:40:17527 void SetUserAgentMetadata(const blink::UserAgentMetadata& metadata) override;
rockota2db0da2016-10-18 17:39:11528 void UpdateScrollbarTheme(
529 mojom::UpdateScrollbarThemeParamsPtr params) override;
530 void OnSystemColorsChanged(int32_t aqua_color_variant,
531 const std::string& highlight_text_color,
532 const std::string& highlight_color) override;
Ionel Popescu237e8e32019-08-07 19:50:54533 void UpdateSystemColorInfo(
534 mojom::UpdateSystemColorInfoParamsPtr params) override;
rockota2db0da2016-10-18 17:39:11535 void PurgePluginListCache(bool reload_pages) override;
Aditya Keerthic0d45b42019-02-25 18:53:00536 void SetProcessState(mojom::RenderProcessState process_state) override;
Shubhie Panicker45ce80a82018-02-01 01:40:19537 void SetSchedulerKeepActive(bool keep_active) override;
Nasko Oskov1c2c0492019-03-14 20:13:39538 void SetIsLockedToSite() override;
Robert Sesek6e3d725c2018-06-06 14:38:02539 void EnableV8LowMemoryMode() override;
rockot067ca55f2016-09-30 22:00:15540
[email protected]5071cb22013-07-10 02:19:06541 void OnMemoryPressure(
542 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
rockota2db0da2016-10-18 17:39:11543
rmcilroyaa296052015-04-14 15:35:27544 bool RendererIsHidden() const;
545 void OnRendererHidden();
546 void OnRendererVisible();
[email protected]b3df5a42010-05-11 14:31:09547
Aditya Keerthic0d45b42019-02-25 18:53:00548 bool RendererIsBackgrounded() const;
549 void OnRendererBackgrounded();
550 void OnRendererForegrounded();
551
tasak335a1872017-06-14 09:50:23552 void RecordMemoryUsageAfterBackgrounded(const char* suffix,
553 int foregrounded_count);
Aditya Keerthie84331b32019-03-20 15:25:52554 void OnRecordMetricsForBackgroundedRendererPurgeTimerExpired(
tasakbb0640b2017-05-15 09:02:26555 const char* suffix,
556 int foregrounded_count_when_purged);
tasakb46626a2016-10-18 05:54:44557
ssid0603ca9f2015-06-09 16:48:08558 void ReleaseFreeMemory();
559
hong.zhengb28b5332016-05-11 02:33:39560 void OnSyncMemoryPressure(
561 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
562
Fady Samuelc645ffe2017-07-24 17:28:20563 std::unique_ptr<viz::SyntheticBeginFrameSource>
samans09812d32017-03-27 19:51:50564 CreateSyntheticBeginFrameSource();
565
Julie Jeongeun Kim4e77af2622019-09-11 03:36:45566 void OnRendererInterfaceReceiver(
567 mojo::PendingAssociatedReceiver<mojom::Renderer> receiver);
rockot067ca55f2016-09-30 22:00:15568
penghuang342762b2016-12-02 21:04:58569 std::unique_ptr<discardable_memory::ClientDiscardableSharedMemoryManager>
570 discardable_shared_memory_manager_;
571
initial.commit09911bf2008-07-26 23:55:29572 // These objects live solely on the render thread.
Yuta Kitamuradeb91bb2018-05-29 05:53:20573 std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_;
dchengcedca5612016-04-09 01:40:15574 std::unique_ptr<RendererBlinkPlatformImpl> blink_platform_impl_;
John Abd-El-Malek6b56ef712017-10-21 22:52:46575 std::unique_ptr<ResourceDispatcher> resource_dispatcher_;
Yuzhu Shenfe5f3a52018-01-11 21:24:13576 std::unique_ptr<URLLoaderThrottleProvider> url_loader_throttle_provider_;
[email protected]9291ed12009-07-23 17:33:22577
dchengcedca5612016-04-09 01:40:15578 std::unique_ptr<BrowserPluginManager> browser_plugin_manager_;
fsamuel6c1dfeb2014-12-18 19:21:33579
dchengcedca5612016-04-09 01:40:15580 std::unique_ptr<PeerConnectionDependencyFactory> peer_connection_factory_;
[email protected]6ee10bd2012-09-13 09:01:53581
[email protected]af089972013-01-10 04:04:40582 // This is used to communicate to the browser process the status
583 // of all the peer connections created in the renderer.
dchengcedca5612016-04-09 01:40:15584 std::unique_ptr<PeerConnectionTracker> peer_connection_tracker_;
[email protected]af089972013-01-10 04:04:40585
Yuzu Saijo9acd7e62019-06-12 10:05:31586 // Filter out unfreezable messages and pass it to unfreezable task runners.
587 scoped_refptr<UnfreezableMessageFilter> unfreezable_message_filter_;
588
Max Morin3d464a42018-01-15 11:17:00589 // Provides AudioInputIPC objects for audio input devices. Initialized in
590 // Init.
591 base::Optional<AudioInputIPCFactory> audio_input_ipc_factory_;
Max Morin2c38c282018-04-17 07:01:42592 // Provides AudioOutputIPC objects for audio output devices. Initialized in
593 // Init.
Max Morin3d464a42018-01-15 11:17:00594 base::Optional<AudioOutputIPCFactory> audio_output_ipc_factory_;
maxmorin017ba8c62017-06-02 10:23:09595
liushouqun517b1292016-09-14 05:58:59596 // Used on the render thread.
Antonio Gomes925f9b92019-07-30 23:23:23597 std::unique_ptr<blink::WebVideoCaptureImplManager> vc_manager_;
[email protected]da9f30a2014-06-18 19:39:04598
Aditya Keerthic0d45b42019-02-25 18:53:00599 // Used to keep track of the renderer's backgrounded and visibility state.
600 // Updated via an IPC from the browser process. If nullopt, the browser
601 // process has yet to send an update and the state is unknown.
602 base::Optional<mojom::RenderProcessState> process_state_;
[email protected]bee16aab2009-08-26 15:55:03603
Yutaka Hiranob0465f72018-05-17 05:48:25604 blink::WebString user_agent_;
Mike West6e4cbb32019-02-13 09:40:17605 blink::UserAgentMetadata user_agent_metadata_;
Yutaka Hiranob0465f72018-05-17 05:48:25606
Kent Tamura2eab5b12018-12-07 04:31:23607 // Used to control web test specific behavior.
danakjbecba322019-03-29 17:13:46608 bool web_test_mode_ = false;
[email protected]233567d2013-02-27 20:22:02609
danakjab9ef4d2017-10-31 23:38:33610 // Sticky once true, indicates that compositing is done without Gpu, so
611 // resources given to the compositor or to the viz service should be
612 // software-based.
613 bool is_gpu_compositing_disabled_ = false;
614
dcastagna7f45dada2015-10-19 20:17:35615 // Utility class to provide GPU functionalities to media.
dcastagna09bd6b32016-02-01 21:54:28616 // TODO(dcastagna): This should be just one scoped_ptr once
617 // http://crbug.com/580386 is fixed.
618 // NOTE(dcastagna): At worst this accumulates a few bytes per context lost.
Miguel Casas-Sanchezcfcca5d52017-07-07 02:32:59619 std::vector<std::unique_ptr<GpuVideoAcceleratorFactoriesImpl>> gpu_factories_;
dcastagna7f45dada2015-10-19 20:17:35620
[email protected]c1330c82013-06-06 02:23:25621 // Thread for running multimedia operations (e.g., video decoding).
dchengcedca5612016-04-09 01:40:15622 std::unique_ptr<base::Thread> media_thread_;
[email protected]c1330c82013-06-06 02:23:25623
skyostil2d3b5bd2015-05-27 15:40:59624 // Will point to appropriate task runner after initialization,
[email protected]ea5f70a2013-03-07 12:30:36625 // regardless of whether |compositor_thread_| is overriden.
skyostil2d3b5bd2015-05-27 15:40:59626 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
[email protected]ea5f70a2013-03-07 12:30:36627
CJ DiMeglio79f7c91a22018-08-30 22:24:43628 // Task to run the VideoFrameCompositor on.
629 scoped_refptr<base::SingleThreadTaskRunner>
630 video_frame_compositor_task_runner_;
631
dcastagnab880e8f2015-06-30 20:16:06632 // Pool of workers used for raster operations (e.g., tile rasterization).
prashant.nfad657e2016-06-01 07:52:17633 scoped_refptr<CategorizedWorkerPool> categorized_worker_pool_;
reveman34b7a1522015-03-23 20:27:47634
boliubee541f42015-11-05 00:52:53635#if defined(OS_ANDROID)
siva.gunturi5d4feb052015-11-15 16:15:31636 scoped_refptr<StreamTextureFactory> stream_texture_factory_;
boliubee541f42015-11-05 00:52:53637#endif
638
Scott Violet703b8242019-06-11 19:34:36639 scoped_refptr<viz::ContextProviderCommandBuffer> shared_main_thread_contexts_;
[email protected]c29b7ff2013-03-06 03:51:04640
Trent Apteda250ec3ab2018-08-19 08:52:19641 base::ObserverList<RenderThreadObserver>::Unchecked observers_;
[email protected]1223d6ef2011-03-28 16:47:50642
Sergey Ulanov83f4a152019-02-14 03:54:25643 scoped_refptr<viz::RasterContextProvider>
644 video_frame_compositor_context_provider_;
CJ DiMeglio79f7c91a22018-08-30 22:24:43645
Victor Miuraff6488612017-12-21 04:16:15646 scoped_refptr<viz::RasterContextProvider> shared_worker_context_provider_;
[email protected]3b2afc32012-06-18 21:31:16647
dchengcedca5612016-04-09 01:40:15648 std::unique_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_;
[email protected]3958e972012-07-17 00:25:41649
[email protected]b2d98762012-09-03 17:04:06650 HistogramCustomizer histogram_customizer_;
651
dchengcedca5612016-04-09 01:40:15652 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
[email protected]5071cb22013-07-10 02:19:06653
Robert Sesek6e3d725c2018-06-06 14:38:02654 // Created in response to EnableV8LowMemoryMode(), this manages V8's
655 // memory saving mode.
656 std::unique_ptr<LowMemoryModeController> low_memory_mode_controller_;
657
Scott Violet703b8242019-06-11 19:34:36658 std::unique_ptr<viz::Gpu> gpu_;
sadrul9e0bb1d2016-08-04 20:18:39659
skyostil457b0a12014-09-09 10:12:07660 scoped_refptr<base::SingleThreadTaskRunner>
661 main_thread_compositor_task_runner_;
skyostil457b0a12014-09-09 10:12:07662
danakj6e3bf8012014-12-16 18:27:53663 // Compositor settings.
[email protected]a23530d2014-03-11 06:04:14664 bool is_gpu_rasterization_forced_;
senorblancob60ba952015-01-27 19:12:36665 int gpu_rasterization_msaa_sample_count_;
[email protected]a23530d2014-03-11 06:04:14666 bool is_lcd_text_enabled_;
[email protected]2cccfef2014-05-01 06:05:16667 bool is_zero_copy_enabled_;
ccameronc7fcd132015-11-03 20:14:31668 bool is_gpu_memory_buffer_compositor_resources_enabled_;
ericrk1d17f752015-10-20 03:03:07669 bool is_partial_raster_enabled_;
ccamerona7644752014-12-30 01:16:31670 bool is_elastic_overscroll_enabled_;
danakj4b347212018-07-04 17:55:17671 bool is_zoom_for_dsf_enabled_;
loyso65c93c602015-08-11 05:15:57672 bool is_threaded_animation_enabled_;
wjmaclean1d970622017-01-21 22:28:24673 bool is_scroll_animator_enabled_;
[email protected]a23530d2014-03-11 06:04:14674
Miguel Casas5e1018052018-01-09 19:17:36675 // Target rendering ColorSpace.
676 gfx::ColorSpace rendering_color_space_;
677
ben76f52b242016-06-18 05:42:48678 class PendingFrameCreate : public base::RefCounted<PendingFrameCreate> {
rockotf8fdd9b2015-12-16 22:22:35679 public:
Balazs Engedyba034e72017-10-27 22:26:28680 PendingFrameCreate(const service_manager::BindSourceInfo& source_info,
681 int routing_id,
682 mojom::FrameRequest frame_request);
rockotf8fdd9b2015-12-16 22:22:35683
benf28ce882017-05-02 16:15:49684 const service_manager::BindSourceInfo& browser_info() const {
685 return browser_info_;
686 }
ben76f52b242016-06-18 05:42:48687 mojom::FrameRequest TakeFrameRequest() { return std::move(frame_request_); }
rockotf8fdd9b2015-12-16 22:22:35688
689 private:
ben76f52b242016-06-18 05:42:48690 friend class base::RefCounted<PendingFrameCreate>;
rockotf8fdd9b2015-12-16 22:22:35691
ben76f52b242016-06-18 05:42:48692 ~PendingFrameCreate();
rockotf8fdd9b2015-12-16 22:22:35693
694 // Mojo error handler.
695 void OnConnectionError();
696
benf28ce882017-05-02 16:15:49697 service_manager::BindSourceInfo browser_info_;
rockotf8fdd9b2015-12-16 22:22:35698 int routing_id_;
ben76f52b242016-06-18 05:42:48699 mojom::FrameRequest frame_request_;
rockotf8fdd9b2015-12-16 22:22:35700 };
701
ben76f52b242016-06-18 05:42:48702 using PendingFrameCreateMap =
703 std::map<int, scoped_refptr<PendingFrameCreate>>;
704 PendingFrameCreateMap pending_frame_creates_;
rockotf8fdd9b2015-12-16 22:22:35705
Joel Hockey3146d142017-11-15 22:27:40706 mojom::RendererHostAssociatedPtr renderer_host_;
jamc912ca32016-02-24 20:17:31707
Ken Rockot26e4e802018-07-31 15:03:33708 blink::AssociatedInterfaceRegistry associated_interfaces_;
rockot067ca55f2016-09-30 22:00:15709
Julie Jeongeun Kim4e77af2622019-09-11 03:36:45710 mojo::AssociatedReceiver<mojom::Renderer> renderer_receiver_{this};
rockot067ca55f2016-09-30 22:00:15711
rockote261d2112016-09-21 22:22:23712 mojom::RenderMessageFilterAssociatedPtr render_message_filter_;
rockot1587e332016-07-27 17:44:14713
tasak72f64042017-01-19 14:02:53714 RendererMemoryMetrics purge_and_suspend_memory_metrics_;
tasakb95dbb50c2017-02-08 18:07:50715 bool needs_to_record_first_active_paint_;
Takashi SAKAMOTO870f6262017-08-22 04:08:27716 base::TimeTicks was_backgrounded_time_;
tasakbb0640b2017-05-15 09:02:26717 int process_foregrounded_count_;
Nasko Oskov3d0d1dc2018-09-25 03:57:13718 bool online_status_ = true;
hajimehoshi69093272016-05-13 08:30:58719
staraz067f58242016-11-07 21:06:41720 int32_t client_id_;
721
Mario Sanchez Prada5492c9a2019-09-10 20:58:11722 mojo::Remote<mojom::FrameSinkProvider> frame_sink_provider_;
samans2040988b2017-04-11 23:58:35723
danakjab9ef4d2017-10-31 23:38:33724 // A mojo connection to the CompositingModeReporter service.
725 viz::mojom::CompositingModeReporterPtr compositing_mode_reporter_;
726 // The class is a CompositingModeWatcher, which is bound to mojo through
danakj4ee301c2017-11-29 16:19:43727 // this member.
danakjab9ef4d2017-10-31 23:38:33728 mojo::Binding<viz::mojom::CompositingModeWatcher>
729 compositing_mode_watcher_binding_;
730
Jeremy Roman3bca4bf2019-07-11 03:41:25731 base::WeakPtrFactory<RenderThreadImpl> weak_factory_{this};
Ben Goodgerf180ce12018-02-09 22:54:01732
[email protected]f1a29a02011-10-06 23:08:44733 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
initial.commit09911bf2008-07-26 23:55:29734};
735
jam8a021512a2015-02-03 18:16:08736#if defined(COMPILER_MSVC)
737#pragma warning(pop)
738#endif
739
[email protected]e9ff79c2012-10-19 21:31:26740} // namespace content
741
[email protected]f1a29a02011-10-06 23:08:44742#endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_