OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <queue> | 10 #include <queue> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual int GetNextRoutingID(); | 51 virtual int GetNextRoutingID(); |
52 virtual void CancelResourceRequests(int render_widget_id); | 52 virtual void CancelResourceRequests(int render_widget_id); |
53 virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); | 53 virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); |
54 virtual bool WaitForUpdateMsg(int render_widget_id, | 54 virtual bool WaitForUpdateMsg(int render_widget_id, |
55 const base::TimeDelta& max_delay, | 55 const base::TimeDelta& max_delay, |
56 IPC::Message* msg); | 56 IPC::Message* msg); |
57 virtual void ReceivedBadMessage(); | 57 virtual void ReceivedBadMessage(); |
58 virtual void WidgetRestored(); | 58 virtual void WidgetRestored(); |
59 virtual void WidgetHidden(); | 59 virtual void WidgetHidden(); |
60 virtual int VisibleWidgetCount() const; | 60 virtual int VisibleWidgetCount() const; |
| 61 virtual void AddPendingView(); |
| 62 virtual void RemovePendingView(); |
61 virtual bool FastShutdownIfPossible(); | 63 virtual bool FastShutdownIfPossible(); |
62 virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms); | 64 virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms); |
63 virtual base::ProcessHandle GetHandle(); | 65 virtual base::ProcessHandle GetHandle(); |
64 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); | 66 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); |
65 | 67 |
66 // IPC::Channel::Sender via RenderProcessHost. | 68 // IPC::Channel::Sender via RenderProcessHost. |
67 virtual bool Send(IPC::Message* msg); | 69 virtual bool Send(IPC::Message* msg); |
68 | 70 |
69 // IPC::Channel::Listener via RenderProcessHost. | 71 // IPC::Channel::Listener via RenderProcessHost. |
70 virtual bool OnMessageReceived(const IPC::Message& msg); | 72 virtual bool OnMessageReceived(const IPC::Message& msg); |
71 virtual void OnChannelConnected(int32 peer_pid); | 73 virtual void OnChannelConnected(int32 peer_pid); |
72 virtual void OnChannelError(); | 74 virtual void OnChannelError(); |
73 | 75 |
74 // ChildProcessLauncher::Client implementation. | 76 // ChildProcessLauncher::Client implementation. |
75 virtual void OnProcessLaunched(); | 77 virtual void OnProcessLaunched(); |
76 | 78 |
77 private: | 79 private: |
78 friend class VisitRelayingRenderProcessHost; | 80 friend class VisitRelayingRenderProcessHost; |
79 | 81 |
80 // Creates and adds the IO thread message filters. | 82 // Creates and adds the IO thread message filters. |
81 void CreateMessageFilters(); | 83 void CreateMessageFilters(); |
82 | 84 |
83 // Control message handlers. | 85 // Control message handlers. |
| 86 void OnShutdownRequest(); |
84 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); | 87 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); |
85 void SuddenTerminationChanged(bool enabled); | 88 void SuddenTerminationChanged(bool enabled); |
86 void OnUserMetricsRecordAction(const std::string& action); | 89 void OnUserMetricsRecordAction(const std::string& action); |
87 | 90 |
88 // Generates a command line to be used to spawn a renderer and appends the | 91 // Generates a command line to be used to spawn a renderer and appends the |
89 // results to |*command_line|. | 92 // results to |*command_line|. |
90 void AppendRendererCommandLine(CommandLine* command_line) const; | 93 void AppendRendererCommandLine(CommandLine* command_line) const; |
91 | 94 |
92 // Copies applicable command line switches from the given |browser_cmd| line | 95 // Copies applicable command line switches from the given |browser_cmd| line |
93 // flags to the output |renderer_cmd| line flags. Not all switches will be | 96 // flags to the output |renderer_cmd| line flags. Not all switches will be |
94 // copied over. | 97 // copied over. |
95 void PropagateBrowserCommandLineToRenderer(const CommandLine& browser_cmd, | 98 void PropagateBrowserCommandLineToRenderer(const CommandLine& browser_cmd, |
96 CommandLine* renderer_cmd) const; | 99 CommandLine* renderer_cmd) const; |
97 | 100 |
98 // Callers can reduce the RenderProcess' priority. | 101 // Callers can reduce the RenderProcess' priority. |
99 void SetBackgrounded(bool backgrounded); | 102 void SetBackgrounded(bool backgrounded); |
100 | 103 |
101 // The count of currently visible widgets. Since the host can be a container | 104 // The count of currently visible widgets. Since the host can be a container |
102 // for multiple widgets, it uses this count to determine when it should be | 105 // for multiple widgets, it uses this count to determine when it should be |
103 // backgrounded. | 106 // backgrounded. |
104 int32 visible_widgets_; | 107 int32 visible_widgets_; |
105 | 108 |
| 109 // The count of currently swapped out but pending RenderViews. We have |
| 110 // started to swap these in, so the renderer process should not exit if |
| 111 // this count is non-zero. |
| 112 int32 pending_views_; |
| 113 |
106 // Does this process have backgrounded priority. | 114 // Does this process have backgrounded priority. |
107 bool backgrounded_; | 115 bool backgrounded_; |
108 | 116 |
109 // Used to allow a RenderWidgetHost to intercept various messages on the | 117 // Used to allow a RenderWidgetHost to intercept various messages on the |
110 // IO thread. | 118 // IO thread. |
111 scoped_refptr<RenderWidgetHelper> widget_helper_; | 119 scoped_refptr<RenderWidgetHelper> widget_helper_; |
112 | 120 |
113 // A map of transport DIB ids to cached TransportDIBs | 121 // A map of transport DIB ids to cached TransportDIBs |
114 std::map<TransportDIB::Id, TransportDIB*> cached_dibs_; | 122 std::map<TransportDIB::Id, TransportDIB*> cached_dibs_; |
115 enum { | 123 enum { |
(...skipping 24 matching lines...) Expand all Loading... |
140 // Messages we queue while waiting for the process handle. We queue them here | 148 // Messages we queue while waiting for the process handle. We queue them here |
141 // instead of in the channel so that we ensure they're sent after init related | 149 // instead of in the channel so that we ensure they're sent after init related |
142 // messages that are sent once the process handle is available. This is | 150 // messages that are sent once the process handle is available. This is |
143 // because the queued messages may have dependencies on the init messages. | 151 // because the queued messages may have dependencies on the init messages. |
144 std::queue<IPC::Message*> queued_messages_; | 152 std::queue<IPC::Message*> queued_messages_; |
145 | 153 |
146 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); | 154 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); |
147 }; | 155 }; |
148 | 156 |
149 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 157 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |