Skip to content

Commit

Permalink
Pass the SiteInstance into CreateRenderProcessHost
Browse files Browse the repository at this point in the history
so that the RenderProcessHostFactory has as much information as the
default branch.

TBR=gbillock

Review URL: https://chromiumcodereview.appspot.com/16490003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204613 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jyasskin@chromium.org committed Jun 6, 2013
1 parent c086bab commit f681b07
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ class MockProfileSharedRenderProcessHostFactory
content::BrowserContext* browser_context);

virtual content::RenderProcessHost* CreateRenderProcessHost(
content::BrowserContext* browser_context) const OVERRIDE;
content::BrowserContext* browser_context,
content::SiteInstance* site_instance) const OVERRIDE;

private:
typedef std::map<content::BrowserContext*, content::MockRenderProcessHost*>
Expand Down Expand Up @@ -416,7 +417,8 @@ MockProfileSharedRenderProcessHostFactory::ReleaseRPH(

content::RenderProcessHost*
MockProfileSharedRenderProcessHostFactory::CreateRenderProcessHost(
content::BrowserContext* browser_context) const {
content::BrowserContext* browser_context,
content::SiteInstance* site_instance) const {
ProfileRPHMap::const_iterator existing = rph_map_.find(browser_context);
if (existing != rph_map_.end())
return existing->second;
Expand Down
3 changes: 2 additions & 1 deletion components/visitedlink/test/visitedlink_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ class VisitedLinkRenderProcessHostFactory
VisitedLinkRenderProcessHostFactory()
: content::RenderProcessHostFactory() {}
virtual content::RenderProcessHost* CreateRenderProcessHost(
content::BrowserContext* browser_context) const OVERRIDE {
content::BrowserContext* browser_context,
content::SiteInstance* site_instance) const OVERRIDE {
return new VisitRelayingRenderProcessHost(browser_context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
process_factory_(),
delegate_(),
widget_(&delegate_,
process_factory_.CreateRenderProcessHost(&browser_context_),
process_factory_.CreateRenderProcessHost(
&browser_context_, NULL),
MSG_ROUTING_NONE),
thread_("TextInputClientMacTestThread") {}

Expand Down
2 changes: 1 addition & 1 deletion content/browser/site_instance_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ RenderProcessHost* SiteInstanceImpl::GetProcess() {
if (!process_) {
if (g_render_process_host_factory_) {
process_ = g_render_process_host_factory_->CreateRenderProcessHost(
browser_context);
browser_context, this);
} else {
StoragePartitionImpl* partition =
static_cast<StoragePartitionImpl*>(
Expand Down
6 changes: 4 additions & 2 deletions content/public/browser/render_process_host_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@

namespace content {
class BrowserContext;
class ContentBrowserClient;
class RenderProcessHost;
class SiteInstance;

// Factory object for RenderProcessHosts. Using this factory allows tests to
// swap out a different one to use a TestRenderProcessHost.
class RenderProcessHostFactory {
public:
virtual ~RenderProcessHostFactory() {}
virtual RenderProcessHost* CreateRenderProcessHost(
BrowserContext* browser_context) const = 0;
BrowserContext* browser_context,
SiteInstance* site_instance) const = 0;
};

} // namespace content

#endif // CONTENT_PUBLIC_BROWSER_RENDER_PROCESS_HOST_FACTORY_H_

3 changes: 2 additions & 1 deletion content/public/test/mock_render_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ MockRenderProcessHostFactory::~MockRenderProcessHostFactory() {
}

RenderProcessHost* MockRenderProcessHostFactory::CreateRenderProcessHost(
BrowserContext* browser_context) const {
BrowserContext* browser_context,
SiteInstance* site_instance) const {
MockRenderProcessHost* host = new MockRenderProcessHost(browser_context);
if (host) {
processes_.push_back(host);
Expand Down
3 changes: 2 additions & 1 deletion content/public/test/mock_render_process_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class MockRenderProcessHostFactory : public RenderProcessHostFactory {
virtual ~MockRenderProcessHostFactory();

virtual RenderProcessHost* CreateRenderProcessHost(
BrowserContext* browser_context) const OVERRIDE;
BrowserContext* browser_context,
SiteInstance* site_instance) const OVERRIDE;

// Removes the given MockRenderProcessHost from the MockRenderProcessHost list
// without deleting it. When a test deletes a MockRenderProcessHost, we need
Expand Down

0 comments on commit f681b07

Please sign in to comment.