OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/process.h" | 12 #include "base/process.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
16 #include "base/string16.h" | 16 #include "base/string16.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "chrome/common/transport_dib.h" | 18 #include "chrome/common/transport_dib.h" |
19 #include "chrome/browser/renderer_host/audio_renderer_host.h" | 19 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
20 #include "chrome/browser/renderer_host/render_process_host.h" | 20 #include "chrome/browser/renderer_host/render_process_host.h" |
21 #include "chrome/common/notification_registrar.h" | 21 #include "chrome/common/notification_registrar.h" |
22 #include "webkit/api/public/WebCache.h" | 22 #include "webkit/api/public/WebCache.h" |
23 | 23 |
24 class CommandLine; | 24 class CommandLine; |
25 class GURL; | 25 class GURL; |
26 class RendererMainThread; | 26 class RendererMainThread; |
27 class RenderWidgetHelper; | 27 class RenderWidgetHelper; |
28 class TabContents; | 28 class TabContents; |
| 29 class VisitedLinkUpdater; |
29 | 30 |
30 namespace gfx { | 31 namespace gfx { |
31 class Size; | 32 class Size; |
32 } | 33 } |
33 | 34 |
34 // Implements a concrete RenderProcessHost for the browser process for talking | 35 // Implements a concrete RenderProcessHost for the browser process for talking |
35 // to actual renderer processes (as opposed to mocks). | 36 // to actual renderer processes (as opposed to mocks). |
36 // | 37 // |
37 // Represents the browser side of the browser <--> renderer communication | 38 // Represents the browser side of the browser <--> renderer communication |
38 // channel. There will be one RenderProcessHost per renderer process. | 39 // channel. There will be one RenderProcessHost per renderer process. |
(...skipping 18 matching lines...) Expand all Loading... |
57 virtual void CancelResourceRequests(int render_widget_id); | 58 virtual void CancelResourceRequests(int render_widget_id); |
58 virtual void CrossSiteClosePageACK(int new_render_process_host_id, | 59 virtual void CrossSiteClosePageACK(int new_render_process_host_id, |
59 int new_request_id); | 60 int new_request_id); |
60 virtual bool WaitForPaintMsg(int render_widget_id, | 61 virtual bool WaitForPaintMsg(int render_widget_id, |
61 const base::TimeDelta& max_delay, | 62 const base::TimeDelta& max_delay, |
62 IPC::Message* msg); | 63 IPC::Message* msg); |
63 virtual void ReceivedBadMessage(uint16 msg_type); | 64 virtual void ReceivedBadMessage(uint16 msg_type); |
64 virtual void WidgetRestored(); | 65 virtual void WidgetRestored(); |
65 virtual void WidgetHidden(); | 66 virtual void WidgetHidden(); |
66 virtual void AddWord(const std::wstring& word); | 67 virtual void AddWord(const std::wstring& word); |
| 68 virtual void AddVisitedLinks(const VisitedLinkCommon::Fingerprints& links); |
| 69 virtual void ResetVisitedLinks(); |
67 virtual bool FastShutdownIfPossible(); | 70 virtual bool FastShutdownIfPossible(); |
68 virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms); | 71 virtual bool SendWithTimeout(IPC::Message* msg, int timeout_ms); |
69 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); | 72 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); |
70 | 73 |
71 // IPC::Channel::Sender via RenderProcessHost. | 74 // IPC::Channel::Sender via RenderProcessHost. |
72 virtual bool Send(IPC::Message* msg); | 75 virtual bool Send(IPC::Message* msg); |
73 | 76 |
74 // IPC::Channel::Listener via RenderProcessHost. | 77 // IPC::Channel::Listener via RenderProcessHost. |
75 virtual void OnMessageReceived(const IPC::Message& msg); | 78 virtual void OnMessageReceived(const IPC::Message& msg); |
76 virtual void OnChannelConnected(int32 peer_pid); | 79 virtual void OnChannelConnected(int32 peer_pid); |
77 virtual void OnChannelError(); | 80 virtual void OnChannelError(); |
78 | 81 |
79 // If the a process has sent a message that cannot be decoded, it is deemed | 82 // If the a process has sent a message that cannot be decoded, it is deemed |
80 // corrupted and thus needs to be terminated using this call. This function | 83 // corrupted and thus needs to be terminated using this call. This function |
81 // can be safely called from any thread. | 84 // can be safely called from any thread. |
82 static void BadMessageTerminateProcess(uint16 msg_type, | 85 static void BadMessageTerminateProcess(uint16 msg_type, |
83 base::ProcessHandle renderer); | 86 base::ProcessHandle renderer); |
84 | 87 |
85 // NotificationObserver implementation. | 88 // NotificationObserver implementation. |
86 virtual void Observe(NotificationType type, | 89 virtual void Observe(NotificationType type, |
87 const NotificationSource& source, | 90 const NotificationSource& source, |
88 const NotificationDetails& details); | 91 const NotificationDetails& details); |
89 | 92 |
90 private: | 93 private: |
| 94 friend class VisitRelayingRenderProcessHost; |
| 95 |
91 // Control message handlers. | 96 // Control message handlers. |
92 void OnPageContents(const GURL& url, int32 page_id, | 97 void OnPageContents(const GURL& url, int32 page_id, |
93 const std::wstring& contents); | 98 const std::wstring& contents); |
94 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); | 99 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); |
95 void SuddenTerminationChanged(bool enabled); | 100 void SuddenTerminationChanged(bool enabled); |
96 void OnExtensionAddListener(const std::string& event_name); | 101 void OnExtensionAddListener(const std::string& event_name); |
97 void OnExtensionRemoveListener(const std::string& event_name); | 102 void OnExtensionRemoveListener(const std::string& event_name); |
98 void OnExtensionCloseChannel(int port_id); | 103 void OnExtensionCloseChannel(int port_id); |
99 | 104 |
100 // Initialize support for visited links. Send the renderer process its initial | 105 // Initialize support for visited links. Send the renderer process its initial |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Map a transport DIB from its Id and return it. Returns NULL on error. | 152 // Map a transport DIB from its Id and return it. Returns NULL on error. |
148 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); | 153 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); |
149 | 154 |
150 void ClearTransportDIBCache(); | 155 void ClearTransportDIBCache(); |
151 // This is used to clear our cache five seconds after the last use. | 156 // This is used to clear our cache five seconds after the last use. |
152 base::DelayTimer<BrowserRenderProcessHost> cached_dibs_cleaner_; | 157 base::DelayTimer<BrowserRenderProcessHost> cached_dibs_cleaner_; |
153 | 158 |
154 // Used in single-process mode. | 159 // Used in single-process mode. |
155 scoped_ptr<RendererMainThread> in_process_renderer_; | 160 scoped_ptr<RendererMainThread> in_process_renderer_; |
156 | 161 |
| 162 // Buffer visited links and send them to to renderer. |
| 163 scoped_ptr<VisitedLinkUpdater> visited_link_updater_; |
| 164 |
157 // True iff the renderer is a child of a zygote process. | 165 // True iff the renderer is a child of a zygote process. |
158 bool zygote_child_; | 166 bool zygote_child_; |
159 | 167 |
160 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); | 168 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); |
161 }; | 169 }; |
162 | 170 |
163 #endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 171 #endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |