| 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_RENDER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDER_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_RENDER_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Listeners should call this when they've sent a "Close" message and | 95 // Listeners should call this when they've sent a "Close" message and |
| 96 // they're waiting for a "Close_ACK", so that if the renderer process | 96 // they're waiting for a "Close_ACK", so that if the renderer process |
| 97 // goes away we'll know that it was intentional rather than a crash. | 97 // goes away we'll know that it was intentional rather than a crash. |
| 98 void ReportExpectingClose(int32 listener_id); | 98 void ReportExpectingClose(int32 listener_id); |
| 99 | 99 |
| 100 // May return NULL if there is no connection. | 100 // May return NULL if there is no connection. |
| 101 IPC::SyncChannel* channel() { | 101 IPC::SyncChannel* channel() { |
| 102 return channel_.get(); | 102 return channel_.get(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 const Process& process() const { | 105 const base::Process& process() const { |
| 106 return process_; | 106 return process_; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Try to shutdown the associated renderer process as fast as possible. | 109 // Try to shutdown the associated renderer process as fast as possible. |
| 110 // If this renderer has any RenderViews with unload handlers, then this | 110 // If this renderer has any RenderViews with unload handlers, then this |
| 111 // function does nothing. The current implementation uses TerminateProcess. | 111 // function does nothing. The current implementation uses TerminateProcess. |
| 112 // Returns True if it was able to do fast shutdown. | 112 // Returns True if it was able to do fast shutdown. |
| 113 bool FastShutdownIfPossible(); | 113 bool FastShutdownIfPossible(); |
| 114 | 114 |
| 115 IPC::Channel::Listener* GetListenerByID(int routing_id) { | 115 IPC::Channel::Listener* GetListenerByID(int routing_id) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Returns the user profile associated with this renderer process. | 172 // Returns the user profile associated with this renderer process. |
| 173 Profile* profile() const { return profile_; } | 173 Profile* profile() const { return profile_; } |
| 174 | 174 |
| 175 RenderWidgetHelper* widget_helper() const { return widget_helper_; } | 175 RenderWidgetHelper* widget_helper() const { return widget_helper_; } |
| 176 | 176 |
| 177 // Track the count of visible widgets. Called by listeners | 177 // Track the count of visible widgets. Called by listeners |
| 178 // to register/unregister visibility. | 178 // to register/unregister visibility. |
| 179 void WidgetRestored(); | 179 void WidgetRestored(); |
| 180 void WidgetHidden(); | 180 void WidgetHidden(); |
| 181 | 181 |
| 182 // Add a word in the spellchecker. | 182 // Add a word in the spellchecker. |
| 183 void AddWord(const std::wstring& word); | 183 void AddWord(const std::wstring& word); |
| 184 | 184 |
| 185 // NotificationObserver implementation. | 185 // NotificationObserver implementation. |
| 186 virtual void Observe(NotificationType type, | 186 virtual void Observe(NotificationType type, |
| 187 const NotificationSource& source, | 187 const NotificationSource& source, |
| 188 const NotificationDetails& details); | 188 const NotificationDetails& details); |
| 189 | 189 |
| 190 private: | 190 private: |
| 191 // control message handlers | 191 // control message handlers |
| 192 void OnPageContents(const GURL& url, int32 page_id, | 192 void OnPageContents(const GURL& url, int32 page_id, |
| 193 const std::wstring& contents); | 193 const std::wstring& contents); |
| 194 // Clipboard messages | 194 // Clipboard messages |
| 195 void OnClipboardWriteHTML(const std::wstring& markup, const GURL& src_url); | 195 void OnClipboardWriteHTML(const std::wstring& markup, const GURL& src_url); |
| 196 void OnClipboardWriteBookmark(const std::wstring& title, const GURL& url); | 196 void OnClipboardWriteBookmark(const std::wstring& title, const GURL& url); |
| 197 void OnClipboardWriteBitmap(SharedMemoryHandle bitmap, gfx::Size size); | 197 void OnClipboardWriteBitmap(base::SharedMemoryHandle bitmap, gfx::Size size); |
| 198 void OnClipboardIsFormatAvailable(unsigned int format, bool* result); | 198 void OnClipboardIsFormatAvailable(unsigned int format, bool* result); |
| 199 void OnClipboardReadText(std::wstring* result); | 199 void OnClipboardReadText(std::wstring* result); |
| 200 void OnClipboardReadAsciiText(std::string* result); | 200 void OnClipboardReadAsciiText(std::string* result); |
| 201 void OnClipboardReadHTML(std::wstring* markup, GURL* src_url); | 201 void OnClipboardReadHTML(std::wstring* markup, GURL* src_url); |
| 202 void OnUpdatedCacheStats(const CacheManager::UsageStats& stats); | 202 void OnUpdatedCacheStats(const CacheManager::UsageStats& stats); |
| 203 | 203 |
| 204 // Initialize support for visited links. Send the renderer process its initial | 204 // Initialize support for visited links. Send the renderer process its initial |
| 205 // set of visited links. | 205 // set of visited links. |
| 206 void InitVisitedLinks(); | 206 void InitVisitedLinks(); |
| 207 | 207 |
| 208 // Initialize support for Greasemonkey scripts. Send the renderer process its | 208 // Initialize support for Greasemonkey scripts. Send the renderer process its |
| 209 // initial set of scripts and listen for updates to scripts. | 209 // initial set of scripts and listen for updates to scripts. |
| 210 void InitGreasemonkeyScripts(); | 210 void InitGreasemonkeyScripts(); |
| 211 | 211 |
| 212 // Sends the renderer process a new set of Greasemonkey scripts. | 212 // Sends the renderer process a new set of Greasemonkey scripts. |
| 213 void SendGreasemonkeyScriptsUpdate(SharedMemory* shared_memory); | 213 void SendGreasemonkeyScriptsUpdate(base::SharedMemory* shared_memory); |
| 214 | 214 |
| 215 // Gets a handle to the renderer process, normalizing the case where we were | 215 // Gets a handle to the renderer process, normalizing the case where we were |
| 216 // started with --single-process. | 216 // started with --single-process. |
| 217 HANDLE GetRendererProcessHandle(); | 217 base::ProcessHandle GetRendererProcessHandle(); |
| 218 | 218 |
| 219 // Callers can reduce the RenderProcess' priority. | 219 // Callers can reduce the RenderProcess' priority. |
| 220 // Returns true if the priority is backgrounded; false otherwise. | 220 // Returns true if the priority is backgrounded; false otherwise. |
| 221 void SetBackgrounded(bool boost); | 221 void SetBackgrounded(bool boost); |
| 222 | 222 |
| 223 // Unregister this object from all globals that reference it. | 223 // Unregister this object from all globals that reference it. |
| 224 // This would naturally be part of the destructor, but we destruct | 224 // This would naturally be part of the destructor, but we destruct |
| 225 // asynchronously. | 225 // asynchronously. |
| 226 void Unregister(); | 226 void Unregister(); |
| 227 | 227 |
| 228 // the registered listeners. When this list is empty or all NULL, we should | 228 // the registered listeners. When this list is empty or all NULL, we should |
| 229 // delete ourselves | 229 // delete ourselves |
| 230 IDMap<IPC::Channel::Listener> listeners_; | 230 IDMap<IPC::Channel::Listener> listeners_; |
| 231 | 231 |
| 232 // set of listeners that expect the renderer process to close | 232 // set of listeners that expect the renderer process to close |
| 233 std::set<int> listeners_expecting_close_; | 233 std::set<int> listeners_expecting_close_; |
| 234 | 234 |
| 235 // A proxy for our IPC::Channel that lives on the IO thread (see | 235 // A proxy for our IPC::Channel that lives on the IO thread (see |
| 236 // browser_process.h) | 236 // browser_process.h) |
| 237 scoped_ptr<IPC::SyncChannel> channel_; | 237 scoped_ptr<IPC::SyncChannel> channel_; |
| 238 | 238 |
| 239 // Our renderer process. | 239 // Our renderer process. |
| 240 Process process_; | 240 base::Process process_; |
| 241 | 241 |
| 242 // Used to watch the renderer process handle. | 242 // Used to watch the renderer process handle. |
| 243 base::ObjectWatcher watcher_; | 243 base::ObjectWatcher watcher_; |
| 244 | 244 |
| 245 // The profile associated with this renderer process. | 245 // The profile associated with this renderer process. |
| 246 Profile* profile_; | 246 Profile* profile_; |
| 247 | 247 |
| 248 // Our ID into the IDMap. | 248 // Our ID into the IDMap. |
| 249 int host_id_; | 249 int host_id_; |
| 250 | 250 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 // process can't cause denial of service by causing future named pipe creation | 282 // process can't cause denial of service by causing future named pipe creation |
| 283 // to fail. | 283 // to fail. |
| 284 return StringPrintf(L"%d.%x.%d", | 284 return StringPrintf(L"%d.%x.%d", |
| 285 GetCurrentProcessId(), instance, | 285 GetCurrentProcessId(), instance, |
| 286 base::RandInt(0, std::numeric_limits<int>::max())); | 286 base::RandInt(0, std::numeric_limits<int>::max())); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 #endif // CHROME_BROWSER_RENDER_PROCESS_HOST_H_ | 290 #endif // CHROME_BROWSER_RENDER_PROCESS_HOST_H_ |
| 291 | 291 |
| OLD | NEW |