Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / render_thread_impl.h
blob5d89ec97a01289cdac35d33b8618b6668a1cac9f
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_WidgetParams;
39 struct ViewMsg_New_Params;
40 struct WorkerProcessMsg_CreateWorker_Params;
42 namespace blink {
43 class WebGamepads;
44 class WebGraphicsContext3D;
45 class WebMediaStreamCenter;
46 class WebMediaStreamCenterClient;
49 namespace base {
50 class MessageLoopProxy;
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 v8 {
74 class Extension;
77 namespace content {
79 class AppCacheDispatcher;
80 class AecDumpMessageFilter;
81 class AudioInputMessageFilter;
82 class AudioMessageFilter;
83 class AudioRendererMixerManager;
84 class BrowserPluginManager;
85 class CacheStorageDispatcher;
86 class CompositorForwardingMessageFilter;
87 class ContextProviderCommandBuffer;
88 class DBMessageFilter;
89 class DevToolsAgentFilter;
90 class DomStorageDispatcher;
91 class EmbeddedWorkerDispatcher;
92 class GpuChannelHost;
93 class IndexedDBDispatcher;
94 class InputHandlerManager;
95 class MediaStreamCenter;
96 class MemoryObserver;
97 class MidiMessageFilter;
98 class NetInfoDispatcher;
99 class P2PSocketDispatcher;
100 class PeerConnectionDependencyFactory;
101 class PeerConnectionTracker;
102 class RenderProcessObserver;
103 class RendererBlinkPlatformImpl;
104 class RendererDemuxerAndroid;
105 class RendererScheduler;
106 class ResourceDispatchThrottler;
107 class ResourceSchedulingFilter;
108 class V8SamplingProfiler;
109 class VideoCaptureImplManager;
110 class WebGraphicsContext3DCommandBufferImpl;
111 class WebRTCIdentityService;
113 #if defined(COMPILER_MSVC)
114 // See explanation for other RenderViewHostImpl which is the same issue.
115 #pragma warning(push)
116 #pragma warning(disable: 4250)
117 #endif
119 // The RenderThreadImpl class represents a background thread where RenderView
120 // instances live. The RenderThread supports an API that is used by its
121 // consumer to talk indirectly to the RenderViews and supporting objects.
122 // Likewise, it provides an API for the RenderViews to talk back to the main
123 // process (i.e., their corresponding WebContentsImpl).
125 // Most of the communication occurs in the form of IPC messages. They are
126 // routed to the RenderThread according to the routing IDs of the messages.
127 // The routing IDs correspond to RenderView instances.
128 class CONTENT_EXPORT RenderThreadImpl
129 : public RenderThread,
130 public ChildThreadImpl,
131 public GpuChannelHostFactory,
132 NON_EXPORTED_BASE(public CompositorDependencies) {
133 public:
134 static RenderThreadImpl* current();
136 explicit RenderThreadImpl(const InProcessChildThreadParams& params);
137 explicit RenderThreadImpl(scoped_ptr<base::MessageLoop> main_message_loop);
138 ~RenderThreadImpl() override;
139 void Shutdown() override;
141 // When initializing WebKit, ensure that any schemes needed for the content
142 // module are registered properly. Static to allow sharing with tests.
143 static void RegisterSchemes();
145 // Notify V8 that the date/time configuration of the system might have
146 // changed.
147 static void NotifyTimezoneChange();
149 // RenderThread implementation:
150 bool Send(IPC::Message* msg) override;
151 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
152 IPC::SyncChannel* GetChannel() override;
153 std::string GetLocale() override;
154 IPC::SyncMessageFilter* GetSyncMessageFilter() override;
155 scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() override;
156 void AddRoute(int32 routing_id, IPC::Listener* listener) override;
157 void RemoveRoute(int32 routing_id) override;
158 int GenerateRoutingID() override;
159 void AddFilter(IPC::MessageFilter* filter) override;
160 void RemoveFilter(IPC::MessageFilter* filter) override;
161 void AddObserver(RenderProcessObserver* observer) override;
162 void RemoveObserver(RenderProcessObserver* observer) override;
163 void SetResourceDispatcherDelegate(
164 ResourceDispatcherDelegate* delegate) override;
165 void EnsureWebKitInitialized() override;
166 void RecordAction(const base::UserMetricsAction& action) override;
167 void RecordComputedAction(const std::string& action) override;
168 scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer(
169 size_t buffer_size) override;
170 cc::SharedBitmapManager* GetSharedBitmapManager() override;
171 void RegisterExtension(v8::Extension* extension) override;
172 void ScheduleIdleHandler(int64 initial_delay_ms) override;
173 void IdleHandler() override;
174 int64 GetIdleNotificationDelayInMs() const override;
175 void SetIdleNotificationDelayInMs(
176 int64 idle_notification_delay_in_ms) override;
177 void UpdateHistograms(int sequence_number) override;
178 int PostTaskToAllWebWorkers(const base::Closure& closure) override;
179 bool ResolveProxy(const GURL& url, std::string* proxy_list) override;
180 base::WaitableEvent* GetShutdownEvent() override;
181 ServiceRegistry* GetServiceRegistry() override;
183 // CompositorDependencies implementation.
184 bool IsImplSidePaintingEnabled() override;
185 bool IsGpuRasterizationForced() override;
186 bool IsGpuRasterizationEnabled() override;
187 int GetGpuRasterizationMSAASampleCount() override;
188 bool IsLcdTextEnabled() override;
189 bool IsDistanceFieldTextEnabled() override;
190 bool IsZeroCopyEnabled() override;
191 bool IsOneCopyEnabled() override;
192 bool IsElasticOverscrollEnabled() override;
193 bool UseSingleThreadScheduler() override;
194 uint32 GetImageTextureTarget() override;
195 scoped_refptr<base::SingleThreadTaskRunner>
196 GetCompositorMainThreadTaskRunner() override;
197 scoped_refptr<base::SingleThreadTaskRunner>
198 GetCompositorImplThreadTaskRunner() override;
199 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
200 RendererScheduler* GetRendererScheduler() override;
201 cc::ContextProvider* GetSharedMainThreadContextProvider() override;
202 scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
203 int routing_id) override;
204 cc::TaskGraphRunner* GetTaskGraphRunner() override;
205 bool IsGatherPixelRefsEnabled() override;
207 // Synchronously establish a channel to the GPU plugin if not previously
208 // established or if it has been lost (for example if the GPU plugin crashed).
209 // If there is a pending asynchronous request, it will be completed by the
210 // time this routine returns.
211 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch);
214 // These methods modify how the next message is sent. Normally, when sending
215 // a synchronous message that runs a nested message loop, we need to suspend
216 // callbacks into WebKit. This involves disabling timers and deferring
217 // resource loads. However, there are exceptions when we need to customize
218 // the behavior.
219 void DoNotSuspendWebKitSharedTimer();
220 void DoNotNotifyWebKitOfModalLoop();
222 // True if we are running layout tests. This currently disables forwarding
223 // various status messages to the console, skips network error pages, and
224 // short circuits size update and focus events.
225 bool layout_test_mode() const {
226 return layout_test_mode_;
228 void set_layout_test_mode(bool layout_test_mode) {
229 layout_test_mode_ = layout_test_mode;
232 RendererBlinkPlatformImpl* blink_platform_impl() const {
233 DCHECK(blink_platform_impl_);
234 return blink_platform_impl_.get();
237 CompositorForwardingMessageFilter* compositor_message_filter() const {
238 return compositor_message_filter_.get();
241 InputHandlerManager* input_handler_manager() const {
242 return input_handler_manager_.get();
245 // Will be null if threaded compositing has not been enabled.
246 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy() const {
247 return compositor_message_loop_proxy_;
250 AppCacheDispatcher* appcache_dispatcher() const {
251 return appcache_dispatcher_.get();
254 DomStorageDispatcher* dom_storage_dispatcher() const {
255 return dom_storage_dispatcher_.get();
258 EmbeddedWorkerDispatcher* embedded_worker_dispatcher() const {
259 return embedded_worker_dispatcher_.get();
262 AudioInputMessageFilter* audio_input_message_filter() {
263 return audio_input_message_filter_.get();
266 AudioMessageFilter* audio_message_filter() {
267 return audio_message_filter_.get();
270 MidiMessageFilter* midi_message_filter() {
271 return midi_message_filter_.get();
274 #if defined(OS_ANDROID)
275 RendererDemuxerAndroid* renderer_demuxer() {
276 return renderer_demuxer_.get();
278 #endif
280 // Creates the embedder implementation of WebMediaStreamCenter.
281 // The resulting object is owned by WebKit and deleted by WebKit at tear-down.
282 blink::WebMediaStreamCenter* CreateMediaStreamCenter(
283 blink::WebMediaStreamCenterClient* client);
285 BrowserPluginManager* browser_plugin_manager() const {
286 return browser_plugin_manager_.get();
289 #if defined(ENABLE_WEBRTC)
290 // Returns a factory used for creating RTC PeerConnection objects.
291 PeerConnectionDependencyFactory* GetPeerConnectionDependencyFactory();
293 PeerConnectionTracker* peer_connection_tracker() {
294 return peer_connection_tracker_.get();
297 // Current P2PSocketDispatcher. Set to NULL if P2P API is disabled.
298 P2PSocketDispatcher* p2p_socket_dispatcher() {
299 return p2p_socket_dispatcher_.get();
301 #endif
303 VideoCaptureImplManager* video_capture_impl_manager() const {
304 return vc_manager_.get();
307 // Get the GPU channel. Returns NULL if the channel is not established or
308 // has been lost.
309 GpuChannelHost* GetGpuChannel();
311 // Returns a MessageLoopProxy instance corresponding to the message loop
312 // of the thread on which file operations should be run. Must be called
313 // on the renderer's main thread.
314 scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy();
316 // Returns a SingleThreadTaskRunner instance corresponding to the message loop
317 // of the thread on which media operations should be run. Must be called
318 // on the renderer's main thread.
319 scoped_refptr<base::SingleThreadTaskRunner> GetMediaThreadTaskRunner();
321 // Causes the idle handler to skip sending idle notifications
322 // on the two next scheduled calls, so idle notifications are
323 // not sent for at least one notification delay.
324 void PostponeIdleNotification();
326 scoped_refptr<media::GpuVideoAcceleratorFactories> GetGpuFactories();
328 scoped_refptr<cc_blink::ContextProviderWebContext>
329 SharedMainThreadContextProvider();
331 // AudioRendererMixerManager instance which manages renderer side mixer
332 // instances shared based on configured audio parameters. Lazily created on
333 // first call.
334 AudioRendererMixerManager* GetAudioRendererMixerManager();
336 // AudioHardwareConfig contains audio hardware configuration for
337 // renderer side clients. Creation requires a synchronous IPC call so it is
338 // lazily created on the first call.
339 media::AudioHardwareConfig* GetAudioHardwareConfig();
341 #if defined(OS_WIN)
342 void PreCacheFontCharacters(const LOGFONT& log_font,
343 const base::string16& str);
344 #endif
346 #if defined(ENABLE_WEBRTC)
347 WebRTCIdentityService* get_webrtc_identity_service() {
348 return webrtc_identity_service_.get();
350 #endif
352 // For producing custom V8 histograms. Custom histograms are produced if all
353 // RenderViews share the same host, and the host is in the pre-specified set
354 // of hosts we want to produce custom diagrams for. The name for a custom
355 // diagram is the name of the corresponding generic diagram plus a
356 // host-specific suffix.
357 class CONTENT_EXPORT HistogramCustomizer {
358 public:
359 HistogramCustomizer();
360 ~HistogramCustomizer();
362 // Called when a top frame of a RenderView navigates. This function updates
363 // RenderThreadImpl's information about whether all RenderViews are
364 // displaying a page from the same host. |host| is the host where a
365 // RenderView navigated, and |view_count| is the number of RenderViews in
366 // this process.
367 void RenderViewNavigatedToHost(const std::string& host, size_t view_count);
369 // Used for customizing some histograms if all RenderViews share the same
370 // host. Returns the current custom histogram name to use for
371 // |histogram_name|, or |histogram_name| if it shouldn't be customized.
372 std::string ConvertToCustomHistogramName(const char* histogram_name) const;
374 private:
375 friend class RenderThreadImplUnittest;
377 // Used for updating the information on which is the common host which all
378 // RenderView's share (if any). If there is no common host, this function is
379 // called with an empty string.
380 void SetCommonHost(const std::string& host);
382 // The current common host of the RenderViews; empty string if there is no
383 // common host.
384 std::string common_host_;
385 // The corresponding suffix.
386 std::string common_host_histogram_suffix_;
387 // Set of histograms for which we want to produce a custom histogram if
388 // possible.
389 std::set<std::string> custom_histograms_;
391 DISALLOW_COPY_AND_ASSIGN(HistogramCustomizer);
394 HistogramCustomizer* histogram_customizer() {
395 return &histogram_customizer_;
398 // Retrieve current gamepad data.
399 void SampleGamepads(blink::WebGamepads* data);
401 // Called by a RenderWidget when it is created or destroyed. This
402 // allows the process to know when there are no visible widgets.
403 void WidgetCreated();
404 void WidgetDestroyed();
405 void WidgetHidden();
406 void WidgetRestored();
408 void AddEmbeddedWorkerRoute(int32 routing_id, IPC::Listener* listener);
409 void RemoveEmbeddedWorkerRoute(int32 routing_id);
411 void RegisterPendingRenderFrameConnect(
412 int routing_id,
413 mojo::InterfaceRequest<mojo::ServiceProvider> services,
414 mojo::ServiceProviderPtr exposed_services);
416 protected:
417 virtual void SetResourceDispatchTaskQueue(
418 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue);
420 private:
421 // ChildThread
422 bool OnControlMessageReceived(const IPC::Message& msg) override;
424 // GpuChannelHostFactory implementation:
425 bool IsMainThread() override;
426 base::MessageLoop* GetMainLoop() override;
427 scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() override;
428 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override;
429 CreateCommandBufferResult CreateViewCommandBuffer(
430 int32 surface_id,
431 const GPUCreateCommandBufferConfig& init_params,
432 int32 route_id) override;
434 void Init();
436 void OnCreateNewFrame(int routing_id,
437 int parent_routing_id,
438 int proxy_routing_id,
439 const FrameReplicationState& replicated_state,
440 FrameMsg_NewFrame_WidgetParams params);
441 void OnCreateNewFrameProxy(int routing_id,
442 int parent_routing_id,
443 int render_view_routing_id,
444 const FrameReplicationState& replicated_state);
445 void OnSetZoomLevelForCurrentURL(const std::string& scheme,
446 const std::string& host,
447 double zoom_level);
448 void OnCreateNewView(const ViewMsg_New_Params& params);
449 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
450 #if defined(ENABLE_PLUGINS)
451 void OnPurgePluginListCache(bool reload_pages);
452 #endif
453 void OnNetworkTypeChanged(net::NetworkChangeNotifier::ConnectionType type);
454 void OnGetAccessibilityTree();
455 void OnTempCrashWithData(const GURL& data);
456 void OnUpdateTimezone();
457 void OnMemoryPressure(
458 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
459 #if defined(OS_ANDROID)
460 void OnSetWebKitSharedTimersSuspended(bool suspend);
461 #endif
462 #if defined(OS_MACOSX)
463 void OnUpdateScrollbarTheme(float initial_button_delay,
464 float autoscroll_button_delay,
465 bool jump_on_track_click,
466 blink::ScrollerStyle preferred_scroller_style,
467 bool redraw);
468 #endif
469 void OnCreateNewSharedWorker(
470 const WorkerProcessMsg_CreateWorker_Params& params);
472 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateOffscreenContext3d();
474 // These objects live solely on the render thread.
475 scoped_ptr<AppCacheDispatcher> appcache_dispatcher_;
476 scoped_ptr<DomStorageDispatcher> dom_storage_dispatcher_;
477 scoped_ptr<IndexedDBDispatcher> main_thread_indexed_db_dispatcher_;
478 scoped_ptr<RendererScheduler> renderer_scheduler_;
479 scoped_ptr<RendererBlinkPlatformImpl> blink_platform_impl_;
480 scoped_ptr<ResourceDispatchThrottler> resource_dispatch_throttler_;
481 scoped_ptr<CacheStorageDispatcher> main_thread_cache_storage_dispatcher_;
482 scoped_ptr<EmbeddedWorkerDispatcher> embedded_worker_dispatcher_;
484 // Used on the render thread and deleted by WebKit at shutdown.
485 blink::WebMediaStreamCenter* media_stream_center_;
487 // Used on the renderer and IPC threads.
488 scoped_refptr<DBMessageFilter> db_message_filter_;
489 scoped_refptr<AudioInputMessageFilter> audio_input_message_filter_;
490 scoped_refptr<AudioMessageFilter> audio_message_filter_;
491 scoped_refptr<MidiMessageFilter> midi_message_filter_;
492 #if defined(OS_ANDROID)
493 scoped_refptr<RendererDemuxerAndroid> renderer_demuxer_;
494 #endif
495 scoped_refptr<DevToolsAgentFilter> devtools_agent_message_filter_;
496 scoped_ptr<V8SamplingProfiler> v8_sampling_profiler_;
498 scoped_ptr<BrowserPluginManager> browser_plugin_manager_;
500 #if defined(ENABLE_WEBRTC)
501 scoped_ptr<PeerConnectionDependencyFactory> peer_connection_factory_;
503 // This is used to communicate to the browser process the status
504 // of all the peer connections created in the renderer.
505 scoped_ptr<PeerConnectionTracker> peer_connection_tracker_;
507 // Dispatches all P2P sockets.
508 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_;
509 #endif
511 // Used on the render thread.
512 scoped_ptr<VideoCaptureImplManager> vc_manager_;
514 // Used for communicating registering AEC dump consumers with the browser and
515 // receving AEC dump file handles when AEC dump is enabled. An AEC dump is
516 // diagnostic audio data for WebRTC stored locally when enabled by the user in
517 // chrome://webrtc-internals.
518 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_;
520 // The count of RenderWidgets running through this thread.
521 int widget_count_;
523 // The count of hidden RenderWidgets running through this thread.
524 int hidden_widget_count_;
526 // The current value of the idle notification timer delay.
527 int64 idle_notification_delay_in_ms_;
529 // The number of idle handler calls that skip sending idle notifications.
530 int idle_notifications_to_skip_;
532 bool suspend_webkit_shared_timer_;
533 bool notify_webkit_of_modal_loop_;
534 bool webkit_shared_timer_suspended_;
536 // The following flag is used to control layout test specific behavior.
537 bool layout_test_mode_;
539 // Timer that periodically calls IdleHandler.
540 base::RepeatingTimer<RenderThreadImpl> idle_timer_;
542 // The channel from the renderer process to the GPU process.
543 scoped_refptr<GpuChannelHost> gpu_channel_;
545 // Cache of variables that are needed on the compositor thread by
546 // GpuChannelHostFactory methods.
547 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
549 // The message loop of the renderer main thread.
550 // This message loop should be destructed before the RenderThreadImpl
551 // shuts down Blink.
552 scoped_ptr<base::MessageLoop> main_message_loop_;
554 // A lazily initiated thread on which file operations are run.
555 scoped_ptr<base::Thread> file_thread_;
557 // May be null if overridden by ContentRendererClient.
558 scoped_ptr<base::Thread> compositor_thread_;
560 // Thread for running multimedia operations (e.g., video decoding).
561 scoped_ptr<base::Thread> media_thread_;
563 // Will point to appropriate MessageLoopProxy after initialization,
564 // regardless of whether |compositor_thread_| is overriden.
565 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy_;
567 // Threads used by compositor for rasterization.
568 ScopedVector<base::SimpleThread> compositor_raster_threads_;
570 base::CancelableCallback<void(const IPC::Message&)> main_input_callback_;
571 scoped_refptr<IPC::MessageFilter> input_event_filter_;
572 scoped_ptr<InputHandlerManager> input_handler_manager_;
573 scoped_refptr<CompositorForwardingMessageFilter> compositor_message_filter_;
575 scoped_refptr<cc_blink::ContextProviderWebContext>
576 shared_main_thread_contexts_;
578 ObserverList<RenderProcessObserver> observers_;
580 scoped_refptr<ContextProviderCommandBuffer> gpu_va_context_provider_;
582 scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_;
583 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_;
585 HistogramCustomizer histogram_customizer_;
587 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
589 #if defined(ENABLE_WEBRTC)
590 scoped_ptr<WebRTCIdentityService> webrtc_identity_service_;
591 #endif
593 scoped_ptr<MemoryObserver> memory_observer_;
595 scoped_refptr<base::SingleThreadTaskRunner>
596 main_thread_compositor_task_runner_;
598 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
600 scoped_ptr<cc::TaskGraphRunner> compositor_task_graph_runner_;
602 // Compositor settings.
603 bool is_gpu_rasterization_enabled_;
604 bool is_gpu_rasterization_forced_;
605 int gpu_rasterization_msaa_sample_count_;
606 bool is_impl_side_painting_enabled_;
607 bool is_lcd_text_enabled_;
608 bool is_distance_field_text_enabled_;
609 bool is_zero_copy_enabled_;
610 bool is_one_copy_enabled_;
611 bool is_elastic_overscroll_enabled_;
612 unsigned use_image_texture_target_;
613 bool is_gather_pixel_refs_enabled_;
615 class PendingRenderFrameConnect
616 : public base::RefCounted<PendingRenderFrameConnect>,
617 public mojo::ErrorHandler {
618 public:
619 PendingRenderFrameConnect(
620 int routing_id,
621 mojo::InterfaceRequest<mojo::ServiceProvider> services,
622 mojo::ServiceProviderPtr exposed_services);
624 mojo::InterfaceRequest<mojo::ServiceProvider>& services() {
625 return services_;
628 mojo::ServiceProviderPtr& exposed_services() { return exposed_services_; }
630 private:
631 friend class base::RefCounted<PendingRenderFrameConnect>;
633 ~PendingRenderFrameConnect() override;
635 void OnConnectionError() override;
637 int routing_id_;
638 mojo::InterfaceRequest<mojo::ServiceProvider> services_;
639 mojo::ServiceProviderPtr exposed_services_;
642 typedef std::map<int, scoped_refptr<PendingRenderFrameConnect>>
643 PendingRenderFrameConnectMap;
644 PendingRenderFrameConnectMap pending_render_frame_connects_;
646 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
649 #if defined(COMPILER_MSVC)
650 #pragma warning(pop)
651 #endif
653 } // namespace content
655 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_