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

Unified Diff: content/public/browser/render_process_host.h

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
« content/content_browser.gypi ('K') | « content/content_browser.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/render_process_host.h
===================================================================
--- content/public/browser/render_process_host.h (revision 0)
+++ content/public/browser/render_process_host.h (revision 0)
@@ -0,0 +1,172 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
+#define CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
+
+#include "base/basictypes.h"
+#include "base/id_map.h"
+#include "base/process.h"
jam 2011/11/11 03:24:29 is this really needed?
ananta 2011/11/16 19:47:14 Needed for typedefs like ProcessHandle, etc used b
+#include "base/process_util.h"
jam 2011/11/11 03:24:29 not needed?
ananta 2011/11/16 19:47:14 We use the TerminationStatus enum defined in this
+#include "base/time.h"
jam 2011/11/11 03:24:29 forward declare?
ananta 2011/11/16 19:47:14 Done.
+#include "content/common/content_export.h"
+#include "ipc/ipc_channel_proxy.h"
jam 2011/11/11 03:24:29 nit: not needed
ananta 2011/11/16 19:47:14 Replaced with ipc_message.h to get the definition
+#include "ui/gfx/native_widget_types.h"
+
+class GURL;
+struct ViewMsg_SwapOut_Params;
+
+namespace content {
+class BrowserContext;
+}
+
+// Virtual interface that represents the browser side of the browser <->
jam 2011/11/11 03:24:29 nit: "virtual interface" is redundant (sorry I kno
ananta 2011/11/16 19:47:14 Done.
+// renderer communication channel. There will generally be one
+// RenderProcessHost per renderer process.
+class CONTENT_EXPORT RenderProcessHost : public IPC::Message::Sender {
+ public:
+ typedef IDMap<RenderProcessHost>::iterator iterator;
+ // Details for RENDERER_PROCESS_CLOSED notifications.
+ struct RendererClosedDetails {
+ RendererClosedDetails(base::ProcessHandle handle,
+ base::TerminationStatus status,
+ int exit_code,
+ bool was_alive) {
+ this->handle = handle;
+ this->status = status;
+ this->exit_code = exit_code;
+ this->was_alive = was_alive;
+ }
+ base::ProcessHandle handle;
+ base::TerminationStatus status;
+ int exit_code;
+ bool was_alive;
+ };
+
+ RenderProcessHost() {}
jam 2011/11/11 03:24:29 nit: not needed
ananta 2011/11/16 19:47:14 Done.
+ virtual ~RenderProcessHost() {}
+
+ // Returns true iff channel_ has been set to non-NULL. Use this for checking
+ // if there is connection or not. Virtual for mocking out for tests.
+ virtual bool HasConnection() const = 0;
+
+ // Call this to allow queueing of IPC messages that are sent before the
+ // process is launched.
+ virtual void EnableSendQueue() = 0;
jam 2011/11/11 03:24:29 no one calls this in chrome. why does it need to b
+
+ // Initialize the new renderer process, returning true on success. This must
+ // be called once before the object can be used, but can be called after
+ // that with no effect. Therefore, if the caller isn't sure about whether
+ // the process has been created, it should just call Init().
+ virtual bool Init(bool is_accessibility_enabled) = 0;
+
+ // Gets the next available routing id.
+ virtual int GetNextRoutingID() = 0;
+
+ // Called on the UI thread to cancel any outstanding resource requests for
jam 2011/11/11 03:24:29 nit: we should get rid of all the "Called on UI th
ananta 2011/11/16 19:47:14 Done.
+ // the specified render widget.
+ virtual void CancelResourceRequests(int render_widget_id) = 0;
jam 2011/11/11 03:24:29 no one calls this in chrome. why does it need to b
+
+ // Called on the UI thread to simulate a SwapOut_ACK message to the
+ // ResourceDispatcherHost. Necessary for a cross-site request, in the case
+ // that the original RenderViewHost is not live and thus cannot run an
+ // unload handler.
+ virtual void CrossSiteSwapOutACK(
jam 2011/11/11 03:24:29 ditto
+ const ViewMsg_SwapOut_Params& params) = 0;
+
+ // Called on the UI thread to wait for the next UpdateRect message for the
+ // specified render widget. Returns true if successful, and the msg out-
+ // param will contain a copy of the received UpdateRect message.
+ virtual bool WaitForUpdateMsg(int render_widget_id,
jam 2011/11/11 03:24:29 ditto
+ const base::TimeDelta& max_delay,
+ IPC::Message* msg) = 0;
+
+ // Called when a received message cannot be decoded.
+ virtual void ReceivedBadMessage() = 0;
jam 2011/11/11 03:24:29 ditto
+
+ // Track the count of visible widgets. Called by listeners to register and
+ // unregister visibility.
+ virtual void WidgetRestored() = 0;
+ virtual void WidgetHidden() = 0;
+ virtual int VisibleWidgetCount() const = 0;
+
+ // Try to shutdown the associated renderer process as fast as possible.
+ // If this renderer has any RenderViews with unload handlers, then this
+ // function does nothing. The current implementation uses TerminateProcess.
+ // Returns True if it was able to do fast shutdown.
+ virtual bool FastShutdownIfPossible() = 0;
+
+ // Dump the child process' handle table before shutting down.
+ virtual void DumpHandles() = 0;
jam 2011/11/11 03:24:29 ditto
+
+ // Returns the process object associated with the child process. In certain
+ // tests or single-process mode, this will actually represent the current
+ // process.
+ //
+ // NOTE: this is not necessarily valid immediately after calling Init, as
+ // Init starts the process asynchronously. It's guaranteed to be valid after
+ // the first IPC arrives.
+ virtual base::ProcessHandle GetHandle() = 0;
+
+ // Transport DIB functions ---------------------------------------------------
+
+ // Return the TransportDIB for the given id. On Linux, this can involve
+ // mapping shared memory. On Mac, the shared memory is created in the browser
+ // process and the cached metadata is returned. On Windows, this involves
+ // duplicating the handle from the remote process. The RenderProcessHost
+ // still owns the returned DIB.
+ virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id) = 0;
jam 2011/11/11 03:24:29 ditto
+
+ // RenderWidgetHost / compositing surface mapping functions ------------------
+
+ // Set a mapping from a RenderWidgetHost to a compositing surface. Pass a null
+ // handle to remove the mapping.
+ virtual void SetCompositingSurface(
jam 2011/11/11 03:24:29 ditto
+ int render_widget_id,
+ gfx::PluginWindowHandle compositing_surface) = 0;
+
+ // Static management functions -----------------------------------------------
+
+ // Flag to run the renderer in process. This is primarily
+ // for debugging purposes. When running "in process", the
+ // browser maintains a single RenderProcessHost which communicates
+ // to a RenderProcess which is instantiated in the same process
+ // with the Browser. All IPC between the Browser and the
+ // Renderer is the same, it's just not crossing a process boundary.
+ static bool run_renderer_in_process() {
+ return run_renderer_in_process_;
jam 2011/11/11 03:24:29 apart from not compiling, we should avoid member v
+ }
+ static void set_run_renderer_in_process(bool value) {
+ run_renderer_in_process_ = value;
+ }
+
+ // Allows iteration over all the RenderProcessHosts in the browser. Note
+ // that each host may not be active, and therefore may have NULL channels.
+ static iterator AllHostsIterator();
+
+ // Returns the RenderProcessHost given its ID. Returns NULL if the ID does
+ // not correspond to a live RenderProcessHost.
+ static RenderProcessHost* FromID(int render_process_id);
+
+ // Returns true if the caller should attempt to use an existing
+ // RenderProcessHost rather than creating a new one.
+ static bool ShouldTryToUseExistingProcessHost();
+
+ // Get an existing RenderProcessHost associated with the given browser
+ // context, if possible. The renderer process is chosen randomly from
+ // suitable renderers that share the same context and type (determined by the
+ // site url).
+ // Returns NULL if no suitable renderer process is available, in which case
+ // the caller is free to create a new renderer.
+ static RenderProcessHost* GetExistingProcessHost(
+ content::BrowserContext* browser_context, const GURL& site_url);
+
+ // Overrides the default heuristic for limiting the max renderer process
+ // count. This is useful for unit testing process limit behaviors.
+ // A value of zero means to use the default heuristic.
+ static void SetMaxRendererProcessCountForTest(size_t count);
+};
+
+#endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_H_
+
Property changes on: content\public\browser\render_process_host.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« content/content_browser.gypi ('K') | « content/content_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698