Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: chrome/browser/renderer_host/browser_render_process_host.h

Issue 397031: Launch processes asynchronously so as not to block the UI thread. For now, re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: return 0 instead of -1 if zygote couldn't launch renderer Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/browser_render_process_host.h
===================================================================
--- chrome/browser/renderer_host/browser_render_process_host.h (revision 32255)
+++ chrome/browser/renderer_host/browser_render_process_host.h (working copy)
@@ -8,6 +8,7 @@
#include "build/build_config.h"
#include <map>
+#include <queue>
#include <string>
#include "base/process.h"
@@ -17,6 +18,7 @@
#include "base/string16.h"
#include "base/timer.h"
#include "chrome/common/transport_dib.h"
+#include "chrome/browser/child_process_launcher.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/notification_registrar.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
@@ -49,7 +51,8 @@
// are correlated with IDs. This way, the Views and the corresponding ViewHosts
// communicate through the two process objects.
class BrowserRenderProcessHost : public RenderProcessHost,
- public NotificationObserver {
+ public NotificationObserver,
+ public ChildProcessLauncher::Client {
public:
explicit BrowserRenderProcessHost(Profile* profile);
~BrowserRenderProcessHost();
@@ -68,6 +71,7 @@
virtual void WidgetHidden();
virtual void ViewCreated();
virtual void AddWord(const string16& word);
+ virtual void SendVisitedLinkTable(base::SharedMemory* table_memory);
virtual void AddVisitedLinks(const VisitedLinkCommon::Fingerprints& links);
virtual void ResetVisitedLinks();
virtual bool FastShutdownIfPossible();
@@ -94,6 +98,9 @@
const NotificationSource& source,
const NotificationDetails& details);
+ // ChildProcessLauncher::Client implementation.
+ virtual void OnProcessLaunched();
+
private:
friend class VisitRelayingRenderProcessHost;
@@ -122,11 +129,8 @@
void SendUserScriptsUpdate(base::SharedMemory* shared_memory);
// Generates a command line to be used to spawn a renderer and appends the
- // results to |*command_line|. |*has_cmd_prefix| will be set if the renderer
- // command line specifies a prefix which is another program that will actually
- // execute the renderer (like gdb).
- void AppendRendererCommandLine(CommandLine* command_line,
- bool* has_cmd_prefix) const;
+ // results to |*command_line|.
+ void AppendRendererCommandLine(CommandLine* command_line) const;
// Copies applicable command line switches from the given |browser_cmd| line
// flags to the output |renderer_cmd| line flags. Not all switches will be
@@ -134,13 +138,6 @@
void PropogateBrowserCommandLineToRenderer(const CommandLine& browser_cmd,
CommandLine* renderer_cmd) const;
- // Spawns the renderer process, returning the new handle on success, or 0 on
- // failure. The renderer command line is given in the first argument, and
- // whether a command prefix was used when generating the command line is
- // speficied in the second.
- base::ProcessHandle ExecuteRenderer(CommandLine* cmd_line,
- bool has_cmd_prefix);
-
// Callers can reduce the RenderProcess' priority.
// Returns true if the priority is backgrounded; false otherwise.
void SetBackgrounded(bool boost);
@@ -201,15 +198,18 @@
// Buffer visited links and send them to to renderer.
scoped_ptr<VisitedLinkUpdater> visited_link_updater_;
- // True iff the renderer is a child of a zygote process.
- bool zygote_child_;
-
// True iff this process is being used as an extension process. Not valid
// when running in single-process mode.
bool extension_process_;
- base::Process process_;
+ // Usedt to launch and terminate the process without blocking the UI thread.
+ scoped_ptr<ChildProcessLauncher> child_process_;
+ // Messages we queue while waiting for the process handle. We queue them here
+ // instead of in the channel so that we ensure they're sent after init related
+ // messages that are sent once the process handle is available. This is
+ // because the queued messages may have dependencies on the init messages.
+ std::queue<IPC::Message*> queued_messages_;
DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost);
};
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698