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/timer.h" |
| 17 #include "chrome/common/transport_dib.h" |
16 #include "chrome/browser/renderer_host/audio_renderer_host.h" | 18 #include "chrome/browser/renderer_host/audio_renderer_host.h" |
17 #include "chrome/browser/renderer_host/render_process_host.h" | 19 #include "chrome/browser/renderer_host/render_process_host.h" |
18 #include "chrome/common/notification_observer.h" | 20 #include "chrome/common/notification_observer.h" |
19 #include "webkit/glue/cache_manager.h" | 21 #include "webkit/glue/cache_manager.h" |
20 | 22 |
21 class CommandLine; | 23 class CommandLine; |
22 class GURL; | 24 class GURL; |
23 class PrefService; | 25 class PrefService; |
24 class RenderWidgetHelper; | 26 class RenderWidgetHelper; |
25 class WebContents; | 27 class WebContents; |
(...skipping 29 matching lines...) Expand all Loading... |
55 virtual void CrossSiteClosePageACK(int new_render_process_host_id, | 57 virtual void CrossSiteClosePageACK(int new_render_process_host_id, |
56 int new_request_id); | 58 int new_request_id); |
57 virtual bool WaitForPaintMsg(int render_widget_id, | 59 virtual bool WaitForPaintMsg(int render_widget_id, |
58 const base::TimeDelta& max_delay, | 60 const base::TimeDelta& max_delay, |
59 IPC::Message* msg); | 61 IPC::Message* msg); |
60 virtual void ReceivedBadMessage(uint16 msg_type); | 62 virtual void ReceivedBadMessage(uint16 msg_type); |
61 virtual void WidgetRestored(); | 63 virtual void WidgetRestored(); |
62 virtual void WidgetHidden(); | 64 virtual void WidgetHidden(); |
63 virtual void AddWord(const std::wstring& word); | 65 virtual void AddWord(const std::wstring& word); |
64 virtual bool FastShutdownIfPossible(); | 66 virtual bool FastShutdownIfPossible(); |
| 67 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); |
65 | 68 |
66 // IPC::Channel::Sender via RenderProcessHost. | 69 // IPC::Channel::Sender via RenderProcessHost. |
67 virtual bool Send(IPC::Message* msg); | 70 virtual bool Send(IPC::Message* msg); |
68 | 71 |
69 // IPC::Channel::Listener via RenderProcessHost. | 72 // IPC::Channel::Listener via RenderProcessHost. |
70 virtual void OnMessageReceived(const IPC::Message& msg); | 73 virtual void OnMessageReceived(const IPC::Message& msg); |
71 virtual void OnChannelConnected(int32 peer_pid); | 74 virtual void OnChannelConnected(int32 peer_pid); |
72 virtual void OnChannelError(); | 75 virtual void OnChannelError(); |
73 | 76 |
74 static void RegisterPrefs(PrefService* prefs); | 77 static void RegisterPrefs(PrefService* prefs); |
(...skipping 17 matching lines...) Expand all Loading... |
92 void OnPageContents(const GURL& url, int32 page_id, | 95 void OnPageContents(const GURL& url, int32 page_id, |
93 const std::wstring& contents); | 96 const std::wstring& contents); |
94 // Clipboard messages | 97 // Clipboard messages |
95 void OnClipboardWriteHTML(const std::wstring& markup, const GURL& src_url); | 98 void OnClipboardWriteHTML(const std::wstring& markup, const GURL& src_url); |
96 void OnClipboardWriteBookmark(const std::wstring& title, const GURL& url); | 99 void OnClipboardWriteBookmark(const std::wstring& title, const GURL& url); |
97 void OnClipboardWriteBitmap(base::SharedMemoryHandle bitmap, gfx::Size size); | 100 void OnClipboardWriteBitmap(base::SharedMemoryHandle bitmap, gfx::Size size); |
98 void OnClipboardIsFormatAvailable(unsigned int format, bool* result); | 101 void OnClipboardIsFormatAvailable(unsigned int format, bool* result); |
99 void OnClipboardReadText(std::wstring* result); | 102 void OnClipboardReadText(std::wstring* result); |
100 void OnClipboardReadAsciiText(std::string* result); | 103 void OnClipboardReadAsciiText(std::string* result); |
101 void OnClipboardReadHTML(std::wstring* markup, GURL* src_url); | 104 void OnClipboardReadHTML(std::wstring* markup, GURL* src_url); |
| 105 |
102 void OnUpdatedCacheStats(const CacheManager::UsageStats& stats); | 106 void OnUpdatedCacheStats(const CacheManager::UsageStats& stats); |
103 | 107 |
104 // Initialize support for visited links. Send the renderer process its initial | 108 // Initialize support for visited links. Send the renderer process its initial |
105 // set of visited links. | 109 // set of visited links. |
106 void InitVisitedLinks(); | 110 void InitVisitedLinks(); |
107 | 111 |
108 // Initialize support for user scripts. Send the renderer process its initial | 112 // Initialize support for user scripts. Send the renderer process its initial |
109 // set of scripts and listen for updates to scripts. | 113 // set of scripts and listen for updates to scripts. |
110 void InitUserScripts(); | 114 void InitUserScripts(); |
111 | 115 |
(...skipping 21 matching lines...) Expand all Loading... |
133 // Does this process have backgrounded priority. | 137 // Does this process have backgrounded priority. |
134 bool backgrounded_; | 138 bool backgrounded_; |
135 | 139 |
136 // Used to allow a RenderWidgetHost to intercept various messages on the | 140 // Used to allow a RenderWidgetHost to intercept various messages on the |
137 // IO thread. | 141 // IO thread. |
138 scoped_refptr<RenderWidgetHelper> widget_helper_; | 142 scoped_refptr<RenderWidgetHelper> widget_helper_; |
139 | 143 |
140 // The host of audio renderers in the renderer process. | 144 // The host of audio renderers in the renderer process. |
141 scoped_refptr<AudioRendererHost> audio_renderer_host_; | 145 scoped_refptr<AudioRendererHost> audio_renderer_host_; |
142 | 146 |
| 147 // A map of transport DIB ids to cached TransportDIBs |
| 148 std::map<TransportDIB::Id, TransportDIB*> cached_dibs_; |
| 149 enum { |
| 150 // This is the maximum size of |cached_dibs_| |
| 151 MAX_MAPPED_TRANSPORT_DIBS = 3, |
| 152 }; |
| 153 |
| 154 // Map a transport DIB from its Id and return it. Returns NULL on error. |
| 155 TransportDIB* MapTransportDIB(TransportDIB::Id dib_id); |
| 156 |
| 157 void ClearTransportDIBCache(); |
| 158 // This is used to clear our cache five seconds after the last use. |
| 159 base::DelayTimer<BrowserRenderProcessHost> cached_dibs_cleaner_; |
| 160 |
143 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); | 161 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); |
144 }; | 162 }; |
145 | 163 |
146 #endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ | 164 #endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ |
OLD | NEW |