cc: Implement shared worker contexts.
[chromium-blink-merge.git] / content / renderer / render_thread_impl.h
blob4ac40da397886d380f7409016b263cbb3aa5d15c
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_THREAD_IMPL_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/cancelable_callback.h"
13 #include "base/memory/memory_pressure_listener.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/metrics/user_metrics_action.h"
16 #include "base/observer_list.h"
17 #include "base/strings/string16.h"
18 #include "base/threading/thread_checker.h"
19 #include "base/timer/timer.h"
20 #include "build/build_config.h"
21 #include "content/child/child_thread_impl.h"
22 #include "content/common/content_export.h"
23 #include "content/common/frame_replication_state.h"
24 #include "content/common/gpu/client/gpu_channel_host.h"
25 #include "content/common/gpu/gpu_result_codes.h"
26 #include "content/public/renderer/render_thread.h"
27 #include "content/renderer/gpu/compositor_dependencies.h"
28 #include "net/base/network_change_notifier.h"
29 #include "third_party/WebKit/public/platform/WebConnectionType.h"
30 #include "ui/gfx/native_widget_types.h"
32 #if defined(OS_MACOSX)
33 #include "third_party/WebKit/public/web/mac/WebScrollbarTheme.h"
34 #endif
36 class GrContext;
37 class SkBitmap;
38 struct FrameMsg_NewFrame_Params;
39 struct ViewMsg_New_Params;
40 struct ViewMsg_UpdateScrollbarTheme_Params;
41 struct WorkerProcessMsg_CreateWorker_Params;
43 namespace blink {
44 class WebGamepads;
45 class WebGraphicsContext3D;
46 class WebMediaStreamCenter;
47 class WebMediaStreamCenterClient;
50 namespace base {
51 class SingleThreadTaskRunner;
52 class Thread;
55 namespace cc {
56 class ContextProvider;
57 class TaskGraphRunner;
60 namespace cc_blink {
61 class ContextProviderWebContext;
64 namespace IPC {
65 class MessageFilter;
68 namespace media {
69 class AudioHardwareConfig;
70 class GpuVideoAcceleratorFactories;
73 namespace scheduler {
74 class RendererScheduler;
77 namespace v8 {
78 class Extension;
81 namespace content {
83 class AppCacheDispatcher;
84 class AecDumpMessageFilter;
85 class AudioInputMessageFilter;
86 class AudioMessageFilter;
87 class AudioRendererMixerManager;
88 class BluetoothMessageFilter;
89 class BrowserPluginManager;
90 class CacheStorageDispatcher;
91 class CompositorForwardingMessageFilter;
92 class ContextProviderCommandBuffer;
93 class DBMessageFilter;
94 class DevToolsAgentFilter;
95 class DomStorageDispatcher;
96 class EmbeddedWorkerDispatcher;
97 class GpuChannelHost;
98 class IndexedDBDispatcher;
99 class InputHandlerManager;
100 class MediaStreamCenter;
101 class MemoryObserver;
102 class MidiMessageFilter;
103 class NetInfoDispatcher;
104 class P2PSocketDispatcher;
105 class PeerConnectionDependencyFactory;
106 class PeerConnectionTracker;
107 class RasterWorkerPool;
108 class RenderProcessObserver;
109 class RendererBlinkPlatformImpl;
110 class RendererDemuxerAndroid;
111 class ResourceDispatchThrottler;
112 class ResourceSchedulingFilter;
113 class V8SamplingProfiler;
114 class VideoCaptureImplManager;
115 class WebGraphicsContext3DCommandBufferImpl;
116 class WebRTCIdentityService;
118 #if defined(COMPILER_MSVC)
119 // See explanation for other RenderViewHostImpl which is the same issue.
120 #pragma warning(push)
121 #pragma warning(disable: 4250)
122 #endif
124 // The RenderThreadImpl class represents a background thread where RenderView
125 // instances live. The RenderThread supports an API that is used by its
126 // consumer to talk indirectly to the RenderViews and supporting objects.
127 // Likewise, it provides an API for the RenderViews to talk back to the main
128 // process (i.e., their corresponding WebContentsImpl).
130 // Most of the communication occurs in the form of IPC messages. They are
131 // routed to the RenderThread according to the routing IDs of the messages.
132 // The routing IDs correspond to RenderView instances.
133 class CONTENT_EXPORT RenderThreadImpl
134 : public RenderThread,
135 public ChildThreadImpl,
136 public GpuChannelHostFactory,
137 NON_EXPORTED_BASE(public CompositorDependencies) {
138 public:
139 static RenderThreadImpl* Create(const InProcessChildThreadParams& params);
140 static RenderThreadImpl* Create(
141 scoped_ptr<base::MessageLoop> main_message_loop,
142 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler);
143 static RenderThreadImpl* current();
145 ~RenderThreadImpl() override;
146 void Shutdown() override;
148 // When initializing WebKit, ensure that any schemes needed for the content
149 // module are registered properly. Static to allow sharing with tests.
150 static void RegisterSchemes();
152 // Notify V8 that the date/time configuration of the system might have
153 // changed.
154 static void NotifyTimezoneChange();
156 // RenderThread implementation:
157 bool Send(IPC::Message* msg) override;
158 IPC::SyncChannel* GetChannel() override;
159 std::string GetLocale() override;
160 IPC::SyncMessageFilter* GetSyncMessageFilter() override;
161 scoped_refptr<base::SingleThreadTaskRunner> GetIOMessageLoopProxy() override;
162 void AddRoute(int32 routing_id, IPC::Listener* listener) override;
163 void RemoveRoute(int32 routing_id) override;
164 int GenerateRoutingID() override;
165 void AddFilter(IPC::MessageFilter* filter) override;
166 void RemoveFilter(IPC::MessageFilter* filter) override;
167 void AddObserver(RenderProcessObserver* observer) override;
168 void RemoveObserver(RenderProcessObserver* observer) override;
169 void SetResourceDispatcherDelegate(
170 ResourceDispatcherDelegate* delegate) override;
171 void EnsureWebKitInitialized() override;
172 void RecordAction(const base::UserMetricsAction& action) override;
173 void RecordComputedAction(const std::string& action) override;
174 scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer(
175 size_t buffer_size) override;
176 cc::SharedBitmapManager* GetSharedBitmapManager() override;
177 void RegisterExtension(v8::Extension* extension) override;
178 void ScheduleIdleHandler(int64 initial_delay_ms) override;
179 void IdleHandler() override;
180 int64 GetIdleNotificationDelayInMs() const override;
181 void SetIdleNotificationDelayInMs(
182 int64 idle_notification_delay_in_ms) override;
183 void UpdateHistograms(int sequence_number) override;
184 int PostTaskToAllWebWorkers(const base::Closure& closure) override;
185 bool ResolveProxy(const GURL& url, std::string* proxy_list) override;
186 base::WaitableEvent* GetShutdownEvent() override;
187 ServiceRegistry* GetServiceRegistry() override;
189 // CompositorDependencies implementation.
190 bool IsGpuRasterizationForced() override;
191 bool IsGpuRasterizationEnabled() override;
192 int GetGpuRasterizationMSAASampleCount() override;
193 bool IsLcdTextEnabled() override;
194 bool IsDistanceFieldTextEnabled() override;
195 bool IsZeroCopyEnabled() override;
196 bool IsPersistentGpuMemoryBufferEnabled() override;
197 bool IsElasticOverscrollEnabled() override;
198 std::vector<unsigned> GetImageTextureTargets() override;
199 scoped_refptr<base::SingleThreadTaskRunner>
200 GetCompositorMainThreadTaskRunner() override;
201 scoped_refptr<base::SingleThreadTaskRunner>
202 GetCompositorImplThreadTaskRunner() override;
203 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
204 scheduler::RendererScheduler* GetRendererScheduler() override;
205 cc::ContextProvider* GetSharedMainThreadContextProvider() override;
206 scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
207 int routing_id) override;
208 cc::TaskGraphRunner* GetTaskGraphRunner() override;
209 bool IsGatherPixelRefsEnabled() override;
210 bool IsThreadedAnimationEnabled() override;
212 // Synchronously establish a channel to the GPU plugin if not previously
213 // established or if it has been lost (for example if the GPU plugin crashed).
214 // If there is a pending asynchronous request, it will be completed by the
215 // time this routine returns.
216 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch);
219 // This method modifies how the next message is sent. Normally, when sending
220 // a synchronous message that runs a nested message loop, we need to suspend
221 // callbacks into WebKit. This involves disabling timers and deferring
222 // resource loads. However, there are exceptions when we need to customize
223 // the behavior.
224 void DoNotNotifyWebKitOfModalLoop();
226 // True if we are running layout tests. This currently disables forwarding
227 // various status messages to the console, skips network error pages, and
228 // short circuits size update and focus events.
229 bool layout_test_mode() const {
230 return layout_test_mode_;
232 void set_layout_test_mode(bool layout_test_mode) {
233 layout_test_mode_ = layout_test_mode;
236 RendererBlinkPlatformImpl* blink_platform_impl() const {
237 DCHECK(blink_platform_impl_);
238 return blink_platform_impl_.get();
241 CompositorForwardingMessageFilter* compositor_message_filter() const {
242 return compositor_message_filter_.get();
245 InputHandlerManager* input_handler_manager() const {
246 return input_handler_manager_.get();
249 // Will be null if threaded compositing has not been enabled.
250 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner() const {
251 return compositor_task_runner_;
254 AppCacheDispatcher* appcache_dispatcher() const {
255 return appcache_dispatcher_.get();
258 DomStorageDispatcher* dom_storage_dispatcher() const {
259 return dom_storage_dispatcher_.get();
262 EmbeddedWorkerDispatcher* embedded_worker_dispatcher() const {
263 return embedded_worker_dispatcher_.get();
266 AudioInputMessageFilter* audio_input_message_filter() {
267 return audio_input_message_filter_.get();
270 AudioMessageFilter* audio_message_filter() {
271 return audio_message_filter_.get();
274 MidiMessageFilter* midi_message_filter() {
275 return midi_message_filter_.get();
278 #if defined(OS_ANDROID)
279 RendererDemuxerAndroid* renderer_demuxer() {
280 return renderer_demuxer_.get();
282 #endif
284 // Creates the embedder implementation of WebMediaStreamCenter.
285 // The resulting object is owned by WebKit and deleted by WebKit at tear-down.
286 blink::WebMediaStreamCenter* CreateMediaStreamCenter(
287 blink::WebMediaStreamCenterClient* client);
289 BrowserPluginManager* browser_plugin_manager() const {
290 return browser_plugin_manager_.get();
293 #if defined(ENABLE_WEBRTC)
294 // Returns a factory used for creating RTC PeerConnection objects.
295 PeerConnectionDependencyFactory* GetPeerConnectionDependencyFactory();
297 PeerConnectionTracker* peer_connection_tracker() {
298 return peer_connection_tracker_.get();
301 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
302 P2PSocketDispatcher* p2p_socket_dispatcher() {
303 return p2p_socket_dispatcher_.get();
305 #endif
307 VideoCaptureImplManager* video_capture_impl_manager() const {
308 return vc_manager_.get();
311 // Get the GPU channel. Returns NULL if the channel is not established or
312 // has been lost.
313 GpuChannelHost* GetGpuChannel();
315 // Returns a SingleThreadTaskRunner instance corresponding to the message loop
316 // of the thread on which file operations should be run. Must be called
317 // on the renderer's main thread.
318 scoped_refptr<base::SingleThreadTaskRunner> GetFileThreadMessageLoopProxy();
320 // Returns a SingleThreadTaskRunner instance corresponding to the message loop
321 // of the thread on which media operations should be run. Must be called
322 // on the renderer's main thread.
323 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner();
325 // A TaskRunner instance that runs tasks on the raster worker pool.
326 base::TaskRunner* GetWorkerTaskRunner();
328 // Returns a shared worker context provider that can be used on any thread.
329 scoped_refptr<ContextProviderCommandBuffer> SharedWorkerContextProvider();
331 // Causes the idle handler to skip sending idle notifications
332 // on the two next scheduled calls, so idle notifications are
333 // not sent for at least one notification delay.
334 void PostponeIdleNotification();
336 scoped_refptr<media::GpuVideoAcceleratorFactories> GetGpuFactories();
338 scoped_refptr<cc_blink::ContextProviderWebContext>
339 SharedMainThreadContextProvider();
341 // AudioRendererMixerManager instance which manages renderer side mixer
342 // instances shared based on configured audio parameters. Lazily created on
343 // first call.
344 AudioRendererMixerManager* GetAudioRendererMixerManager();
346 // AudioHardwareConfig contains audio hardware configuration for
347 // renderer side clients. Creation requires a synchronous IPC call so it is
348 // lazily created on the first call.
349 media::AudioHardwareConfig* GetAudioHardwareConfig();
351 #if defined(OS_WIN)
352 void PreCacheFontCharacters(const LOGFONT& log_font,
353 const base::string16& str);
354 #endif
356 #if defined(ENABLE_WEBRTC)
357 WebRTCIdentityService* get_webrtc_identity_service() {
358 return webrtc_identity_service_.get();
360 #endif
362 // For producing custom V8 histograms. Custom histograms are produced if all
363 // RenderViews share the same host, and the host is in the pre-specified set
364 // of hosts we want to produce custom diagrams for. The name for a custom
365 // diagram is the name of the corresponding generic diagram plus a
366 // host-specific suffix.
367 class CONTENT_EXPORT HistogramCustomizer {
368 public:
369 HistogramCustomizer();
370 ~HistogramCustomizer();
372 // Called when a top frame of a RenderView navigates. This function updates
373 // RenderThreadImpl's information about whether all RenderViews are
374 // displaying a page from the same host. |host| is the host where a
375 // RenderView navigated, and |view_count| is the number of RenderViews in
376 // this process.
377 void RenderViewNavigatedToHost(const std::string& host, size_t view_count);
379 // Used for customizing some histograms if all RenderViews share the same
380 // host. Returns the current custom histogram name to use for
381 // |histogram_name|, or |histogram_name| if it shouldn't be customized.
382 std::string ConvertToCustomHistogramName(const char* histogram_name) const;
384 private:
385 friend class RenderThreadImplUnittest;
387 // Used for updating the information on which is the common host which all
388 // RenderView's share (if any). If there is no common host, this function is
389 // called with an empty string.
390 void SetCommonHost(const std::string& host);
392 // The current common host of the RenderViews; empty string if there is no
393 // common host.
394 std::string common_host_;
395 // The corresponding suffix.
396 std::string common_host_histogram_suffix_;
397 // Set of histograms for which we want to produce a custom histogram if
398 // possible.
399 std::set<std::string> custom_histograms_;
401 DISALLOW_COPY_AND_ASSIGN(HistogramCustomizer);
404 HistogramCustomizer* histogram_customizer() {
405 return &histogram_customizer_;
408 // Retrieve current gamepad data.
409 void SampleGamepads(blink::WebGamepads* data);
411 // Called by a RenderWidget when it is created or destroyed. This
412 // allows the process to know when there are no visible widgets.
413 void WidgetCreated();
414 // Note: A widget must not be hidden when it is destroyed - ensure that
415 // WidgetRestored is called before WidgetDestroyed for any hidden widget.
416 void WidgetDestroyed();
417 void WidgetHidden();
418 void WidgetRestored();
420 void AddEmbeddedWorkerRoute(int32 routing_id, IPC::Listener* listener);
421 void RemoveEmbeddedWorkerRoute(int32 routing_id);
423 void RegisterPendingRenderFrameConnect(
424 int routing_id,
425 mojo::InterfaceRequest<mojo::ServiceProvider> services,
426 mojo::ServiceProviderPtr exposed_services);
428 protected:
429 RenderThreadImpl(const InProcessChildThreadParams& params,
430 scoped_ptr<scheduler::RendererScheduler> scheduler);
431 RenderThreadImpl(scoped_ptr<base::MessageLoop> main_message_loop,
432 scoped_ptr<scheduler::RendererScheduler> scheduler);
433 virtual void SetResourceDispatchTaskQueue(
434 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue);
436 private:
437 // ChildThread
438 bool OnControlMessageReceived(const IPC::Message& msg) override;
439 void OnProcessBackgrounded(bool backgrounded) override;
441 // GpuChannelHostFactory implementation:
442 bool IsMainThread() override;
443 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
444 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override;
445 CreateCommandBufferResult CreateViewCommandBuffer(
446 int32 surface_id,
447 const GPUCreateCommandBufferConfig& init_params,
448 int32 route_id) override;
450 void Init();
452 void OnCreateNewFrame(FrameMsg_NewFrame_Params params);
453 void OnCreateNewFrameProxy(int routing_id,
454 int render_view_routing_id,
455 int opener_routing_id,
456 int parent_routing_id,
457 const FrameReplicationState& replicated_state);
458 void OnSetZoomLevelForCurrentURL(const std::string& scheme,
459 const std::string& host,
460 double zoom_level);
461 void OnCreateNewView(const ViewMsg_New_Params& params);
462 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
463 #if defined(ENABLE_PLUGINS)
464 void OnPurgePluginListCache(bool reload_pages);
465 #endif
466 void OnNetworkTypeChanged(net::NetworkChangeNotifier::ConnectionType type);
467 void OnGetAccessibilityTree();
468 void OnUpdateTimezone(const std::string& zoneId);
469 void OnMemoryPressure(
470 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
471 #if defined(OS_ANDROID)
472 void OnSetWebKitSharedTimersSuspended(bool suspend);
473 #endif
474 #if defined(OS_MACOSX)
475 void OnUpdateScrollbarTheme(
476 const ViewMsg_UpdateScrollbarTheme_Params& params);
477 #endif
478 void OnCreateNewSharedWorker(
479 const WorkerProcessMsg_CreateWorker_Params& params);
480 bool RendererIsHidden() const;
481 void OnRendererHidden();
482 void OnRendererVisible();
484 void ReleaseFreeMemory();
486 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext3d();
488 // These objects live solely on the render thread.
489 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
490 scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_;
491 scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_;
492 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_;
493 scoped_ptr<RendererBlinkPlatformImpl> blink_platform_impl_;
494 scoped_ptr<ResourceDispatchThrottler> resource_dispatch_throttler_;
495 scoped_ptr<CacheStorageDispatcher> main_thread_cache_storage_dispatcher_;
496 scoped_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_;
498 // Used on the render thread and deleted by WebKit at shutdown.
499 blink::WebMediaStreamCenter* media_stream_center_;
501 // Used on the renderer and IPC threads.
502 scoped_refptr<DBMessageFilter> db_message_filter_;
503 scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_;
504 scoped_refptr<AudioMessageFilter> audio_message_filter_;
505 scoped_refptr<MidiMessageFilter> midi_message_filter_;
506 #if defined(OS_ANDROID)
507 scoped_refptr<RendererDemuxerAndroid> renderer_demuxer_;
508 #endif
509 scoped_refptr<DevToolsAgentFilter> devtools_agent_message_filter_;
510 scoped_ptr<V8SamplingProfiler> v8_sampling_profiler_;
512 scoped_ptr<BrowserPluginManager> browser_plugin_manager_;
514 #if defined(ENABLE_WEBRTC)
515 scoped_ptr<PeerConnectionDependencyFactory> peer_connection_factory_;
517 // This is used to communicate to the browser process the status
518 // of all the peer connections created in the renderer.
519 scoped_ptr<PeerConnectionTracker> peer_connection_tracker_;
521 // Dispatches all P2P sockets.
522 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_;
523 #endif
525 // Used on the render thread.
526 scoped_ptr<VideoCaptureImplManager> vc_manager_;
528 // Used for communicating registering AEC dump consumers with the browser and
529 // receving AEC dump file handles when AEC dump is enabled. An AEC dump is
530 // diagnostic audio data for WebRTC stored locally when enabled by the user in
531 // chrome://webrtc-internals.
532 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_;
534 // The count of RenderWidgets running through this thread.
535 int widget_count_;
537 // The count of hidden RenderWidgets running through this thread.
538 int hidden_widget_count_;
540 // The current value of the idle notification timer delay.
541 int64 idle_notification_delay_in_ms_;
543 // The number of idle handler calls that skip sending idle notifications.
544 int idle_notifications_to_skip_;
546 bool notify_webkit_of_modal_loop_;
547 bool webkit_shared_timer_suspended_;
549 // The following flag is used to control layout test specific behavior.
550 bool layout_test_mode_;
552 // Timer that periodically calls IdleHandler.
553 base::RepeatingTimer<RenderThreadImpl> idle_timer_;
555 // The channel from the renderer process to the GPU process.
556 scoped_refptr<GpuChannelHost> gpu_channel_;
558 // Cache of variables that are needed on the compositor thread by
559 // GpuChannelHostFactory methods.
560 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
562 // The message loop of the renderer main thread.
563 // This message loop should be destructed before the RenderThreadImpl
564 // shuts down Blink.
565 scoped_ptr<base::MessageLoop> main_message_loop_;
567 // A lazily initiated thread on which file operations are run.
568 scoped_ptr<base::Thread> file_thread_;
570 // May be null if overridden by ContentRendererClient.
571 scoped_ptr<base::Thread> compositor_thread_;
573 // Thread for running multimedia operations (e.g., video decoding).
574 scoped_ptr<base::Thread> media_thread_;
576 // Will point to appropriate task runner after initialization,
577 // regardless of whether |compositor_thread_| is overriden.
578 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
580 // Pool of workers used for raster operations (e.g., tile rasterization).
581 scoped_refptr<RasterWorkerPool> raster_worker_pool_;
583 base::CancelableCallback<void(const IPC::Message&)> main_input_callback_;
584 scoped_refptr<IPC::MessageFilter> input_event_filter_;
585 scoped_ptr<InputHandlerManager> input_handler_manager_;
586 scoped_refptr<CompositorForwardingMessageFilter> compositor_message_filter_;
588 scoped_refptr<BluetoothMessageFilter> bluetooth_message_filter_;
590 scoped_refptr<cc_blink::ContextProviderWebContext>
591 shared_main_thread_contexts_;
593 base::ObserverList<RenderProcessObserver> observers_;
595 scoped_refptr<ContextProviderCommandBuffer> shared_worker_context_provider_;
596 scoped_refptr<ContextProviderCommandBuffer> gpu_va_context_provider_;
598 scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_;
599 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_;
601 HistogramCustomizer histogram_customizer_;
603 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
605 #if defined(ENABLE_WEBRTC)
606 scoped_ptr<WebRTCIdentityService> webrtc_identity_service_;
607 #endif
609 scoped_ptr<MemoryObserver> memory_observer_;
611 scoped_refptr<base::SingleThreadTaskRunner>
612 main_thread_compositor_task_runner_;
614 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
616 // Compositor settings.
617 bool is_gpu_rasterization_enabled_;
618 bool is_gpu_rasterization_forced_;
619 int gpu_rasterization_msaa_sample_count_;
620 bool is_lcd_text_enabled_;
621 bool is_distance_field_text_enabled_;
622 bool is_zero_copy_enabled_;
623 bool is_one_copy_enabled_;
624 bool is_persistent_gpu_memory_buffer_enabled_;
625 bool is_elastic_overscroll_enabled_;
626 std::vector<unsigned> use_image_texture_targets_;
627 bool is_gather_pixel_refs_enabled_;
628 bool is_threaded_animation_enabled_;
630 class PendingRenderFrameConnect
631 : public base::RefCounted<PendingRenderFrameConnect> {
632 public:
633 PendingRenderFrameConnect(
634 int routing_id,
635 mojo::InterfaceRequest<mojo::ServiceProvider> services,
636 mojo::ServiceProviderPtr exposed_services);
638 mojo::InterfaceRequest<mojo::ServiceProvider>& services() {
639 return services_;
642 mojo::ServiceProviderPtr& exposed_services() { return exposed_services_; }
644 private:
645 friend class base::RefCounted<PendingRenderFrameConnect>;
647 ~PendingRenderFrameConnect();
649 // Mojo error handler.
650 void OnConnectionError();
652 int routing_id_;
653 mojo::InterfaceRequest<mojo::ServiceProvider> services_;
654 mojo::ServiceProviderPtr exposed_services_;
657 typedef std::map<int, scoped_refptr<PendingRenderFrameConnect>>
658 PendingRenderFrameConnectMap;
659 PendingRenderFrameConnectMap pending_render_frame_connects_;
661 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
664 #if defined(COMPILER_MSVC)
665 #pragma warning(pop)
666 #endif
668 } // namespace content
670 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_