OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_RENDER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "base/process.h" | 11 #include "base/process.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "chrome/common/ipc_sync_channel.h" | 13 #include "chrome/common/ipc_sync_channel.h" |
| 14 #include "chrome/common/transport_dib.h" |
14 | 15 |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 // Virtual interface that represents the browser side of the browser <-> | 18 // Virtual interface that represents the browser side of the browser <-> |
18 // renderer communication channel. There will generally be one | 19 // renderer communication channel. There will generally be one |
19 // RenderProcessHost per renderer process. | 20 // RenderProcessHost per renderer process. |
20 // | 21 // |
21 // The concrete implementation of this class for normal use is the | 22 // The concrete implementation of this class for normal use is the |
22 // BrowserRenderProcessHost. It may also be implemented by a testing interface | 23 // BrowserRenderProcessHost. It may also be implemented by a testing interface |
23 // for mocking purposes. | 24 // for mocking purposes. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 118 |
118 // Add a word in the spellchecker. | 119 // Add a word in the spellchecker. |
119 virtual void AddWord(const std::wstring& word) = 0; | 120 virtual void AddWord(const std::wstring& word) = 0; |
120 | 121 |
121 // Try to shutdown the associated renderer process as fast as possible. | 122 // Try to shutdown the associated renderer process as fast as possible. |
122 // If this renderer has any RenderViews with unload handlers, then this | 123 // If this renderer has any RenderViews with unload handlers, then this |
123 // function does nothing. The current implementation uses TerminateProcess. | 124 // function does nothing. The current implementation uses TerminateProcess. |
124 // Returns True if it was able to do fast shutdown. | 125 // Returns True if it was able to do fast shutdown. |
125 virtual bool FastShutdownIfPossible() = 0; | 126 virtual bool FastShutdownIfPossible() = 0; |
126 | 127 |
| 128 // Transport DIB functions --------------------------------------------------- |
| 129 |
| 130 // Return the TransportDIB for the given id. On Linux, this can involve |
| 131 // mapping shared memory. On Mac, the shared memory is created in the browser |
| 132 // process and the cached metadata is returned. On Windows, this involves |
| 133 // duplicating the handle from the remote process. The RenderProcessHost |
| 134 // still owns the returned DIB. |
| 135 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) = 0; |
| 136 |
127 // Static management functions ----------------------------------------------- | 137 // Static management functions ----------------------------------------------- |
128 | 138 |
129 // Flag to run the renderer in process. This is primarily | 139 // Flag to run the renderer in process. This is primarily |
130 // for debugging purposes. When running "in process", the | 140 // for debugging purposes. When running "in process", the |
131 // browser maintains a single RenderProcessHost which communicates | 141 // browser maintains a single RenderProcessHost which communicates |
132 // to a RenderProcess which is instantiated in the same process | 142 // to a RenderProcess which is instantiated in the same process |
133 // with the Browser. All IPC between the Browser and the | 143 // with the Browser. All IPC between the Browser and the |
134 // Renderer is the same, it's just not crossing a process boundary. | 144 // Renderer is the same, it's just not crossing a process boundary. |
135 static bool run_renderer_in_process() { | 145 static bool run_renderer_in_process() { |
136 return run_renderer_in_process_; | 146 return run_renderer_in_process_; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Factory object for RenderProcessHosts. Using this factory allows tests to | 214 // Factory object for RenderProcessHosts. Using this factory allows tests to |
205 // swap out a different one to use a TestRenderProcessHost. | 215 // swap out a different one to use a TestRenderProcessHost. |
206 class RenderProcessHostFactory { | 216 class RenderProcessHostFactory { |
207 public: | 217 public: |
208 virtual ~RenderProcessHostFactory() {} | 218 virtual ~RenderProcessHostFactory() {} |
209 virtual RenderProcessHost* CreateRenderProcessHost( | 219 virtual RenderProcessHost* CreateRenderProcessHost( |
210 Profile* profile) const = 0; | 220 Profile* profile) const = 0; |
211 }; | 221 }; |
212 | 222 |
213 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ | 223 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_PROCESS_HOST_H_ |
OLD | NEW |