Fix a couple bugs in the settings_page_header wrt breadcrumbs.
[chromium-blink-merge.git] / content / renderer / render_thread_impl.h
blob0c8ee8f45cf5ec140a90c2e877f4c8489f0f7729
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 WorkerProcessMsg_CreateWorker_Params;
42 namespace blink {
43 class WebGamepads;
44 class WebGraphicsContext3D;
45 class WebMediaStreamCenter;
46 class WebMediaStreamCenterClient;
49 namespace base {
50 class SingleThreadTaskRunner;
51 class Thread;
54 namespace cc {
55 class ContextProvider;
56 class TaskGraphRunner;
59 namespace cc_blink {
60 class ContextProviderWebContext;
63 namespace IPC {
64 class MessageFilter;
67 namespace media {
68 class AudioHardwareConfig;
69 class GpuVideoAcceleratorFactories;
72 namespace scheduler {
73 class RendererScheduler;
76 namespace v8 {
77 class Extension;
80 namespace content {
82 class AppCacheDispatcher;
83 class AecDumpMessageFilter;
84 class AudioInputMessageFilter;
85 class AudioMessageFilter;
86 class AudioRendererMixerManager;
87 class BrowserPluginManager;
88 class CacheStorageDispatcher;
89 class CompositorForwardingMessageFilter;
90 class ContextProviderCommandBuffer;
91 class DBMessageFilter;
92 class DevToolsAgentFilter;
93 class DomStorageDispatcher;
94 class EmbeddedWorkerDispatcher;
95 class GpuChannelHost;
96 class IndexedDBDispatcher;
97 class InputHandlerManager;
98 class MediaStreamCenter;
99 class MemoryObserver;
100 class MidiMessageFilter;
101 class NetInfoDispatcher;
102 class P2PSocketDispatcher;
103 class PeerConnectionDependencyFactory;
104 class PeerConnectionTracker;
105 class RenderProcessObserver;
106 class RendererBlinkPlatformImpl;
107 class RendererDemuxerAndroid;
108 class ResourceDispatchThrottler;
109 class ResourceSchedulingFilter;
110 class V8SamplingProfiler;
111 class VideoCaptureImplManager;
112 class WebGraphicsContext3DCommandBufferImpl;
113 class WebRTCIdentityService;
115 #if defined(COMPILER_MSVC)
116 // See explanation for other RenderViewHostImpl which is the same issue.
117 #pragma warning(push)
118 #pragma warning(disable: 4250)
119 #endif
121 // The RenderThreadImpl class represents a background thread where RenderView
122 // instances live. The RenderThread supports an API that is used by its
123 // consumer to talk indirectly to the RenderViews and supporting objects.
124 // Likewise, it provides an API for the RenderViews to talk back to the main
125 // process (i.e., their corresponding WebContentsImpl).
127 // Most of the communication occurs in the form of IPC messages. They are
128 // routed to the RenderThread according to the routing IDs of the messages.
129 // The routing IDs correspond to RenderView instances.
130 class CONTENT_EXPORT RenderThreadImpl
131 : public RenderThread,
132 public ChildThreadImpl,
133 public GpuChannelHostFactory,
134 NON_EXPORTED_BASE(public CompositorDependencies) {
135 public:
136 static RenderThreadImpl* current();
138 explicit RenderThreadImpl(const InProcessChildThreadParams& params);
139 explicit RenderThreadImpl(scoped_ptr<base::MessageLoop> main_message_loop);
140 ~RenderThreadImpl() override;
141 void Shutdown() override;
143 // When initializing WebKit, ensure that any schemes needed for the content
144 // module are registered properly. Static to allow sharing with tests.
145 static void RegisterSchemes();
147 // Notify V8 that the date/time configuration of the system might have
148 // changed.
149 static void NotifyTimezoneChange();
151 // RenderThread implementation:
152 bool Send(IPC::Message* msg) override;
153 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
154 IPC::SyncChannel* GetChannel() override;
155 std::string GetLocale() override;
156 IPC::SyncMessageFilter* GetSyncMessageFilter() override;
157 scoped_refptr<base::SingleThreadTaskRunner> GetIOMessageLoopProxy() override;
158 void AddRoute(int32 routing_id, IPC::Listener* listener) override;
159 void RemoveRoute(int32 routing_id) override;
160 int GenerateRoutingID() override;
161 void AddFilter(IPC::MessageFilter* filter) override;
162 void RemoveFilter(IPC::MessageFilter* filter) override;
163 void AddObserver(RenderProcessObserver* observer) override;
164 void RemoveObserver(RenderProcessObserver* observer) override;
165 void SetResourceDispatcherDelegate(
166 ResourceDispatcherDelegate* delegate) override;
167 void EnsureWebKitInitialized() override;
168 void RecordAction(const base::UserMetricsAction& action) override;
169 void RecordComputedAction(const std::string& action) override;
170 scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer(
171 size_t buffer_size) override;
172 cc::SharedBitmapManager* GetSharedBitmapManager() override;
173 void RegisterExtension(v8::Extension* extension) override;
174 void ScheduleIdleHandler(int64 initial_delay_ms) override;
175 void IdleHandler() override;
176 int64 GetIdleNotificationDelayInMs() const override;
177 void SetIdleNotificationDelayInMs(
178 int64 idle_notification_delay_in_ms) override;
179 void UpdateHistograms(int sequence_number) override;
180 int PostTaskToAllWebWorkers(const base::Closure& closure) override;
181 bool ResolveProxy(const GURL& url, std::string* proxy_list) override;
182 base::WaitableEvent* GetShutdownEvent() override;
183 ServiceRegistry* GetServiceRegistry() override;
185 // CompositorDependencies implementation.
186 bool IsImplSidePaintingEnabled() override;
187 bool IsGpuRasterizationForced() override;
188 bool IsGpuRasterizationEnabled() override;
189 int GetGpuRasterizationMSAASampleCount() override;
190 bool IsLcdTextEnabled() override;
191 bool IsDistanceFieldTextEnabled() override;
192 bool IsZeroCopyEnabled() override;
193 bool IsOneCopyEnabled() override;
194 bool IsElasticOverscrollEnabled() override;
195 uint32 GetImageTextureTarget() override;
196 scoped_refptr<base::SingleThreadTaskRunner>
197 GetCompositorMainThreadTaskRunner() override;
198 scoped_refptr<base::SingleThreadTaskRunner>
199 GetCompositorImplThreadTaskRunner() override;
200 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
201 scheduler::RendererScheduler* GetRendererScheduler() override;
202 cc::ContextProvider* GetSharedMainThreadContextProvider() override;
203 scoped_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource(
204 int routing_id) override;
205 cc::TaskGraphRunner* GetTaskGraphRunner() override;
206 bool IsGatherPixelRefsEnabled() override;
208 // Synchronously establish a channel to the GPU plugin if not previously
209 // established or if it has been lost (for example if the GPU plugin crashed).
210 // If there is a pending asynchronous request, it will be completed by the
211 // time this routine returns.
212 GpuChannelHost* EstablishGpuChannelSync(CauseForGpuLaunch);
215 // This method modifies how the next message is sent. Normally, when sending
216 // a synchronous message that runs a nested message loop, we need to suspend
217 // callbacks into WebKit. This involves disabling timers and deferring
218 // resource loads. However, there are exceptions when we need to customize
219 // the behavior.
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::SingleThreadTaskRunner> compositor_task_runner() const {
247 return compositor_task_runner_;
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 SingleThreadTaskRunner 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::SingleThreadTaskRunner> 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 // Note: A widget must not be hidden when it is destroyed - ensure that
405 // WidgetRestored is called before WidgetDestroyed for any hidden widget.
406 void WidgetDestroyed();
407 void WidgetHidden();
408 void WidgetRestored();
410 void AddEmbeddedWorkerRoute(int32 routing_id, IPC::Listener* listener);
411 void RemoveEmbeddedWorkerRoute(int32 routing_id);
413 void RegisterPendingRenderFrameConnect(
414 int routing_id,
415 mojo::InterfaceRequest<mojo::ServiceProvider> services,
416 mojo::ServiceProviderPtr exposed_services);
418 protected:
419 virtual void SetResourceDispatchTaskQueue(
420 const scoped_refptr<base::SingleThreadTaskRunner>& resource_task_queue);
422 private:
423 // ChildThread
424 bool OnControlMessageReceived(const IPC::Message& msg) override;
426 // GpuChannelHostFactory implementation:
427 bool IsMainThread() override;
428 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
429 scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) override;
430 CreateCommandBufferResult CreateViewCommandBuffer(
431 int32 surface_id,
432 const GPUCreateCommandBufferConfig& init_params,
433 int32 route_id) override;
435 void Init();
437 void OnCreateNewFrame(FrameMsg_NewFrame_Params params);
438 void OnCreateNewFrameProxy(int routing_id,
439 int parent_routing_id,
440 int render_view_routing_id,
441 const FrameReplicationState& replicated_state);
442 void OnSetZoomLevelForCurrentURL(const std::string& scheme,
443 const std::string& host,
444 double zoom_level);
445 void OnCreateNewView(const ViewMsg_New_Params& params);
446 void OnTransferBitmap(const SkBitmap& bitmap, int resource_id);
447 #if defined(ENABLE_PLUGINS)
448 void OnPurgePluginListCache(bool reload_pages);
449 #endif
450 void OnNetworkTypeChanged(net::NetworkChangeNotifier::ConnectionType type);
451 void OnGetAccessibilityTree();
452 void OnTempCrashWithData(const GURL& data);
453 void OnUpdateTimezone(const std::string& zoneId);
454 void OnMemoryPressure(
455 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
456 #if defined(OS_ANDROID)
457 void OnSetWebKitSharedTimersSuspended(bool suspend);
458 #endif
459 #if defined(OS_MACOSX)
460 void OnUpdateScrollbarTheme(float initial_button_delay,
461 float autoscroll_button_delay,
462 bool jump_on_track_click,
463 blink::ScrollerStyle preferred_scroller_style,
464 bool redraw);
465 #endif
466 void OnCreateNewSharedWorker(
467 const WorkerProcessMsg_CreateWorker_Params& params);
468 bool RendererIsHidden() const;
469 void OnRendererHidden();
470 void OnRendererVisible();
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<scheduler::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 notify_webkit_of_modal_loop_;
533 bool webkit_shared_timer_suspended_;
535 // The following flag is used to control layout test specific behavior.
536 bool layout_test_mode_;
538 // Timer that periodically calls IdleHandler.
539 base::RepeatingTimer<RenderThreadImpl> idle_timer_;
541 // The channel from the renderer process to the GPU process.
542 scoped_refptr<GpuChannelHost> gpu_channel_;
544 // Cache of variables that are needed on the compositor thread by
545 // GpuChannelHostFactory methods.
546 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
548 // The message loop of the renderer main thread.
549 // This message loop should be destructed before the RenderThreadImpl
550 // shuts down Blink.
551 scoped_ptr<base::MessageLoop> main_message_loop_;
553 // A lazily initiated thread on which file operations are run.
554 scoped_ptr<base::Thread> file_thread_;
556 // May be null if overridden by ContentRendererClient.
557 scoped_ptr<base::Thread> compositor_thread_;
559 // Thread for running multimedia operations (e.g., video decoding).
560 scoped_ptr<base::Thread> media_thread_;
562 // Will point to appropriate task runner after initialization,
563 // regardless of whether |compositor_thread_| is overriden.
564 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
566 // Threads used by compositor for rasterization.
567 ScopedVector<base::SimpleThread> compositor_raster_threads_;
569 base::CancelableCallback<void(const IPC::Message&)> main_input_callback_;
570 scoped_refptr<IPC::MessageFilter> input_event_filter_;
571 scoped_ptr<InputHandlerManager> input_handler_manager_;
572 scoped_refptr<CompositorForwardingMessageFilter> compositor_message_filter_;
574 scoped_refptr<cc_blink::ContextProviderWebContext>
575 shared_main_thread_contexts_;
577 base::ObserverList<RenderProcessObserver> observers_;
579 scoped_refptr<ContextProviderCommandBuffer> gpu_va_context_provider_;
581 scoped_ptr<AudioRendererMixerManager> audio_renderer_mixer_manager_;
582 scoped_ptr<media::AudioHardwareConfig> audio_hardware_config_;
584 HistogramCustomizer histogram_customizer_;
586 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
588 #if defined(ENABLE_WEBRTC)
589 scoped_ptr<WebRTCIdentityService> webrtc_identity_service_;
590 #endif
592 scoped_ptr<MemoryObserver> memory_observer_;
594 scoped_refptr<base::SingleThreadTaskRunner>
595 main_thread_compositor_task_runner_;
597 scoped_refptr<ResourceSchedulingFilter> resource_scheduling_filter_;
599 scoped_ptr<cc::TaskGraphRunner> compositor_task_graph_runner_;
601 // Compositor settings.
602 bool is_gpu_rasterization_enabled_;
603 bool is_gpu_rasterization_forced_;
604 int gpu_rasterization_msaa_sample_count_;
605 bool is_impl_side_painting_enabled_;
606 bool is_lcd_text_enabled_;
607 bool is_distance_field_text_enabled_;
608 bool is_zero_copy_enabled_;
609 bool is_one_copy_enabled_;
610 bool is_elastic_overscroll_enabled_;
611 unsigned use_image_texture_target_;
612 bool is_gather_pixel_refs_enabled_;
614 class PendingRenderFrameConnect
615 : public base::RefCounted<PendingRenderFrameConnect>,
616 public mojo::ErrorHandler {
617 public:
618 PendingRenderFrameConnect(
619 int routing_id,
620 mojo::InterfaceRequest<mojo::ServiceProvider> services,
621 mojo::ServiceProviderPtr exposed_services);
623 mojo::InterfaceRequest<mojo::ServiceProvider>& services() {
624 return services_;
627 mojo::ServiceProviderPtr& exposed_services() { return exposed_services_; }
629 private:
630 friend class base::RefCounted<PendingRenderFrameConnect>;
632 ~PendingRenderFrameConnect() override;
634 void OnConnectionError() override;
636 int routing_id_;
637 mojo::InterfaceRequest<mojo::ServiceProvider> services_;
638 mojo::ServiceProviderPtr exposed_services_;
641 typedef std::map<int, scoped_refptr<PendingRenderFrameConnect>>
642 PendingRenderFrameConnectMap;
643 PendingRenderFrameConnectMap pending_render_frame_connects_;
645 DISALLOW_COPY_AND_ASSIGN(RenderThreadImpl);
648 #if defined(COMPILER_MSVC)
649 #pragma warning(pop)
650 #endif
652 } // namespace content
654 #endif // CONTENT_RENDERER_RENDER_THREAD_IMPL_H_