15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <map> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <queue> 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 13f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "base/observer_list.h" 14a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "base/process/process.h" 15eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/timer/timer.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/browser/child_process_launcher.h" 1746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#include "content/browser/dom_storage/session_storage_namespace_impl.h" 18a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#include "content/browser/power_monitor_message_broadcaster.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/common/content_export.h" 20116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "content/common/mojo/service_registry_impl.h" 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/public/browser/gpu_data_manager_observer.h" 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/render_process_host.h" 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ipc/ipc_channel_proxy.h" 245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ipc/ipc_platform_file.h" 250de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles)#include "mojo/public/cpp/bindings/interface_ptr.h" 265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/gfx/gpu_memory_buffer.h" 27effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 28c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)namespace base { 29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class CommandLine; 30c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class MessageLoop; 31c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)} 32c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace gfx { 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Size; 351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci} 361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccinamespace IPC { 381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass ChannelMojoHost; 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content { 421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class AudioRendererHost; 431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass BrowserCdmManager; 4468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)class BrowserDemuxerAndroid; 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GpuMessageFilter; 464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class MessagePortMessageFilter; 476e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)class MojoApplicationHost; 4846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#if defined(ENABLE_WEBRTC) 4946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)class P2PSocketDispatcherHost; 5046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)#endif 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class PeerConnectionTrackerHost; 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RendererMainThread; 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RenderWidgetHelper; 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RenderWidgetHost; 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RenderWidgetHostImpl; 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class RenderWidgetHostViewFrameSubscriber; 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StoragePartition; 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StoragePartitionImpl; 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 600529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochtypedef base::Thread* (*RendererMainThreadFactoryFunction)( 610529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch const std::string& id); 620529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Implements a concrete RenderProcessHost for the browser process for talking 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// to actual renderer processes (as opposed to mocks). 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Represents the browser side of the browser <--> renderer communication 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// channel. There will be one RenderProcessHost per renderer process. 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This object is refcounted so that it can release its resources when all 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// hosts using it go away. 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This object communicates back and forth with the RenderProcess object 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// running in the renderer process. Each RenderProcessHost and RenderProcess 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// keeps a list of RenderView (renderer) and WebContentsImpl (browser) which 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// are correlated with IDs. This way, the Views and the corresponding ViewHosts 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// communicate through the two process objects. 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// A RenderProcessHost is also associated with one and only one 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// StoragePartition. This allows us to implement strong storage isolation 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// because all the IPCs from the RenderViews (renderer) will only ever be able 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// to access the partition they are assigned to. 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class CONTENT_EXPORT RenderProcessHostImpl 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) : public RenderProcessHost, 84868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public ChildProcessLauncher::Client, 85868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public GpuDataManagerObserver { 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) RenderProcessHostImpl(BrowserContext* browser_context, 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) StoragePartitionImpl* storage_partition_impl, 89cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool is_isolated_guest); 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~RenderProcessHostImpl(); 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // RenderProcessHost implementation (public portion). 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void EnableSendQueue() OVERRIDE; 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool Init() OVERRIDE; 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual int GetNextRoutingID() OVERRIDE; 96eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual void AddRoute(int32 routing_id, IPC::Listener* listener) OVERRIDE; 97eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch virtual void RemoveRoute(int32 routing_id) OVERRIDE; 98f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void AddObserver(RenderProcessHostObserver* observer) OVERRIDE; 99f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void RemoveObserver(RenderProcessHostObserver* observer) OVERRIDE; 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ReceivedBadMessage() OVERRIDE; 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void WidgetRestored() OVERRIDE; 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void WidgetHidden() OVERRIDE; 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual int VisibleWidgetCount() const OVERRIDE; 104cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsIsolatedGuest() const OVERRIDE; 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual StoragePartition* GetStoragePartition() const OVERRIDE; 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool FastShutdownIfPossible() OVERRIDE; 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void DumpHandles() OVERRIDE; 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual base::ProcessHandle GetHandle() const OVERRIDE; 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual BrowserContext* GetBrowserContext() const OVERRIDE; 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool InSameStoragePartition( 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) StoragePartition* partition) const OVERRIDE; 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual int GetID() const OVERRIDE; 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool HasConnection() const OVERRIDE; 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetIgnoreInputEvents(bool ignore_input_events) OVERRIDE; 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool IgnoreInputEvents() const OVERRIDE; 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void Cleanup() OVERRIDE; 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void AddPendingView() OVERRIDE; 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void RemovePendingView() OVERRIDE; 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void SetSuddenTerminationAllowed(bool enabled) OVERRIDE; 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool SuddenTerminationAllowed() const OVERRIDE; 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual IPC::ChannelProxy* GetChannel() OVERRIDE; 1224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) virtual void AddFilter(BrowserMessageFilter* filter) OVERRIDE; 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool FastShutdownForPageCount(size_t count) OVERRIDE; 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool FastShutdownStarted() const OVERRIDE; 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual base::TimeDelta GetChildProcessIdleTime() const OVERRIDE; 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ResumeRequestsForView(int route_id) OVERRIDE; 1275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void FilterURL(bool empty_allowed, GURL* url) OVERRIDE; 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(ENABLE_WEBRTC) 1295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void EnableAecDump(const base::FilePath& file) OVERRIDE; 1305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void DisableAecDump() OVERRIDE; 1315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void SetWebRtcLogMessageCallback( 1325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Callback<void(const std::string&)> callback) OVERRIDE; 13346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) virtual WebRtcStopRtpDumpCallback StartRtpDump( 13446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) bool incoming, 13546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) bool outgoing, 13646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) const WebRtcRtpPacketCallback& packet_callback) OVERRIDE; 1375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif 1385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void ResumeDeferredNavigation(const GlobalRequestID& request_id) 1395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) OVERRIDE; 140a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void NotifyTimezoneChange() OVERRIDE; 141116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch virtual ServiceRegistry* GetServiceRegistry() OVERRIDE; 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // IPC::Sender via RenderProcessHost. 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool Send(IPC::Message* msg) OVERRIDE; 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // IPC::Listener via RenderProcessHost. 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void OnChannelError() OVERRIDE; 150cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void OnBadMessageReceived(const IPC::Message& message) OVERRIDE; 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // ChildProcessLauncher::Client implementation. 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void OnProcessLaunched() OVERRIDE; 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1551e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) scoped_refptr<AudioRendererHost> audio_renderer_host() const; 1561e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Call this function when it is evident that the child process is actively 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // performing some operation, for example if we just received an IPC message. 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void mark_child_process_activity_time() { 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) child_process_activity_time_ = base::TimeTicks::Now(); 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the current number of active views in this process. Excludes 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // any RenderViewHosts that are swapped out. 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetActiveViewCount(); 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Start and end frame subscription for a specific renderer. 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // This API only supports subscription to accelerated composited frames. 1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void BeginFrameSubscription( 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int route_id, 1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber); 1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void EndFrameSubscription(int route_id); 1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(ENABLE_WEBRTC) 1755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Fires the webrtc log message callback with |message|, if callback is set. 1765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void WebRtcLogMessage(const std::string& message); 1775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif 1785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 17946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) // Used to extend the lifetime of the sessions until the render view 18046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) // in the renderer is fully closed. This is static because its also called 18146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) // with mock hosts as input in test cases. 18246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) static void ReleaseOnCloseACK( 18346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) RenderProcessHost* host, 18446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) const SessionStorageNamespaceMap& sessions, 18546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) int view_route_id); 18646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Register/unregister the host identified by the host id in the global host 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // list. 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static void RegisterHost(int host_id, RenderProcessHost* host); 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static void UnregisterHost(int host_id); 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Implementation of FilterURL below that can be shared with the mock class. 1935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) static void FilterURL(RenderProcessHost* rph, bool empty_allowed, GURL* url); 1945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if |host| is suitable for launching a new view with |site_url| 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // in the given |browser_context|. 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static bool IsSuitableHost(RenderProcessHost* host, 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BrowserContext* browser_context, 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const GURL& site_url); 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns an existing RenderProcessHost for |url| in |browser_context|, 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // if one exists. Otherwise a new RenderProcessHost should be created and 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // registered using RegisterProcessHostForSite(). 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // This should only be used for process-per-site mode, which can be enabled 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // globally with a command line flag or per-site, as determined by 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // SiteInstanceImpl::ShouldUseProcessPerSite. 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static RenderProcessHost* GetProcessHostForSite( 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BrowserContext* browser_context, 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const GURL& url); 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Registers the given |process| to be used for any instance of |url| 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // within |browser_context|. 2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // This should only be used for process-per-site mode, which can be enabled 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // globally with a command line flag or per-site, as determined by 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // SiteInstanceImpl::ShouldUseProcessPerSite. 2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) static void RegisterProcessHostForSite( 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BrowserContext* browser_context, 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) RenderProcessHost* process, 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const GURL& url); 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 221c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) static base::MessageLoop* GetInProcessRendererThreadForTesting(); 222c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 223f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // This forces a renderer that is running "in process" to shut down. 224f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) static void ShutDownInProcessRenderer(); 225f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 2260529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch static void RegisterRendererMainThreadFactory( 2270529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch RendererMainThreadFactoryFunction create); 2280529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch 22968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#if defined(OS_ANDROID) 23068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) const scoped_refptr<BrowserDemuxerAndroid>& browser_demuxer_android() { 23168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) return browser_demuxer_android_; 23268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) } 23368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#endif 23468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 2351320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#if defined(ENABLE_BROWSER_CDMS) 2361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const scoped_refptr<BrowserCdmManager>& browser_cdm_manager() { 2371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return browser_cdm_manager_; 2381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci } 2391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif 2401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) MessagePortMessageFilter* message_port_message_filter() const { 2421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci return message_port_message_filter_.get(); 2438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) } 2448bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) 245cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void set_is_isolated_guest_for_testing(bool is_isolated_guest) { 246cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) is_isolated_guest_ = is_isolated_guest; 2475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) } 2485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 249a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // Called when the existence of the other renderer process which is connected 250a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // to the Worker in this renderer process has changed. 251a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) // It is only called when "enable-embedded-shared-worker" flag is set. 252a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void IncrementWorkerRefCount(); 253a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void DecrementWorkerRefCount(); 254a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 255116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Call this function to resume the navigation when it was deferred 256116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // immediately after receiving response headers. 257116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch void ResumeResponseDeferredAtStart(const GlobalRequestID& request_id); 258116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 259116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Activates Mojo for this process. Does nothing if Mojo is already activated. 260116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch void EnsureMojoActivated(); 2610de6073388f4e2780db8536178b129cd8f6ab386Torne (Richard Coles) 2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // A proxy for our IPC::Channel that lives on the IO thread (see 2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // browser_process.h) 2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<IPC::ChannelProxy> channel_; 2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2671320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // A host object ChannelMojo needs. The lifetime is bound to 2681320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // the RenderProcessHostImpl, not the channel. 2691320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci scoped_ptr<IPC::ChannelMojoHost> channel_mojo_host_; 2701320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if fast shutdown has been performed on this RPH. 2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool fast_shutdown_started_; 2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if we've posted a DeleteTask and will be deleted soon. 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool deleting_soon_; 2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 277f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#ifndef NDEBUG 278f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // True if this object has deleted itself. 279f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) bool is_self_deleted_; 280f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#endif 281f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The count of currently swapped out but pending RenderViews. We have 2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // started to swap these in, so the renderer process should not exit if 2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // this count is non-zero. 2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32 pending_views_; 2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) friend class VisitRelayingRenderProcessHost; 2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2905c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu void MaybeActivateMojo(); 2915f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) bool ShouldUseMojoChannel() const; 2925f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) scoped_ptr<IPC::ChannelProxy> CreateChannelProxy( 2935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) const std::string& channel_id); 2945c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu 2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Creates and adds the IO thread message filters. 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void CreateMessageFilters(); 2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Control message handlers. 2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void OnShutdownRequest(); 3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void OnDumpHandlesDone(); 3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SuddenTerminationChanged(bool enabled); 3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void OnUserMetricsRecordAction(const std::string& action); 3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void OnSavedPageAsMHTML(int job_id, int64 mhtml_file_size); 30446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) void OnCloseACK(int old_route_id); 3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Generates a command line to be used to spawn a renderer and appends the 3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // results to |*command_line|. 308a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void AppendRendererCommandLine(base::CommandLine* command_line) const; 3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Copies applicable command line switches from the given |browser_cmd| line 3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // flags to the output |renderer_cmd| line flags. Not all switches will be 3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // copied over. 313a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) void PropagateBrowserCommandLineToRenderer( 314a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) const base::CommandLine& browser_cmd, 315a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) base::CommandLine* renderer_cmd) const; 3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Callers can reduce the RenderProcess' priority. 3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetBackgrounded(bool backgrounded); 3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Handle termination of our process. 3212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void ProcessDied(bool already_dead); 3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 323868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual void OnGpuSwitching() OVERRIDE; 324868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 3255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(ENABLE_WEBRTC) 326f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void OnRegisterAecDumpConsumer(int id); 327f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void OnUnregisterAecDumpConsumer(int id); 328f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void RegisterAecDumpConsumerOnUIThread(int id); 329f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void UnregisterAecDumpConsumerOnUIThread(int id); 330f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void EnableAecDumpForId(const base::FilePath& file, int id); 3315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Sends |file_for_transit| to the render process. 332f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) void SendAecDumpFileToRenderer(int id, 333f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) IPC::PlatformFileForTransit file_for_transit); 3345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void SendDisableAecDumpToRenderer(); 3355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif 3365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3375c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu scoped_ptr<MojoApplicationHost> mojo_application_host_; 3385c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu bool mojo_activation_required_; 3395c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu 340eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // The registered IPC listener objects. When this list is empty, we should 341eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // delete ourselves. 342eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch IDMap<IPC::Listener> listeners_; 343eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The count of currently visible widgets. Since the host can be a container 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // for multiple widgets, it uses this count to determine when it should be 3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // backgrounded. 3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int32 visible_widgets_; 3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Does this process have backgrounded priority. 3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool backgrounded_; 3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to allow a RenderWidgetHost to intercept various messages on the 3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // IO thread. 3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_refptr<RenderWidgetHelper> widget_helper_; 3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The filter for GPU-related messages coming from the renderer. 3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Thread safety note: this field is to be accessed from the UI thread. 3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // We don't keep a reference to it, to avoid it being destroyed on the UI 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // thread, but we clear this field when we clear channel_. When channel_ goes 3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // away, it posts a task to the IO thread to destroy it there, so we know that 3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // it's valid if non-NULL. 3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GpuMessageFilter* gpu_message_filter_; 3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3644e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // The filter for MessagePort messages coming from the renderer. 3654e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) scoped_refptr<MessagePortMessageFilter> message_port_message_filter_; 3664e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used in single-process mode. 3683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) scoped_ptr<base::Thread> in_process_renderer_; 3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True after Init() has been called. We can't just check channel_ because we 3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // also reset that in the case of process termination. 3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool is_initialized_; 3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to launch and terminate the process without blocking the UI thread. 3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<ChildProcessLauncher> child_process_launcher_; 3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Messages we queue while waiting for the process handle. We queue them here 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // instead of in the channel so that we ensure they're sent after init related 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // messages that are sent once the process handle is available. This is 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // because the queued messages may have dependencies on the init messages. 3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::queue<IPC::Message*> queued_messages_; 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The globally-unique identifier for this RPH. 3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int id_; 3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BrowserContext* browser_context_; 3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Owned by |browser_context_|. 3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) StoragePartitionImpl* storage_partition_impl_; 3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 391f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // The observers watching our lifetime. 392f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) ObserverList<RenderProcessHostObserver> observers_; 393f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if the process can be shut down suddenly. If this is true, then we're 3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // sure that all the RenderViews in the process can be shutdown suddenly. If 3965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // it's false, then specific RenderViews might still be allowed to be shutdown 3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // suddenly by checking their SuddenTerminationAllowed() flag. This can occur 3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // if one WebContents has an unload event listener but another WebContents in 3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the same process doesn't. 4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool sudden_termination_allowed_; 4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Set to true if we shouldn't send input events. We actually do the 4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // filtering for this at the render widget level. 4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ignore_input_events_; 4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Records the last time we regarded the child process active. 4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) base::TimeTicks child_process_activity_time_; 4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Indicates whether this is a RenderProcessHost of a Browser Plugin guest 4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // renderer. 411cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool is_isolated_guest_; 4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Forwards messages between WebRTCInternals in the browser process 4142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // and PeerConnectionTracker in the renderer process. 4152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) scoped_refptr<PeerConnectionTrackerHost> peer_connection_tracker_host_; 4162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 417868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Prevents the class from being added as a GpuDataManagerImpl observer more 418868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // than once. 419868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool gpu_observer_registered_; 420868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 4215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Set if a call to Cleanup is required once the RenderProcessHostImpl is no 4225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // longer within the RenderProcessHostObserver::RenderProcessExited callbacks. 4235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool delayed_cleanup_needed_; 4245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 4255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Indicates whether RenderProcessHostImpl is currently iterating and calling 4265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // through RenderProcessHostObserver::RenderProcessExited. 4275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool within_process_died_observer_; 4285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 429a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) // Forwards power state messages to the renderer process. 430a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) PowerMonitorMessageBroadcaster power_monitor_broadcaster_; 431a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 4321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) scoped_refptr<AudioRendererHost> audio_renderer_host_; 4331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 43468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#if defined(OS_ANDROID) 43568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) scoped_refptr<BrowserDemuxerAndroid> browser_demuxer_android_; 43668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#endif 43768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 4381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#if defined(ENABLE_BROWSER_CDMS) 4391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci scoped_refptr<BrowserCdmManager> browser_cdm_manager_; 4401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#endif 4411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 4425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(ENABLE_WEBRTC) 4435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::Callback<void(const std::string&)> webrtc_log_message_callback_; 44446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) 44546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) scoped_refptr<P2PSocketDispatcherHost> p2p_socket_dispatcher_host_; 44646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) 447f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // Must be accessed on UI thread. 448f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) std::vector<int> aec_dump_consumers_; 449f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 45046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) WebRtcStopRtpDumpCallback stop_rtp_dump_callback_; 4515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif 4525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 453a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) int worker_ref_count_; 454a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 455effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch // Records the time when the process starts surviving for workers for UMA. 456effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch base::TimeTicks survive_for_worker_start_time_; 457effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch 45823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) base::WeakPtrFactory<RenderProcessHostImpl> weak_factory_; 45923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles) 4605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(RenderProcessHostImpl); 4615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace content 4645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_IMPL_H_ 466