[email protected] | d3d6325d | 2012-01-03 21:17:36 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | f1a29a0 | 2011-10-06 23:08:44 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 7 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
maxmorin | 017ba8c6 | 2017-06-02 10:23:09 | [diff] [blame] | 11 | #include <map> |
leon.han | 21e0e48 | 2017-02-23 04:13:32 | [diff] [blame] | 12 | #include <memory> |
[email protected] | 6779aa1 | 2011-03-29 17:32:24 | [diff] [blame] | 13 | #include <set> |
[email protected] | b68d5ed | 2009-04-16 02:41:28 | [diff] [blame] | 14 | #include <string> |
maxmorin | 017ba8c6 | 2017-06-02 10:23:09 | [diff] [blame] | 15 | #include <utility> |
[email protected] | 1bc8306 | 2009-02-06 00:16:37 | [diff] [blame] | 16 | #include <vector> |
| 17 | |
jdduke | 691dd57 | 2014-12-02 20:47:52 | [diff] [blame] | 18 | #include "base/cancelable_callback.h" |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 19 | #include "base/macros.h" |
[email protected] | 5071cb2 | 2013-07-10 02:19:06 | [diff] [blame] | 20 | #include "base/memory/memory_pressure_listener.h" |
rockot | 775ce0d | 2015-01-27 18:35:01 | [diff] [blame] | 21 | #include "base/memory/ref_counted.h" |
[email protected] | e6e30ac | 2014-01-13 21:24:39 | [diff] [blame] | 22 | #include "base/metrics/user_metrics_action.h" |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 23 | #include "base/observer_list.h" |
maxmorin | 017ba8c6 | 2017-06-02 10:23:09 | [diff] [blame] | 24 | #include "base/optional.h" |
[email protected] | 21aa9968 | 2013-06-11 07:17:01 | [diff] [blame] | 25 | #include "base/strings/string16.h" |
[email protected] | 8810516 | 2013-12-05 01:02:12 | [diff] [blame] | 26 | #include "base/threading/thread_checker.h" |
tbansal | 99d8aeb | 2017-05-22 19:12:58 | [diff] [blame] | 27 | #include "base/time/time.h" |
[email protected] | abb52216 | 2013-06-28 01:54:16 | [diff] [blame] | 28 | #include "base/timer/timer.h" |
[email protected] | 037fce0 | 2009-01-22 01:42:15 | [diff] [blame] | 29 | #include "build/build_config.h" |
jam | 8a021512a | 2015-02-03 18:16:08 | [diff] [blame] | 30 | #include "content/child/child_thread_impl.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 31 | #include "content/common/content_export.h" |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 32 | #include "content/common/frame.mojom.h" |
alexmos | bc7eafa | 2014-12-06 01:38:09 | [diff] [blame] | 33 | #include "content/common/frame_replication_state.h" |
samans | 2040988b | 2017-04-11 23:58:35 | [diff] [blame] | 34 | #include "content/common/frame_sink_provider.mojom.h" |
rockot | 1587e33 | 2016-07-27 17:44:14 | [diff] [blame] | 35 | #include "content/common/render_frame_message_filter.mojom.h" |
jonross | a2ff4f8 | 2018-02-16 17:27:46 | [diff] [blame] | 36 | #include "content/common/render_frame_metadata.mojom.h" |
rockot | e261d211 | 2016-09-21 22:22:23 | [diff] [blame] | 37 | #include "content/common/render_message_filter.mojom.h" |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 38 | #include "content/common/renderer.mojom.h" |
jam | 188f19f | 2017-06-07 03:56:24 | [diff] [blame] | 39 | #include "content/common/renderer_host.mojom.h" |
[email protected] | 52647690 | 2011-10-06 20:34:06 | [diff] [blame] | 40 | #include "content/public/renderer/render_thread.h" |
Yuzhu Shen | fe5f3a5 | 2018-01-11 21:24:13 | [diff] [blame] | 41 | #include "content/public/renderer/url_loader_throttle_provider.h" |
Sadrul Habib Chowdhury | 31c9871 | 2018-12-11 04:15:13 | [diff] [blame] | 42 | #include "content/renderer/compositor/compositor_dependencies.h" |
Amos Lim | bcc710e | 2018-06-08 05:51:17 | [diff] [blame] | 43 | #include "content/renderer/media/audio/audio_input_ipc_factory.h" |
| 44 | #include "content/renderer/media/audio/audio_output_ipc_factory.h" |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 45 | #include "content/renderer/web_test_dependencies.h" |
penghuang | 346a46f9 | 2016-03-31 21:37:52 | [diff] [blame] | 46 | #include "gpu/ipc/client/gpu_channel_host.h" |
Antoine Labour | e55c9ef8 | 2017-11-10 18:51:23 | [diff] [blame] | 47 | #include "ipc/ipc_sync_channel.h" |
Scott Violet | a35f9a4 | 2018-03-22 22:00:44 | [diff] [blame] | 48 | #include "media/media_buildflags.h" |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 49 | #include "mojo/public/cpp/bindings/associated_binding.h" |
blundell | c00adf44 | 2016-09-16 10:43:41 | [diff] [blame] | 50 | #include "mojo/public/cpp/bindings/binding.h" |
jcivelli | 315d17f | 2016-11-29 16:15:05 | [diff] [blame] | 51 | #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h" |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 52 | #include "net/base/network_change_notifier.h" |
tbansal | b612c5d | 2017-05-25 18:53:06 | [diff] [blame] | 53 | #include "net/nqe/effective_connection_type.h" |
Ken Rockot | 54311e6 | 2018-02-10 19:01:52 | [diff] [blame] | 54 | #include "services/network/public/mojom/url_loader_factory.mojom.h" |
Ben Goodger | 21ada1e | 2017-07-19 14:53:01 | [diff] [blame] | 55 | #include "services/service_manager/public/cpp/bind_source_info.h" |
Ken Rockot | 510c597 | 2017-12-05 16:37:04 | [diff] [blame] | 56 | #include "services/service_manager/public/cpp/binder_registry.h" |
danakj | ab9ef4d | 2017-10-31 23:38:33 | [diff] [blame] | 57 | #include "services/viz/public/interfaces/compositing/compositing_mode_watcher.mojom.h" |
Ken Rockot | 26e4e80 | 2018-07-31 15:03:33 | [diff] [blame] | 58 | #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" |
Mike West | 6e4cbb3 | 2019-02-13 09:40:17 | [diff] [blame] | 59 | #include "third_party/blink/public/common/user_agent/user_agent_metadata.h" |
Marijn Kruisselbrink | 4712c33 | 2018-06-13 19:06:59 | [diff] [blame] | 60 | #include "third_party/blink/public/mojom/dom_storage/storage_partition_service.mojom.h" |
Kent Tamura | 38fb434 | 2018-07-25 12:47:53 | [diff] [blame] | 61 | #include "third_party/blink/public/platform/scheduler/web_rail_mode_observer.h" |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 62 | #include "third_party/blink/public/platform/web_connection_type.h" |
| 63 | #include "third_party/blink/public/web/web_memory_statistics.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 64 | #include "ui/gfx/native_widget_types.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 65 | |
[email protected] | 291857a | 2014-01-23 17:49:11 | [diff] [blame] | 66 | #if defined(OS_MACOSX) |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 67 | #include "third_party/blink/public/platform/mac/web_scrollbar_theme.h" |
[email protected] | 291857a | 2014-01-23 17:49:11 | [diff] [blame] | 68 | #endif |
| 69 | |
[email protected] | 39008c0 | 2009-02-11 23:59:25 | [diff] [blame] | 70 | class SkBitmap; |
[email protected] | 46f36a49 | 2010-07-28 19:36:41 | [diff] [blame] | 71 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 72 | namespace blink { |
[email protected] | d8cd837 | 2012-03-09 10:49:51 | [diff] [blame] | 73 | class WebMediaStreamCenter; |
[email protected] | b7c7bcf | 2009-10-03 07:07:34 | [diff] [blame] | 74 | } |
| 75 | |
[email protected] | 64ffa044 | 2011-10-03 22:08:36 | [diff] [blame] | 76 | namespace base { |
skyostil | 457b0a1 | 2014-09-09 10:12:07 | [diff] [blame] | 77 | class SingleThreadTaskRunner; |
[email protected] | 64ffa044 | 2011-10-03 22:08:36 | [diff] [blame] | 78 | class Thread; |
| 79 | } |
| 80 | |
[email protected] | c29b7ff | 2013-03-06 03:51:04 | [diff] [blame] | 81 | namespace cc { |
jbriance | ed97502 | 2016-11-04 09:14:25 | [diff] [blame] | 82 | class BeginFrameSource; |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 83 | class LayerTreeFrameSink; |
samans | 09812d3 | 2017-03-27 19:51:50 | [diff] [blame] | 84 | class SyntheticBeginFrameSource; |
reveman | 34b7a152 | 2015-03-23 20:27:47 | [diff] [blame] | 85 | class TaskGraphRunner; |
[email protected] | c29b7ff | 2013-03-06 03:51:04 | [diff] [blame] | 86 | } |
| 87 | |
penghuang | 342762b | 2016-12-02 21:04:58 | [diff] [blame] | 88 | namespace discardable_memory { |
| 89 | class ClientDiscardableSharedMemoryManager; |
| 90 | } |
| 91 | |
penghuang | 346a46f9 | 2016-03-31 21:37:52 | [diff] [blame] | 92 | namespace gpu { |
| 93 | class GpuChannelHost; |
| 94 | } |
| 95 | |
[email protected] | 1842fe2 | 2012-08-13 23:24:35 | [diff] [blame] | 96 | namespace IPC { |
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 97 | class MessageFilter; |
[email protected] | 1842fe2 | 2012-08-13 23:24:35 | [diff] [blame] | 98 | } |
| 99 | |
[email protected] | 563d665f | 2013-02-01 04:42:39 | [diff] [blame] | 100 | namespace media { |
[email protected] | 2329bfc7 | 2014-02-28 02:03:21 | [diff] [blame] | 101 | class GpuVideoAcceleratorFactories; |
[email protected] | 563d665f | 2013-02-01 04:42:39 | [diff] [blame] | 102 | } |
| 103 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 104 | namespace v8 { |
| 105 | class Extension; |
| 106 | } |
| 107 | |
danakj | 9242985 | 2017-06-29 00:19:03 | [diff] [blame] | 108 | namespace viz { |
Fady Samuel | c645ffe | 2017-07-24 17:28:20 | [diff] [blame] | 109 | class BeginFrameSource; |
Victor Miura | ff648861 | 2017-12-21 04:16:15 | [diff] [blame] | 110 | class RasterContextProvider; |
Fady Samuel | c645ffe | 2017-07-24 17:28:20 | [diff] [blame] | 111 | class SyntheticBeginFrameSource; |
danakj | 9242985 | 2017-06-29 00:19:03 | [diff] [blame] | 112 | } |
| 113 | |
Scott Violet | 7e33efc | 2018-08-29 22:30:15 | [diff] [blame] | 114 | namespace ws { |
| 115 | class ContextProviderCommandBuffer; |
| 116 | class Gpu; |
| 117 | } // namespace ws |
| 118 | |
[email protected] | 64ffa044 | 2011-10-03 22:08:36 | [diff] [blame] | 119 | namespace content { |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 120 | |
[email protected] | da9f30a | 2014-06-18 19:39:04 | [diff] [blame] | 121 | class AecDumpMessageFilter; |
[email protected] | 3958e97 | 2012-07-17 00:25:41 | [diff] [blame] | 122 | class AudioRendererMixerManager; |
fsamuel | 6c1dfeb | 2014-12-18 19:21:33 | [diff] [blame] | 123 | class BrowserPluginManager; |
John Abd-El-Malek | e1d4de3 | 2017-10-21 16:14:29 | [diff] [blame] | 124 | class CategorizedWorkerPool; |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 125 | class DomStorageDispatcher; |
danakj | 83066a3 | 2016-06-21 02:34:49 | [diff] [blame] | 126 | class FrameSwapMessageQueue; |
John Abd-El-Malek | e1d4de3 | 2017-10-21 16:14:29 | [diff] [blame] | 127 | class GpuVideoAcceleratorFactoriesImpl; |
Robert Sesek | 6e3d725c | 2018-06-06 14:38:02 | [diff] [blame] | 128 | class LowMemoryModeController; |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 129 | class P2PSocketDispatcher; |
jsbell | abadb9b | 2015-03-23 21:03:44 | [diff] [blame] | 130 | class PeerConnectionDependencyFactory; |
[email protected] | af08997 | 2013-01-10 04:04:40 | [diff] [blame] | 131 | class PeerConnectionTracker; |
tyoshino | 832a58a | 2016-04-18 08:14:08 | [diff] [blame] | 132 | class RenderThreadObserver; |
tfarina | 556a723 | 2014-10-05 01:02:09 | [diff] [blame] | 133 | class RendererBlinkPlatformImpl; |
John Abd-El-Malek | 6b56ef71 | 2017-10-21 22:52:46 | [diff] [blame] | 134 | class ResourceDispatcher; |
[email protected] | 9a292e2 | 2012-10-22 15:19:31 | [diff] [blame] | 135 | class VideoCaptureImplManager; |
[email protected] | cb25aa1 | 2012-08-07 19:13:43 | [diff] [blame] | 136 | |
boliu | bee541f4 | 2015-11-05 00:52:53 | [diff] [blame] | 137 | #if defined(OS_ANDROID) |
siva.gunturi | 5d4feb05 | 2015-11-15 16:15:31 | [diff] [blame] | 138 | class StreamTextureFactory; |
boliu | bee541f4 | 2015-11-05 00:52:53 | [diff] [blame] | 139 | #endif |
| 140 | |
jam | 8a021512a | 2015-02-03 18:16:08 | [diff] [blame] | 141 | #if defined(COMPILER_MSVC) |
| 142 | // See explanation for other RenderViewHostImpl which is the same issue. |
| 143 | #pragma warning(push) |
| 144 | #pragma warning(disable: 4250) |
| 145 | #endif |
| 146 | |
[email protected] | f1a29a0 | 2011-10-06 23:08:44 | [diff] [blame] | 147 | // The RenderThreadImpl class represents a background thread where RenderView |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 148 | // instances live. The RenderThread supports an API that is used by its |
| 149 | // consumer to talk indirectly to the RenderViews and supporting objects. |
| 150 | // Likewise, it provides an API for the RenderViews to talk back to the main |
[email protected] | 770005b | 2012-04-16 15:58:13 | [diff] [blame] | 151 | // process (i.e., their corresponding WebContentsImpl). |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 152 | // |
| 153 | // Most of the communication occurs in the form of IPC messages. They are |
| 154 | // routed to the RenderThread according to the routing IDs of the messages. |
| 155 | // The routing IDs correspond to RenderView instances. |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 156 | class CONTENT_EXPORT RenderThreadImpl |
| 157 | : public RenderThread, |
jam | 8a021512a | 2015-02-03 18:16:08 | [diff] [blame] | 158 | public ChildThreadImpl, |
Nico Weber | 43ddd7a3 | 2017-08-15 19:19:27 | [diff] [blame] | 159 | public mojom::Renderer, |
danakj | ab9ef4d | 2017-10-31 23:38:33 | [diff] [blame] | 160 | public viz::mojom::CompositingModeWatcher, |
Nico Weber | 43ddd7a3 | 2017-08-15 19:19:27 | [diff] [blame] | 161 | public CompositorDependencies { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 162 | public: |
[email protected] | f1a29a0 | 2011-10-06 23:08:44 | [diff] [blame] | 163 | static RenderThreadImpl* current(); |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 164 | static mojom::RenderMessageFilter* current_render_message_filter(); |
olegmax | 045f7fb1 | 2017-05-19 07:58:55 | [diff] [blame] | 165 | static RendererBlinkPlatformImpl* current_blink_platform_impl(); |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 166 | |
| 167 | static void SetRenderMessageFilterForTesting( |
| 168 | mojom::RenderMessageFilter* render_message_filter); |
olegmax | 045f7fb1 | 2017-05-19 07:58:55 | [diff] [blame] | 169 | static void SetRendererBlinkPlatformImplForTesting( |
| 170 | RendererBlinkPlatformImpl* blink_platform_impl); |
[email protected] | 52647690 | 2011-10-06 20:34:06 | [diff] [blame] | 171 | |
John Abd-El-Malek | d488264 | 2017-12-04 21:45:19 | [diff] [blame] | 172 | // Returns the task runner for the main thread where the RenderThread lives. |
Hajime Hoshi | 20578c6 | 2018-01-12 09:43:26 | [diff] [blame] | 173 | static scoped_refptr<base::SingleThreadTaskRunner> |
| 174 | DeprecatedGetMainTaskRunner(); |
John Abd-El-Malek | d488264 | 2017-12-04 21:45:19 | [diff] [blame] | 175 | |
Wez | 6979109b | 2018-09-07 17:30:56 | [diff] [blame] | 176 | RenderThreadImpl( |
| 177 | base::RepeatingClosure quit_closure, |
Greg Kraynov | f5d6027 | 2018-08-10 12:28:51 | [diff] [blame] | 178 | std::unique_ptr<blink::scheduler::WebThreadScheduler> scheduler); |
| 179 | RenderThreadImpl( |
| 180 | const InProcessChildThreadParams& params, |
| 181 | std::unique_ptr<blink::scheduler::WebThreadScheduler> scheduler); |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 182 | ~RenderThreadImpl() override; |
| 183 | void Shutdown() override; |
haraken | bbfdd9f0 | 2017-01-12 07:14:04 | [diff] [blame] | 184 | bool ShouldBeDestroyed() override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 185 | |
[email protected] | 58436a1 | 2012-03-21 17:10:26 | [diff] [blame] | 186 | // When initializing WebKit, ensure that any schemes needed for the content |
| 187 | // module are registered properly. Static to allow sharing with tests. |
| 188 | static void RegisterSchemes(); |
| 189 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 190 | // RenderThread implementation: |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 191 | bool Send(IPC::Message* msg) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 192 | IPC::SyncChannel* GetChannel() override; |
| 193 | std::string GetLocale() override; |
| 194 | IPC::SyncMessageFilter* GetSyncMessageFilter() override; |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 195 | void AddRoute(int32_t routing_id, IPC::Listener* listener) override; |
| 196 | void RemoveRoute(int32_t routing_id) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 197 | int GenerateRoutingID() override; |
| 198 | void AddFilter(IPC::MessageFilter* filter) override; |
| 199 | void RemoveFilter(IPC::MessageFilter* filter) override; |
tyoshino | 832a58a | 2016-04-18 08:14:08 | [diff] [blame] | 200 | void AddObserver(RenderThreadObserver* observer) override; |
| 201 | void RemoveObserver(RenderThreadObserver* observer) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 202 | void SetResourceDispatcherDelegate( |
mohan.reddy | ee0b42a | 2014-10-08 04:53:14 | [diff] [blame] | 203 | ResourceDispatcherDelegate* delegate) override; |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 204 | std::unique_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( |
mohan.reddy | ee0b42a | 2014-10-08 04:53:14 | [diff] [blame] | 205 | size_t buffer_size) override; |
Clemens Hammacher | 38b6a76 | 2019-02-05 13:07:22 | [diff] [blame] | 206 | void RegisterExtension(std::unique_ptr<v8::Extension> extension) override; |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 207 | int PostTaskToAllWebWorkers(const base::Closure& closure) override; |
| 208 | bool ResolveProxy(const GURL& url, std::string* proxy_list) override; |
| 209 | base::WaitableEvent* GetShutdownEvent() override; |
staraz | 067f5824 | 2016-11-07 21:06:41 | [diff] [blame] | 210 | int32_t GetClientId() override; |
Nasko Oskov | 3d0d1dc | 2018-09-25 03:57:13 | [diff] [blame] | 211 | bool IsOnline() override; |
Karan Bhatia | c89897f | 2017-08-10 01:06:40 | [diff] [blame] | 212 | void SetRendererProcessType( |
Yuta Kitamura | 6359350 | 2018-11-12 09:27:13 | [diff] [blame] | 213 | blink::scheduler::WebRendererProcessType type) override; |
Lucas Furukawa Gadani | d51ff5d6 | 2018-12-07 21:26:49 | [diff] [blame] | 214 | blink::WebString GetUserAgent() override; |
Mike West | 6e4cbb3 | 2019-02-13 09:40:17 | [diff] [blame] | 215 | const blink::UserAgentMetadata& GetUserAgentMetadata() override; |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 216 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 217 | // IPC::Listener implementation via ChildThreadImpl: |
| 218 | void OnAssociatedInterfaceRequest( |
| 219 | const std::string& name, |
| 220 | mojo::ScopedInterfaceEndpointHandle handle) override; |
| 221 | |
weili | fabbf757 | 2017-05-22 19:05:16 | [diff] [blame] | 222 | // ChildThread implementation via ChildThreadImpl: |
| 223 | scoped_refptr<base::SingleThreadTaskRunner> GetIOTaskRunner() override; |
| 224 | |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 225 | // CompositorDependencies implementation. |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 226 | bool IsGpuRasterizationForced() override; |
senorblanco | b60ba95 | 2015-01-27 19:12:36 | [diff] [blame] | 227 | int GetGpuRasterizationMSAASampleCount() override; |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 228 | bool IsLcdTextEnabled() override; |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 229 | bool IsZeroCopyEnabled() override; |
ericrk | 1d17f75 | 2015-10-20 03:03:07 | [diff] [blame] | 230 | bool IsPartialRasterEnabled() override; |
ccameron | c7fcd13 | 2015-11-03 20:14:31 | [diff] [blame] | 231 | bool IsGpuMemoryBufferCompositorResourcesEnabled() override; |
ccameron | a764475 | 2014-12-30 01:16:31 | [diff] [blame] | 232 | bool IsElasticOverscrollEnabled() override; |
danakj | 4b34721 | 2018-07-04 17:55:17 | [diff] [blame] | 233 | bool IsUseZoomForDSFEnabled() override; |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 234 | scoped_refptr<base::SingleThreadTaskRunner> |
| 235 | GetCompositorMainThreadTaskRunner() override; |
| 236 | scoped_refptr<base::SingleThreadTaskRunner> |
| 237 | GetCompositorImplThreadTaskRunner() override; |
Yuta Kitamura | deb91bb | 2018-05-29 05:53:20 | [diff] [blame] | 238 | blink::scheduler::WebThreadScheduler* GetWebMainThreadScheduler() override; |
reveman | 34b7a152 | 2015-03-23 20:27:47 | [diff] [blame] | 239 | cc::TaskGraphRunner* GetTaskGraphRunner() override; |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 240 | bool IsScrollAnimatorEnabled() override; |
Khushal | 3e96e66 | 2017-10-30 23:16:50 | [diff] [blame] | 241 | std::unique_ptr<cc::UkmRecorderFactory> CreateUkmRecorderFactory() override; |
danakj | 4b34721 | 2018-07-04 17:55:17 | [diff] [blame] | 242 | #ifdef OS_ANDROID |
| 243 | bool UsingSynchronousCompositing() override; |
| 244 | #endif |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 245 | |
danakj | e6da4f1 | 2018-07-04 17:41:30 | [diff] [blame] | 246 | bool IsThreadedAnimationEnabled(); |
| 247 | |
danakj | ab9ef4d | 2017-10-31 23:38:33 | [diff] [blame] | 248 | // viz::mojom::CompositingModeWatcher implementation. |
| 249 | void CompositingModeFallbackToSoftware() override; |
| 250 | |
| 251 | // Whether gpu compositing is being used or is disabled for software |
| 252 | // compositing. Clients of the compositor should give resources that match |
| 253 | // the appropriate mode. |
| 254 | bool IsGpuCompositingDisabled() { return is_gpu_compositing_disabled_; } |
| 255 | |
[email protected] | b3e83de | 2012-02-07 03:33:28 | [diff] [blame] | 256 | // Synchronously establish a channel to the GPU plugin if not previously |
| 257 | // established or if it has been lost (for example if the GPU plugin crashed). |
| 258 | // If there is a pending asynchronous request, it will be completed by the |
Bo Liu | d1ef1c3 | 2017-12-08 06:15:50 | [diff] [blame] | 259 | // time this routine returns. |
| 260 | scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync(); |
[email protected] | b3e83de | 2012-02-07 03:33:28 | [diff] [blame] | 261 | |
piman | c44437a2 | 2016-10-29 00:09:22 | [diff] [blame] | 262 | gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager(); |
| 263 | |
Scott Violet | b04f16c | 2018-11-27 00:48:46 | [diff] [blame] | 264 | using LayerTreeFrameSinkCallback = |
| 265 | base::OnceCallback<void(std::unique_ptr<cc::LayerTreeFrameSink>)>; |
| 266 | void RequestNewLayerTreeFrameSink( |
danakj | f8746079 | 2018-12-04 20:14:22 | [diff] [blame] | 267 | int widget_routing_id, |
danakj | 83066a3 | 2016-06-21 02:34:49 | [diff] [blame] | 268 | scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue, |
fsamuel | cf3002e | 2017-03-20 23:13:47 | [diff] [blame] | 269 | const GURL& url, |
Scott Violet | b04f16c | 2018-11-27 00:48:46 | [diff] [blame] | 270 | LayerTreeFrameSinkCallback callback, |
jonross | a2ff4f8 | 2018-02-16 17:27:46 | [diff] [blame] | 271 | mojom::RenderFrameMetadataObserverClientRequest |
| 272 | render_frame_metadata_observer_client_request, |
yiyix | 6b90ef5 | 2018-10-09 19:55:30 | [diff] [blame] | 273 | mojom::RenderFrameMetadataObserverPtr render_frame_metadata_observer_ptr, |
| 274 | const char* client_name); |
danakj | 83066a3 | 2016-06-21 02:34:49 | [diff] [blame] | 275 | |
Sam McNally | 52e5028 | 2017-11-29 00:54:02 | [diff] [blame] | 276 | blink::AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry(); |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 277 | |
Kent Tamura | 21d1de6 | 2018-12-10 04:45:20 | [diff] [blame] | 278 | std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForWebTest( |
danakj | f8746079 | 2018-12-04 20:14:22 | [diff] [blame] | 279 | int32_t widget_routing_id, |
Fady Samuel | dfecb7d | 2017-07-26 11:41:04 | [diff] [blame] | 280 | std::unique_ptr<viz::CopyOutputRequest> request); |
jbroman | 6ccbc7d47 | 2016-07-27 04:45:41 | [diff] [blame] | 281 | |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 282 | // True if we are running web tests. This currently disables forwarding |
[email protected] | 70dee7e | 2013-05-29 18:28:30 | [diff] [blame] | 283 | // various status messages to the console, skips network error pages, and |
| 284 | // short circuits size update and focus events. |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 285 | bool web_test_mode() const { return !!web_test_deps_; } |
| 286 | void set_web_test_dependencies(std::unique_ptr<WebTestDependencies> deps) { |
| 287 | web_test_deps_ = std::move(deps); |
[email protected] | ac7f5a0 | 2013-03-16 16:14:41 | [diff] [blame] | 288 | } |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 289 | // Returns whether we are running web tests with display compositor for |
Mounir Lamouri | 9c99a160 | 2018-07-05 15:01:44 | [diff] [blame] | 290 | // pixel dump enabled. It is meant to disable feature that require display |
| 291 | // compositor while it is not enabled by default. |
Kent Tamura | 21d1de6 | 2018-12-10 04:45:20 | [diff] [blame] | 292 | // This should only be called if currently running in web tests. |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 293 | bool WebTestModeUsesDisplayCompositorPixelDump() const { |
| 294 | DCHECK(web_test_deps_); |
| 295 | return web_test_deps_->UseDisplayCompositorPixelDump(); |
Mounir Lamouri | 9c99a160 | 2018-07-05 15:01:44 | [diff] [blame] | 296 | } |
[email protected] | ac7f5a0 | 2013-03-16 16:14:41 | [diff] [blame] | 297 | |
penghuang | 342762b | 2016-12-02 21:04:58 | [diff] [blame] | 298 | discardable_memory::ClientDiscardableSharedMemoryManager* |
| 299 | GetDiscardableSharedMemoryManagerForTest() { |
| 300 | return discardable_shared_memory_manager_.get(); |
| 301 | } |
| 302 | |
tfarina | 556a723 | 2014-10-05 01:02:09 | [diff] [blame] | 303 | RendererBlinkPlatformImpl* blink_platform_impl() const { |
| 304 | DCHECK(blink_platform_impl_); |
| 305 | return blink_platform_impl_.get(); |
[email protected] | 078780b | 2014-06-20 16:57:06 | [diff] [blame] | 306 | } |
| 307 | |
Yuta Kitamura | 4e256bfc | 2018-09-27 06:32:35 | [diff] [blame] | 308 | // Returns the task runner on the compositor thread. |
| 309 | // |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 310 | // Will be null if threaded compositing has not been enabled. |
skyostil | 2d3b5bd | 2015-05-27 15:40:59 | [diff] [blame] | 311 | scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner() const { |
| 312 | return compositor_task_runner_; |
[email protected] | a9fb30aa | 2011-10-06 06:58:46 | [diff] [blame] | 313 | } |
| 314 | |
[email protected] | 19b4951 | 2012-05-30 19:22:09 | [diff] [blame] | 315 | DomStorageDispatcher* dom_storage_dispatcher() const { |
| 316 | return dom_storage_dispatcher_.get(); |
| 317 | } |
| 318 | |
John Abd-El-Malek | 6b56ef71 | 2017-10-21 22:52:46 | [diff] [blame] | 319 | ResourceDispatcher* resource_dispatcher() const { |
| 320 | return resource_dispatcher_.get(); |
| 321 | } |
| 322 | |
Yuzhu Shen | fe5f3a5 | 2018-01-11 21:24:13 | [diff] [blame] | 323 | URLLoaderThrottleProvider* url_loader_throttle_provider() const { |
| 324 | return url_loader_throttle_provider_.get(); |
| 325 | } |
| 326 | |
[email protected] | 6ca6a08 | 2013-09-22 20:10:05 | [diff] [blame] | 327 | #if defined(OS_ANDROID) |
siva.gunturi | 5d4feb05 | 2015-11-15 16:15:31 | [diff] [blame] | 328 | scoped_refptr<StreamTextureFactory> GetStreamTexureFactory(); |
boliu | f8753bf6 | 2016-02-11 20:09:42 | [diff] [blame] | 329 | bool EnableStreamTextureCopy(); |
[email protected] | 6ca6a08 | 2013-09-22 20:10:05 | [diff] [blame] | 330 | #endif |
| 331 | |
[email protected] | d8cd837 | 2012-03-09 10:49:51 | [diff] [blame] | 332 | // Creates the embedder implementation of WebMediaStreamCenter. |
| 333 | // The resulting object is owned by WebKit and deleted by WebKit at tear-down. |
Guido Urdaneta | 75294fa | 2018-06-14 14:20:29 | [diff] [blame] | 334 | std::unique_ptr<blink::WebMediaStreamCenter> CreateMediaStreamCenter(); |
[email protected] | d8cd837 | 2012-03-09 10:49:51 | [diff] [blame] | 335 | |
fsamuel | 6c1dfeb | 2014-12-18 19:21:33 | [diff] [blame] | 336 | BrowserPluginManager* browser_plugin_manager() const { |
| 337 | return browser_plugin_manager_.get(); |
| 338 | } |
| 339 | |
[email protected] | 6ee10bd | 2012-09-13 09:01:53 | [diff] [blame] | 340 | // Returns a factory used for creating RTC PeerConnection objects. |
[email protected] | 0107d8a | 2014-05-16 10:20:34 | [diff] [blame] | 341 | PeerConnectionDependencyFactory* GetPeerConnectionDependencyFactory(); |
[email protected] | 6ee10bd | 2012-09-13 09:01:53 | [diff] [blame] | 342 | |
[email protected] | af08997 | 2013-01-10 04:04:40 | [diff] [blame] | 343 | PeerConnectionTracker* peer_connection_tracker() { |
| 344 | return peer_connection_tracker_.get(); |
| 345 | } |
| 346 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 347 | // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled. |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 348 | P2PSocketDispatcher* p2p_socket_dispatcher() { |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 349 | return p2p_socket_dispatcher_.get(); |
| 350 | } |
| 351 | |
[email protected] | 80b161a | 2011-06-27 17:42:11 | [diff] [blame] | 352 | VideoCaptureImplManager* video_capture_impl_manager() const { |
| 353 | return vc_manager_.get(); |
| 354 | } |
| 355 | |
Robert Sesek | 6e3d725c | 2018-06-06 14:38:02 | [diff] [blame] | 356 | LowMemoryModeController* low_memory_mode_controller() const { |
| 357 | return low_memory_mode_controller_.get(); |
| 358 | } |
| 359 | |
rockot | 1587e33 | 2016-07-27 17:44:14 | [diff] [blame] | 360 | mojom::RenderFrameMessageFilter* render_frame_message_filter(); |
rockot | e261d211 | 2016-09-21 22:22:23 | [diff] [blame] | 361 | mojom::RenderMessageFilter* render_message_filter(); |
rockot | 1587e33 | 2016-07-27 17:44:14 | [diff] [blame] | 362 | |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 363 | // Get the GPU channel. Returns NULL if the channel is not established or |
| 364 | // has been lost. |
penghuang | 346a46f9 | 2016-03-31 21:37:52 | [diff] [blame] | 365 | gpu::GpuChannelHost* GetGpuChannel(); |
[email protected] | 6217d39 | 2010-03-25 22:08:35 | [diff] [blame] | 366 | |
skyostil | 2d3b5bd | 2015-05-27 15:40:59 | [diff] [blame] | 367 | // Returns a SingleThreadTaskRunner instance corresponding to the message loop |
[email protected] | c1330c8 | 2013-06-06 02:23:25 | [diff] [blame] | 368 | // of the thread on which media operations should be run. Must be called |
| 369 | // on the renderer's main thread. |
acolwell | b403494 | 2014-08-28 15:42:43 | [diff] [blame] | 370 | scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner(); |
[email protected] | c1330c8 | 2013-06-06 02:23:25 | [diff] [blame] | 371 | |
dcastagna | 4517a18 | 2015-08-05 19:51:03 | [diff] [blame] | 372 | // A TaskRunner instance that runs tasks on the raster worker pool. |
| 373 | base::TaskRunner* GetWorkerTaskRunner(); |
dcastagna | b880e8f | 2015-06-30 20:16:06 | [diff] [blame] | 374 | |
CJ DiMeglio | 79f7c91a2 | 2018-08-30 22:24:43 | [diff] [blame] | 375 | // Creates a ContextProvider if yet created, and returns it to be used for |
| 376 | // video frame compositing. The ContextProvider given as an argument is |
| 377 | // one that has been lost, and is a hint to the RenderThreadImpl to clear |
| 378 | // it's |video_frame_compositor_context_provider_| if it matches. |
Sergey Ulanov | 83f4a15 | 2019-02-14 03:54:25 | [diff] [blame] | 379 | scoped_refptr<viz::RasterContextProvider> |
| 380 | GetVideoFrameCompositorContextProvider( |
| 381 | scoped_refptr<viz::RasterContextProvider>); |
CJ DiMeglio | 79f7c91a2 | 2018-08-30 22:24:43 | [diff] [blame] | 382 | |
danakj | 0b4b94e3 | 2016-05-10 22:33:01 | [diff] [blame] | 383 | // Returns a worker context provider that will be bound on the compositor |
| 384 | // thread. |
Victor Miura | ff648861 | 2017-12-21 04:16:15 | [diff] [blame] | 385 | scoped_refptr<viz::RasterContextProvider> |
Jonathan Backer | 8e4f35d | 2018-10-15 20:56:42 | [diff] [blame] | 386 | SharedCompositorWorkerContextProvider(bool try_gpu_rasterization); |
reveman | d180dfc3 | 2015-09-24 00:19:43 | [diff] [blame] | 387 | |
dcastagna | 7f45dada | 2015-10-19 20:17:35 | [diff] [blame] | 388 | media::GpuVideoAcceleratorFactories* GetGpuFactories(); |
[email protected] | 3bb8bb3 | 2013-07-11 13:13:03 | [diff] [blame] | 389 | |
Scott Violet | 7e33efc | 2018-08-29 22:30:15 | [diff] [blame] | 390 | scoped_refptr<ws::ContextProviderCommandBuffer> |
sadrul | 85cc5d8 | 2016-12-20 03:37:41 | [diff] [blame] | 391 | SharedMainThreadContextProvider(); |
[email protected] | c29b7ff | 2013-03-06 03:51:04 | [diff] [blame] | 392 | |
[email protected] | 3958e97 | 2012-07-17 00:25:41 | [diff] [blame] | 393 | // AudioRendererMixerManager instance which manages renderer side mixer |
| 394 | // instances shared based on configured audio parameters. Lazily created on |
| 395 | // first call. |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 396 | AudioRendererMixerManager* GetAudioRendererMixerManager(); |
[email protected] | 3958e97 | 2012-07-17 00:25:41 | [diff] [blame] | 397 | |
[email protected] | feb3237 | 2012-11-21 01:14:56 | [diff] [blame] | 398 | #if defined(OS_WIN) |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 399 | void PreCacheFontCharacters(const LOGFONT& log_font, |
| 400 | const base::string16& str); |
[email protected] | feb3237 | 2012-11-21 01:14:56 | [diff] [blame] | 401 | #endif |
| 402 | |
[email protected] | b2d9876 | 2012-09-03 17:04:06 | [diff] [blame] | 403 | // For producing custom V8 histograms. Custom histograms are produced if all |
| 404 | // RenderViews share the same host, and the host is in the pre-specified set |
| 405 | // of hosts we want to produce custom diagrams for. The name for a custom |
| 406 | // diagram is the name of the corresponding generic diagram plus a |
| 407 | // host-specific suffix. |
| 408 | class CONTENT_EXPORT HistogramCustomizer { |
| 409 | public: |
| 410 | HistogramCustomizer(); |
| 411 | ~HistogramCustomizer(); |
| 412 | |
| 413 | // Called when a top frame of a RenderView navigates. This function updates |
| 414 | // RenderThreadImpl's information about whether all RenderViews are |
| 415 | // displaying a page from the same host. |host| is the host where a |
| 416 | // RenderView navigated, and |view_count| is the number of RenderViews in |
| 417 | // this process. |
| 418 | void RenderViewNavigatedToHost(const std::string& host, size_t view_count); |
| 419 | |
| 420 | // Used for customizing some histograms if all RenderViews share the same |
| 421 | // host. Returns the current custom histogram name to use for |
| 422 | // |histogram_name|, or |histogram_name| if it shouldn't be customized. |
| 423 | std::string ConvertToCustomHistogramName(const char* histogram_name) const; |
| 424 | |
| 425 | private: |
hablich | d6a4f12 | 2015-10-28 11:34:49 | [diff] [blame] | 426 | FRIEND_TEST_ALL_PREFIXES(RenderThreadImplUnittest, |
| 427 | IdentifyAlexaTop10NonGoogleSite); |
[email protected] | b2d9876 | 2012-09-03 17:04:06 | [diff] [blame] | 428 | friend class RenderThreadImplUnittest; |
| 429 | |
hablich | d6a4f12 | 2015-10-28 11:34:49 | [diff] [blame] | 430 | // Converts a host name to a suffix for histograms |
| 431 | std::string HostToCustomHistogramSuffix(const std::string& host); |
| 432 | |
| 433 | // Helper function to identify a certain set of top pages |
| 434 | bool IsAlexaTop10NonGoogleSite(const std::string& host); |
| 435 | |
[email protected] | b2d9876 | 2012-09-03 17:04:06 | [diff] [blame] | 436 | // Used for updating the information on which is the common host which all |
| 437 | // RenderView's share (if any). If there is no common host, this function is |
| 438 | // called with an empty string. |
| 439 | void SetCommonHost(const std::string& host); |
| 440 | |
| 441 | // The current common host of the RenderViews; empty string if there is no |
| 442 | // common host. |
| 443 | std::string common_host_; |
| 444 | // The corresponding suffix. |
| 445 | std::string common_host_histogram_suffix_; |
| 446 | // Set of histograms for which we want to produce a custom histogram if |
| 447 | // possible. |
| 448 | std::set<std::string> custom_histograms_; |
| 449 | |
| 450 | DISALLOW_COPY_AND_ASSIGN(HistogramCustomizer); |
| 451 | }; |
| 452 | |
| 453 | HistogramCustomizer* histogram_customizer() { |
| 454 | return &histogram_customizer_; |
| 455 | } |
| 456 | |
ben | f28ce88 | 2017-05-02 16:15:49 | [diff] [blame] | 457 | void RegisterPendingFrameCreate( |
| 458 | const service_manager::BindSourceInfo& source_info, |
| 459 | int routing_id, |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 460 | mojom::FrameRequest frame); |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 461 | |
Marijn Kruisselbrink | 4712c33 | 2018-06-13 19:06:59 | [diff] [blame] | 462 | blink::mojom::StoragePartitionService* GetStoragePartitionService(); |
jam | 188f19f | 2017-06-07 03:56:24 | [diff] [blame] | 463 | mojom::RendererHost* GetRendererHost(); |
jam | c912ca3 | 2016-02-24 20:17:31 | [diff] [blame] | 464 | |
keishi | 51ed0d5 | 2017-01-12 10:04:46 | [diff] [blame] | 465 | struct RendererMemoryMetrics { |
| 466 | size_t partition_alloc_kb; |
| 467 | size_t blink_gc_kb; |
| 468 | size_t malloc_mb; |
| 469 | size_t discardable_kb; |
| 470 | size_t v8_main_thread_isolate_mb; |
| 471 | size_t total_allocated_mb; |
| 472 | size_t non_discardable_total_allocated_mb; |
| 473 | size_t total_allocated_per_render_view_mb; |
| 474 | }; |
bashi | a0ba0d4 | 2017-04-03 08:11:06 | [diff] [blame] | 475 | bool GetRendererMemoryMetrics(RendererMemoryMetrics* memory_metrics) const; |
keishi | 51ed0d5 | 2017-01-12 10:04:46 | [diff] [blame] | 476 | |
Takashi SAKAMOTO | 870f626 | 2017-08-22 04:08:27 | [diff] [blame] | 477 | bool NeedsToRecordFirstActivePaint(int metric_type) const; |
tasak | b95dbb50c | 2017-02-08 18:07:50 | [diff] [blame] | 478 | |
Aditya Keerthi | e84331b3 | 2019-03-20 15:25:52 | [diff] [blame] | 479 | void RecordMetricsForBackgroundedRendererPurge(); |
| 480 | |
Miguel Casas | 5e101805 | 2018-01-09 19:17:36 | [diff] [blame] | 481 | // Sets the current pipeline rendering color space. |
| 482 | void SetRenderingColorSpace(const gfx::ColorSpace& color_space); |
| 483 | |
CJ DiMeglio | 79f7c91a2 | 2018-08-30 22:24:43 | [diff] [blame] | 484 | scoped_refptr<base::SingleThreadTaskRunner> |
| 485 | CreateVideoFrameCompositorTaskRunner(); |
| 486 | |
CJ DiMeglio | b6eb9cd | 2018-11-06 23:44:01 | [diff] [blame] | 487 | // In the case of kOnDemand, we wont be using the task_runner created in |
| 488 | // CreateVideoFrameCompositorTaskRunner. |
| 489 | // TODO(https://crbug/901513): Remove once kOnDemand is removed. |
| 490 | void SetVideoFrameCompositorTaskRunner( |
| 491 | scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 492 | video_frame_compositor_task_runner_ = task_runner; |
| 493 | } |
| 494 | |
[email protected] | 8930d47 | 2009-02-21 08:05:28 | [diff] [blame] | 495 | private: |
Aditya Keerthi | c0d45b4 | 2019-02-25 18:53:00 | [diff] [blame] | 496 | friend class RenderThreadImplBrowserTest; |
| 497 | |
Nicholas Verne | 06de812 | 2017-11-16 04:47:38 | [diff] [blame] | 498 | void OnProcessFinalRelease() override; |
torne | 88b6645 | 2016-05-03 13:22:14 | [diff] [blame] | 499 | // IPC::Listener |
| 500 | void OnChannelError() override; |
| 501 | |
[email protected] | 57cf9788 | 2013-06-26 20:39:01 | [diff] [blame] | 502 | // ChildThread |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 503 | bool OnControlMessageReceived(const IPC::Message& msg) override; |
liberato | 3aeeb2c | 2016-02-25 17:54:38 | [diff] [blame] | 504 | void RecordAction(const base::UserMetricsAction& action) override; |
| 505 | void RecordComputedAction(const std::string& action) override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 506 | |
sadrul | 5354659 | 2016-12-17 01:44:21 | [diff] [blame] | 507 | bool IsMainThread(); |
[email protected] | 57cf9788 | 2013-06-26 20:39:01 | [diff] [blame] | 508 | |
bashi | b9058f28 | 2017-03-30 01:55:24 | [diff] [blame] | 509 | void RecordPurgeMemory(RendererMemoryMetrics before); |
| 510 | |
Greg Kraynov | f5d6027 | 2018-08-10 12:28:51 | [diff] [blame] | 511 | void Init(); |
vollick | 1050cc6 | 2015-12-03 07:04:54 | [diff] [blame] | 512 | void InitializeCompositorThread(); |
Greg Kraynov | f5d6027 | 2018-08-10 12:28:51 | [diff] [blame] | 513 | void InitializeWebKit(service_manager::BinderRegistry* registry); |
jam | 75c4422 | 2016-03-23 05:34:24 | [diff] [blame] | 514 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 515 | void OnTransferBitmap(const SkBitmap& bitmap, int resource_id); |
[email protected] | b3df5a4 | 2010-05-11 14:31:09 | [diff] [blame] | 516 | void OnGetAccessibilityTree(); |
blundell | c00adf44 | 2016-09-16 10:43:41 | [diff] [blame] | 517 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 518 | // mojom::Renderer: |
Ben Goodger | 1633130 | 2018-01-23 00:43:21 | [diff] [blame] | 519 | void CreateEmbedderRendererService( |
| 520 | service_manager::mojom::ServiceRequest service_request) override; |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 521 | void CreateView(mojom::CreateViewParamsPtr params) override; |
rockot | 53be7caf | 2016-10-04 20:17:08 | [diff] [blame] | 522 | void CreateFrame(mojom::CreateFrameParamsPtr params) override; |
Dmitry Gozman | 8936121 | 2018-02-13 16:10:44 | [diff] [blame] | 523 | void CreateFrameProxy( |
| 524 | int32_t routing_id, |
| 525 | int32_t render_view_routing_id, |
| 526 | int32_t opener_routing_id, |
| 527 | int32_t parent_routing_id, |
| 528 | const FrameReplicationState& replicated_state, |
| 529 | const base::UnguessableToken& devtools_frame_token) override; |
Makoto Shimazu | 8199e09 | 2018-05-11 06:03:14 | [diff] [blame] | 530 | void SetUpEmbeddedWorkerChannelForServiceWorker( |
Leon Han | 6e7c6e2f | 2019-02-03 07:26:56 | [diff] [blame] | 531 | blink::mojom::EmbeddedWorkerInstanceClientRequest client_request) |
| 532 | override; |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 533 | void OnNetworkConnectionChanged( |
| 534 | net::NetworkChangeNotifier::ConnectionType type, |
| 535 | double max_bandwidth_mbps) override; |
tbansal | b612c5d | 2017-05-25 18:53:06 | [diff] [blame] | 536 | void OnNetworkQualityChanged(net::EffectiveConnectionType type, |
| 537 | base::TimeDelta http_rtt, |
tbansal | 99d8aeb | 2017-05-22 19:12:58 | [diff] [blame] | 538 | base::TimeDelta transport_rtt, |
tbansal | 15973c3 | 2017-05-10 18:40:44 | [diff] [blame] | 539 | double bandwidth_kbps) override; |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 540 | void SetWebKitSharedTimersSuspended(bool suspend) override; |
Yutaka Hirano | b0465f7 | 2018-05-17 05:48:25 | [diff] [blame] | 541 | void SetUserAgent(const std::string& user_agent) override; |
Mike West | 6e4cbb3 | 2019-02-13 09:40:17 | [diff] [blame] | 542 | void SetUserAgentMetadata(const blink::UserAgentMetadata& metadata) override; |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 543 | void UpdateScrollbarTheme( |
| 544 | mojom::UpdateScrollbarThemeParamsPtr params) override; |
| 545 | void OnSystemColorsChanged(int32_t aqua_color_variant, |
| 546 | const std::string& highlight_text_color, |
| 547 | const std::string& highlight_color) override; |
| 548 | void PurgePluginListCache(bool reload_pages) override; |
Aditya Keerthi | c0d45b4 | 2019-02-25 18:53:00 | [diff] [blame] | 549 | void SetProcessState(mojom::RenderProcessState process_state) override; |
Shubhie Panicker | 45ce80a8 | 2018-02-01 01:40:19 | [diff] [blame] | 550 | void SetSchedulerKeepActive(bool keep_active) override; |
Nasko Oskov | 1c2c049 | 2019-03-14 20:13:39 | [diff] [blame] | 551 | void SetIsLockedToSite() override; |
Robert Sesek | 6e3d725c | 2018-06-06 14:38:02 | [diff] [blame] | 552 | void EnableV8LowMemoryMode() override; |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 553 | |
[email protected] | 5071cb2 | 2013-07-10 02:19:06 | [diff] [blame] | 554 | void OnMemoryPressure( |
| 555 | base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
rockot | a2db0da | 2016-10-18 17:39:11 | [diff] [blame] | 556 | |
rmcilroy | aa29605 | 2015-04-14 15:35:27 | [diff] [blame] | 557 | bool RendererIsHidden() const; |
| 558 | void OnRendererHidden(); |
| 559 | void OnRendererVisible(); |
[email protected] | b3df5a4 | 2010-05-11 14:31:09 | [diff] [blame] | 560 | |
Aditya Keerthi | c0d45b4 | 2019-02-25 18:53:00 | [diff] [blame] | 561 | bool RendererIsBackgrounded() const; |
| 562 | void OnRendererBackgrounded(); |
| 563 | void OnRendererForegrounded(); |
| 564 | |
tasak | 335a187 | 2017-06-14 09:50:23 | [diff] [blame] | 565 | void RecordMemoryUsageAfterBackgrounded(const char* suffix, |
| 566 | int foregrounded_count); |
Aditya Keerthi | e84331b3 | 2019-03-20 15:25:52 | [diff] [blame] | 567 | void OnRecordMetricsForBackgroundedRendererPurgeTimerExpired( |
tasak | bb0640b | 2017-05-15 09:02:26 | [diff] [blame] | 568 | const char* suffix, |
| 569 | int foregrounded_count_when_purged); |
tasak | b46626a | 2016-10-18 05:54:44 | [diff] [blame] | 570 | |
ssid | 0603ca9f | 2015-06-09 16:48:08 | [diff] [blame] | 571 | void ReleaseFreeMemory(); |
| 572 | |
hong.zheng | b28b533 | 2016-05-11 02:33:39 | [diff] [blame] | 573 | void OnSyncMemoryPressure( |
| 574 | base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 575 | |
Fady Samuel | c645ffe | 2017-07-24 17:28:20 | [diff] [blame] | 576 | std::unique_ptr<viz::SyntheticBeginFrameSource> |
samans | 09812d3 | 2017-03-27 19:51:50 | [diff] [blame] | 577 | CreateSyntheticBeginFrameSource(); |
| 578 | |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 579 | void OnRendererInterfaceRequest(mojom::RendererAssociatedRequest request); |
| 580 | |
penghuang | 342762b | 2016-12-02 21:04:58 | [diff] [blame] | 581 | std::unique_ptr<discardable_memory::ClientDiscardableSharedMemoryManager> |
| 582 | discardable_shared_memory_manager_; |
| 583 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 584 | // These objects live solely on the render thread. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 585 | std::unique_ptr<DomStorageDispatcher> dom_storage_dispatcher_; |
Yuta Kitamura | deb91bb | 2018-05-29 05:53:20 | [diff] [blame] | 586 | std::unique_ptr<blink::scheduler::WebThreadScheduler> main_thread_scheduler_; |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 587 | std::unique_ptr<RendererBlinkPlatformImpl> blink_platform_impl_; |
John Abd-El-Malek | 6b56ef71 | 2017-10-21 22:52:46 | [diff] [blame] | 588 | std::unique_ptr<ResourceDispatcher> resource_dispatcher_; |
Yuzhu Shen | fe5f3a5 | 2018-01-11 21:24:13 | [diff] [blame] | 589 | std::unique_ptr<URLLoaderThrottleProvider> url_loader_throttle_provider_; |
[email protected] | 9291ed1 | 2009-07-23 17:33:22 | [diff] [blame] | 590 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 591 | std::unique_ptr<BrowserPluginManager> browser_plugin_manager_; |
fsamuel | 6c1dfeb | 2014-12-18 19:21:33 | [diff] [blame] | 592 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 593 | std::unique_ptr<PeerConnectionDependencyFactory> peer_connection_factory_; |
[email protected] | 6ee10bd | 2012-09-13 09:01:53 | [diff] [blame] | 594 | |
[email protected] | af08997 | 2013-01-10 04:04:40 | [diff] [blame] | 595 | // This is used to communicate to the browser process the status |
| 596 | // of all the peer connections created in the renderer. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 597 | std::unique_ptr<PeerConnectionTracker> peer_connection_tracker_; |
[email protected] | af08997 | 2013-01-10 04:04:40 | [diff] [blame] | 598 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 599 | // Dispatches all P2P sockets. |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 600 | scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; |
[email protected] | 80b161a | 2011-06-27 17:42:11 | [diff] [blame] | 601 | |
[email protected] | da9f30a | 2014-06-18 19:39:04 | [diff] [blame] | 602 | // Used for communicating registering AEC dump consumers with the browser and |
| 603 | // receving AEC dump file handles when AEC dump is enabled. An AEC dump is |
| 604 | // diagnostic audio data for WebRTC stored locally when enabled by the user in |
| 605 | // chrome://webrtc-internals. |
| 606 | scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; |
liushouqun | 517b129 | 2016-09-14 05:58:59 | [diff] [blame] | 607 | |
Max Morin | 3d464a4 | 2018-01-15 11:17:00 | [diff] [blame] | 608 | // Provides AudioInputIPC objects for audio input devices. Initialized in |
| 609 | // Init. |
| 610 | base::Optional<AudioInputIPCFactory> audio_input_ipc_factory_; |
Max Morin | 2c38c28 | 2018-04-17 07:01:42 | [diff] [blame] | 611 | // Provides AudioOutputIPC objects for audio output devices. Initialized in |
| 612 | // Init. |
Max Morin | 3d464a4 | 2018-01-15 11:17:00 | [diff] [blame] | 613 | base::Optional<AudioOutputIPCFactory> audio_output_ipc_factory_; |
maxmorin | 017ba8c6 | 2017-06-02 10:23:09 | [diff] [blame] | 614 | |
liushouqun | 517b129 | 2016-09-14 05:58:59 | [diff] [blame] | 615 | // Used on the render thread. |
| 616 | std::unique_ptr<VideoCaptureImplManager> vc_manager_; |
[email protected] | da9f30a | 2014-06-18 19:39:04 | [diff] [blame] | 617 | |
Aditya Keerthi | c0d45b4 | 2019-02-25 18:53:00 | [diff] [blame] | 618 | // Used to keep track of the renderer's backgrounded and visibility state. |
| 619 | // Updated via an IPC from the browser process. If nullopt, the browser |
| 620 | // process has yet to send an update and the state is unknown. |
| 621 | base::Optional<mojom::RenderProcessState> process_state_; |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 622 | |
Yutaka Hirano | b0465f7 | 2018-05-17 05:48:25 | [diff] [blame] | 623 | blink::WebString user_agent_; |
Mike West | 6e4cbb3 | 2019-02-13 09:40:17 | [diff] [blame] | 624 | blink::UserAgentMetadata user_agent_metadata_; |
Yutaka Hirano | b0465f7 | 2018-05-17 05:48:25 | [diff] [blame] | 625 | |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 626 | // Used to control web test specific behavior. |
| 627 | std::unique_ptr<WebTestDependencies> web_test_deps_; |
[email protected] | 233567d | 2013-02-27 20:22:02 | [diff] [blame] | 628 | |
danakj | ab9ef4d | 2017-10-31 23:38:33 | [diff] [blame] | 629 | // Sticky once true, indicates that compositing is done without Gpu, so |
| 630 | // resources given to the compositor or to the viz service should be |
| 631 | // software-based. |
| 632 | bool is_gpu_compositing_disabled_ = false; |
| 633 | |
dcastagna | 7f45dada | 2015-10-19 20:17:35 | [diff] [blame] | 634 | // Utility class to provide GPU functionalities to media. |
dcastagna | 09bd6b3 | 2016-02-01 21:54:28 | [diff] [blame] | 635 | // TODO(dcastagna): This should be just one scoped_ptr once |
| 636 | // http://crbug.com/580386 is fixed. |
| 637 | // NOTE(dcastagna): At worst this accumulates a few bytes per context lost. |
Miguel Casas-Sanchez | cfcca5d5 | 2017-07-07 02:32:59 | [diff] [blame] | 638 | std::vector<std::unique_ptr<GpuVideoAcceleratorFactoriesImpl>> gpu_factories_; |
dcastagna | 7f45dada | 2015-10-19 20:17:35 | [diff] [blame] | 639 | |
[email protected] | c1330c8 | 2013-06-06 02:23:25 | [diff] [blame] | 640 | // Thread for running multimedia operations (e.g., video decoding). |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 641 | std::unique_ptr<base::Thread> media_thread_; |
[email protected] | c1330c8 | 2013-06-06 02:23:25 | [diff] [blame] | 642 | |
skyostil | 2d3b5bd | 2015-05-27 15:40:59 | [diff] [blame] | 643 | // Will point to appropriate task runner after initialization, |
[email protected] | ea5f70a | 2013-03-07 12:30:36 | [diff] [blame] | 644 | // regardless of whether |compositor_thread_| is overriden. |
skyostil | 2d3b5bd | 2015-05-27 15:40:59 | [diff] [blame] | 645 | scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
[email protected] | ea5f70a | 2013-03-07 12:30:36 | [diff] [blame] | 646 | |
CJ DiMeglio | 79f7c91a2 | 2018-08-30 22:24:43 | [diff] [blame] | 647 | // Task to run the VideoFrameCompositor on. |
| 648 | scoped_refptr<base::SingleThreadTaskRunner> |
| 649 | video_frame_compositor_task_runner_; |
| 650 | |
dcastagna | b880e8f | 2015-06-30 20:16:06 | [diff] [blame] | 651 | // Pool of workers used for raster operations (e.g., tile rasterization). |
prashant.n | fad657e | 2016-06-01 07:52:17 | [diff] [blame] | 652 | scoped_refptr<CategorizedWorkerPool> categorized_worker_pool_; |
reveman | 34b7a152 | 2015-03-23 20:27:47 | [diff] [blame] | 653 | |
boliu | bee541f4 | 2015-11-05 00:52:53 | [diff] [blame] | 654 | #if defined(OS_ANDROID) |
siva.gunturi | 5d4feb05 | 2015-11-15 16:15:31 | [diff] [blame] | 655 | scoped_refptr<StreamTextureFactory> stream_texture_factory_; |
boliu | bee541f4 | 2015-11-05 00:52:53 | [diff] [blame] | 656 | #endif |
| 657 | |
Scott Violet | 7e33efc | 2018-08-29 22:30:15 | [diff] [blame] | 658 | scoped_refptr<ws::ContextProviderCommandBuffer> shared_main_thread_contexts_; |
[email protected] | c29b7ff | 2013-03-06 03:51:04 | [diff] [blame] | 659 | |
Trent Apted | a250ec3ab | 2018-08-19 08:52:19 | [diff] [blame] | 660 | base::ObserverList<RenderThreadObserver>::Unchecked observers_; |
[email protected] | 1223d6ef | 2011-03-28 16:47:50 | [diff] [blame] | 661 | |
Sergey Ulanov | 83f4a15 | 2019-02-14 03:54:25 | [diff] [blame] | 662 | scoped_refptr<viz::RasterContextProvider> |
| 663 | video_frame_compositor_context_provider_; |
CJ DiMeglio | 79f7c91a2 | 2018-08-30 22:24:43 | [diff] [blame] | 664 | |
Victor Miura | ff648861 | 2017-12-21 04:16:15 | [diff] [blame] | 665 | scoped_refptr<viz::RasterContextProvider> shared_worker_context_provider_; |
[email protected] | 3b2afc3 | 2012-06-18 21:31:16 | [diff] [blame] | 666 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 667 | std::unique_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_; |
[email protected] | 3958e97 | 2012-07-17 00:25:41 | [diff] [blame] | 668 | |
[email protected] | b2d9876 | 2012-09-03 17:04:06 | [diff] [blame] | 669 | HistogramCustomizer histogram_customizer_; |
| 670 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 671 | std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
[email protected] | 5071cb2 | 2013-07-10 02:19:06 | [diff] [blame] | 672 | |
Robert Sesek | 6e3d725c | 2018-06-06 14:38:02 | [diff] [blame] | 673 | // Created in response to EnableV8LowMemoryMode(), this manages V8's |
| 674 | // memory saving mode. |
| 675 | std::unique_ptr<LowMemoryModeController> low_memory_mode_controller_; |
| 676 | |
Scott Violet | 7e33efc | 2018-08-29 22:30:15 | [diff] [blame] | 677 | std::unique_ptr<ws::Gpu> gpu_; |
sadrul | 9e0bb1d | 2016-08-04 20:18:39 | [diff] [blame] | 678 | |
skyostil | 457b0a1 | 2014-09-09 10:12:07 | [diff] [blame] | 679 | scoped_refptr<base::SingleThreadTaskRunner> |
| 680 | main_thread_compositor_task_runner_; |
skyostil | 457b0a1 | 2014-09-09 10:12:07 | [diff] [blame] | 681 | |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 682 | // Compositor settings. |
[email protected] | a23530d | 2014-03-11 06:04:14 | [diff] [blame] | 683 | bool is_gpu_rasterization_forced_; |
senorblanco | b60ba95 | 2015-01-27 19:12:36 | [diff] [blame] | 684 | int gpu_rasterization_msaa_sample_count_; |
[email protected] | a23530d | 2014-03-11 06:04:14 | [diff] [blame] | 685 | bool is_lcd_text_enabled_; |
[email protected] | 2cccfef | 2014-05-01 06:05:16 | [diff] [blame] | 686 | bool is_zero_copy_enabled_; |
ccameron | c7fcd13 | 2015-11-03 20:14:31 | [diff] [blame] | 687 | bool is_gpu_memory_buffer_compositor_resources_enabled_; |
ericrk | 1d17f75 | 2015-10-20 03:03:07 | [diff] [blame] | 688 | bool is_partial_raster_enabled_; |
ccameron | a764475 | 2014-12-30 01:16:31 | [diff] [blame] | 689 | bool is_elastic_overscroll_enabled_; |
danakj | 4b34721 | 2018-07-04 17:55:17 | [diff] [blame] | 690 | bool is_zoom_for_dsf_enabled_; |
loyso | 65c93c60 | 2015-08-11 05:15:57 | [diff] [blame] | 691 | bool is_threaded_animation_enabled_; |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 692 | bool is_scroll_animator_enabled_; |
[email protected] | a23530d | 2014-03-11 06:04:14 | [diff] [blame] | 693 | |
Miguel Casas | 5e101805 | 2018-01-09 19:17:36 | [diff] [blame] | 694 | // Target rendering ColorSpace. |
| 695 | gfx::ColorSpace rendering_color_space_; |
| 696 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 697 | class PendingFrameCreate : public base::RefCounted<PendingFrameCreate> { |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 698 | public: |
Balazs Engedy | ba034e7 | 2017-10-27 22:26:28 | [diff] [blame] | 699 | PendingFrameCreate(const service_manager::BindSourceInfo& source_info, |
| 700 | int routing_id, |
| 701 | mojom::FrameRequest frame_request); |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 702 | |
ben | f28ce88 | 2017-05-02 16:15:49 | [diff] [blame] | 703 | const service_manager::BindSourceInfo& browser_info() const { |
| 704 | return browser_info_; |
| 705 | } |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 706 | mojom::FrameRequest TakeFrameRequest() { return std::move(frame_request_); } |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 707 | |
| 708 | private: |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 709 | friend class base::RefCounted<PendingFrameCreate>; |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 710 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 711 | ~PendingFrameCreate(); |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 712 | |
| 713 | // Mojo error handler. |
| 714 | void OnConnectionError(); |
| 715 | |
ben | f28ce88 | 2017-05-02 16:15:49 | [diff] [blame] | 716 | service_manager::BindSourceInfo browser_info_; |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 717 | int routing_id_; |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 718 | mojom::FrameRequest frame_request_; |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 719 | }; |
| 720 | |
ben | 76f52b24 | 2016-06-18 05:42:48 | [diff] [blame] | 721 | using PendingFrameCreateMap = |
| 722 | std::map<int, scoped_refptr<PendingFrameCreate>>; |
| 723 | PendingFrameCreateMap pending_frame_creates_; |
rockot | f8fdd9b | 2015-12-16 22:22:35 | [diff] [blame] | 724 | |
Marijn Kruisselbrink | 4712c33 | 2018-06-13 19:06:59 | [diff] [blame] | 725 | blink::mojom::StoragePartitionServicePtr storage_partition_service_; |
Joel Hockey | 3146d14 | 2017-11-15 22:27:40 | [diff] [blame] | 726 | mojom::RendererHostAssociatedPtr renderer_host_; |
jam | c912ca3 | 2016-02-24 20:17:31 | [diff] [blame] | 727 | |
Ken Rockot | 26e4e80 | 2018-07-31 15:03:33 | [diff] [blame] | 728 | blink::AssociatedInterfaceRegistry associated_interfaces_; |
rockot | 067ca55f | 2016-09-30 22:00:15 | [diff] [blame] | 729 | |
| 730 | mojo::AssociatedBinding<mojom::Renderer> renderer_binding_; |
| 731 | |
rockot | 1587e33 | 2016-07-27 17:44:14 | [diff] [blame] | 732 | mojom::RenderFrameMessageFilterAssociatedPtr render_frame_message_filter_; |
rockot | e261d211 | 2016-09-21 22:22:23 | [diff] [blame] | 733 | mojom::RenderMessageFilterAssociatedPtr render_message_filter_; |
rockot | 1587e33 | 2016-07-27 17:44:14 | [diff] [blame] | 734 | |
tasak | 72f6404 | 2017-01-19 14:02:53 | [diff] [blame] | 735 | RendererMemoryMetrics purge_and_suspend_memory_metrics_; |
tasak | b95dbb50c | 2017-02-08 18:07:50 | [diff] [blame] | 736 | bool needs_to_record_first_active_paint_; |
Takashi SAKAMOTO | 870f626 | 2017-08-22 04:08:27 | [diff] [blame] | 737 | base::TimeTicks was_backgrounded_time_; |
tasak | bb0640b | 2017-05-15 09:02:26 | [diff] [blame] | 738 | int process_foregrounded_count_; |
Nasko Oskov | 3d0d1dc | 2018-09-25 03:57:13 | [diff] [blame] | 739 | bool online_status_ = true; |
hajimehoshi | 6909327 | 2016-05-13 08:30:58 | [diff] [blame] | 740 | |
staraz | 067f5824 | 2016-11-07 21:06:41 | [diff] [blame] | 741 | int32_t client_id_; |
| 742 | |
samans | 2040988b | 2017-04-11 23:58:35 | [diff] [blame] | 743 | mojom::FrameSinkProviderPtr frame_sink_provider_; |
| 744 | |
danakj | ab9ef4d | 2017-10-31 23:38:33 | [diff] [blame] | 745 | // A mojo connection to the CompositingModeReporter service. |
| 746 | viz::mojom::CompositingModeReporterPtr compositing_mode_reporter_; |
| 747 | // The class is a CompositingModeWatcher, which is bound to mojo through |
danakj | 4ee301c | 2017-11-29 16:19:43 | [diff] [blame] | 748 | // this member. |
danakj | ab9ef4d | 2017-10-31 23:38:33 | [diff] [blame] | 749 | mojo::Binding<viz::mojom::CompositingModeWatcher> |
| 750 | compositing_mode_watcher_binding_; |
| 751 | |
Ben Goodger | f180ce1 | 2018-02-09 22:54:01 | [diff] [blame] | 752 | base::WeakPtrFactory<RenderThreadImpl> weak_factory_; |
| 753 | |
[email protected] | f1a29a0 | 2011-10-06 23:08:44 | [diff] [blame] | 754 | DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 755 | }; |
| 756 | |
jam | 8a021512a | 2015-02-03 18:16:08 | [diff] [blame] | 757 | #if defined(COMPILER_MSVC) |
| 758 | #pragma warning(pop) |
| 759 | #endif |
| 760 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 761 | } // namespace content |
| 762 | |
[email protected] | f1a29a0 | 2011-10-06 23:08:44 | [diff] [blame] | 763 | #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_ |