summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/renderer_host')
-rw-r--r--content/browser/renderer_host/browser_render_process_host.cc29
-rw-r--r--content/browser/renderer_host/browser_render_process_host.h8
-rw-r--r--content/browser/renderer_host/mock_render_process_host.cc5
-rw-r--r--content/browser/renderer_host/mock_render_process_host.h2
-rw-r--r--content/browser/renderer_host/render_process_host.cc1
-rw-r--r--content/browser/renderer_host/render_process_host.h10
-rw-r--r--content/browser/renderer_host/render_view_host.cc12
-rw-r--r--content/browser/renderer_host/render_view_host.h10
8 files changed, 37 insertions, 40 deletions
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
index 5874e57..2bbfadd 100644
--- a/content/browser/renderer_host/browser_render_process_host.cc
+++ b/content/browser/renderer_host/browser_render_process_host.cc
@@ -192,7 +192,7 @@ BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
base::TimeDelta::FromSeconds(5),
this, &BrowserRenderProcessHost::ClearTransportDIBCache)),
accessibility_enabled_(false),
- extension_process_(false) {
+ is_initialized_(false) {
widget_helper_ = new RenderWidgetHelper();
WebCacheManager::GetInstance()->Add(id());
@@ -239,8 +239,7 @@ BrowserRenderProcessHost::~BrowserRenderProcessHost() {
ClearTransportDIBCache();
}
-bool BrowserRenderProcessHost::Init(
- bool is_accessibility_enabled, bool is_extensions_process) {
+bool BrowserRenderProcessHost::Init(bool is_accessibility_enabled) {
// calling Init() more than once does nothing, this makes it more convenient
// for the view host which may not be sure in some cases
if (channel_.get())
@@ -248,10 +247,6 @@ bool BrowserRenderProcessHost::Init(
accessibility_enabled_ = is_accessibility_enabled;
- // It is possible for an extension process to be reused for non-extension
- // content, e.g. if an extension calls window.open.
- extension_process_ = extension_process_ || is_extensions_process;
-
CommandLine::StringType renderer_prefix;
#if defined(OS_POSIX)
// A command prefix is something prepended to the command line of the spawned
@@ -332,6 +327,7 @@ bool BrowserRenderProcessHost::Init(
fast_shutdown_started_ = false;
}
+ is_initialized_ = true;
return true;
}
@@ -470,8 +466,8 @@ void BrowserRenderProcessHost::AppendRendererCommandLine(
// Extensions use a special pseudo-process type to make them distinguishable,
// even though they're just renderers.
command_line->AppendSwitchASCII(switches::kProcessType,
- extension_process_ ? switches::kExtensionProcess :
- switches::kRendererProcess);
+ is_extension_process_ ? switches::kExtensionProcess :
+ switches::kRendererProcess);
if (logging::DialogsAreSuppressed())
command_line->AppendSwitch(switches::kNoErrorDialogs);
@@ -762,8 +758,13 @@ void BrowserRenderProcessHost::ClearTransportDIBCache() {
bool BrowserRenderProcessHost::Send(IPC::Message* msg) {
if (!channel_.get()) {
- delete msg;
- return false;
+ if (!is_initialized_) {
+ queued_messages_.push(msg);
+ return true;
+ } else {
+ delete msg;
+ return false;
+ }
}
if (child_process_launcher_.get() && child_process_launcher_->IsStarting()) {
@@ -846,15 +847,15 @@ void BrowserRenderProcessHost::OnChannelError() {
if (status == base::TERMINATION_STATUS_PROCESS_CRASHED ||
status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildCrashes",
- extension_process_ ? 2 : 1);
+ is_extension_process_ ? 2 : 1);
}
if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
UMA_HISTOGRAM_PERCENTAGE("BrowserRenderProcessHost.ChildKills",
- extension_process_ ? 2 : 1);
+ is_extension_process_ ? 2 : 1);
}
- RendererClosedDetails details(status, exit_code, extension_process_);
+ RendererClosedDetails details(status, exit_code, is_extension_process_);
NotificationService::current()->Notify(
NotificationType::RENDERER_PROCESS_CLOSED,
Source<RenderProcessHost>(this),
diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/browser_render_process_host.h
index d3eee33..c97648c 100644
--- a/content/browser/renderer_host/browser_render_process_host.h
+++ b/content/browser/renderer_host/browser_render_process_host.h
@@ -47,7 +47,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
~BrowserRenderProcessHost();
// RenderProcessHost implementation (public portion).
- virtual bool Init(bool is_accessibility_enabled, bool is_extensions_process);
+ virtual bool Init(bool is_accessibility_enabled);
virtual int GetNextRoutingID();
virtual void CancelResourceRequests(int render_widget_id);
virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params);
@@ -130,9 +130,9 @@ class BrowserRenderProcessHost : public RenderProcessHost,
// True if this prcoess should have accessibility enabled;
bool accessibility_enabled_;
- // True iff this process is being used as an extension process. Not valid
- // when running in single-process mode.
- bool extension_process_;
+ // True after Init() has been called. We can't just check channel_ because we
+ // also reset that in the case of process termination.
+ bool is_initialized_;
// Used to launch and terminate the process without blocking the UI thread.
scoped_ptr<ChildProcessLauncher> child_process_launcher_;
diff --git a/content/browser/renderer_host/mock_render_process_host.cc b/content/browser/renderer_host/mock_render_process_host.cc
index 104395f..dec107a 100644
--- a/content/browser/renderer_host/mock_render_process_host.cc
+++ b/content/browser/renderer_host/mock_render_process_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -23,8 +23,7 @@ MockRenderProcessHost::~MockRenderProcessHost() {
factory_->Remove(this);
}
-bool MockRenderProcessHost::Init(
- bool is_accessibility_enabled, bool is_extensions_process) {
+bool MockRenderProcessHost::Init(bool is_accessibility_enabled) {
return true;
}
diff --git a/content/browser/renderer_host/mock_render_process_host.h b/content/browser/renderer_host/mock_render_process_host.h
index 0e7656c..a6804a1 100644
--- a/content/browser/renderer_host/mock_render_process_host.h
+++ b/content/browser/renderer_host/mock_render_process_host.h
@@ -36,7 +36,7 @@ class MockRenderProcessHost : public RenderProcessHost {
int bad_msg_count() const { return bad_msg_count_; }
// RenderProcessHost implementation (public portion).
- virtual bool Init(bool is_accessibility_enabled, bool is_extensions_process);
+ virtual bool Init(bool is_accessibility_enabled);
virtual int GetNextRoutingID();
virtual void CancelResourceRequests(int render_widget_id);
virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params);
diff --git a/content/browser/renderer_host/render_process_host.cc b/content/browser/renderer_host/render_process_host.cc
index cf380ab..f435e7c 100644
--- a/content/browser/renderer_host/render_process_host.cc
+++ b/content/browser/renderer_host/render_process_host.cc
@@ -94,6 +94,7 @@ RenderProcessHost::RenderProcessHost(Profile* profile)
: max_page_id_(-1),
fast_shutdown_started_(false),
deleting_soon_(false),
+ is_extension_process_(false),
id_(ChildProcessInfo::GenerateChildProcessUniqueId()),
profile_(profile),
sudden_termination_allowed_(true),
diff --git a/content/browser/renderer_host/render_process_host.h b/content/browser/renderer_host/render_process_host.h
index b384026..4a76d1f 100644
--- a/content/browser/renderer_host/render_process_host.h
+++ b/content/browser/renderer_host/render_process_host.h
@@ -88,6 +88,9 @@ class RenderProcessHost : public IPC::Channel::Sender,
sudden_termination_allowed_ = enabled;
}
+ bool is_extension_process() const { return is_extension_process_; }
+ void mark_is_extension_process() { is_extension_process_ = true; }
+
// Used for refcounting, each holder of this object must Attach and Release
// just like it would for a COM object. This object should be allocated on
// the heap; when no listeners own it any more, it will delete itself.
@@ -157,8 +160,7 @@ class RenderProcessHost : public IPC::Channel::Sender,
// 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, bool is_extensions_process) = 0;
+ virtual bool Init(bool is_accessibility_enabled) = 0;
// Gets the next available routing id.
virtual int GetNextRoutingID() = 0;
@@ -276,6 +278,10 @@ class RenderProcessHost : public IPC::Channel::Sender,
// True if we've posted a DeleteTask and will be deleted soon.
bool deleting_soon_;
+ // True iff this process is being used as an extension process. Not valid
+ // when running in single-process mode.
+ bool is_extension_process_;
+
private:
// The globally-unique identifier for this RPH.
int id_;
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 47e5457..c74ac5e 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -102,7 +102,6 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
are_javascript_messages_suppressed_(false),
sudden_termination_allowed_(false),
session_storage_namespace_(session_storage),
- is_extension_process_(false),
save_accessibility_tree_for_testing_(false),
render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) {
if (!session_storage_namespace_) {
@@ -114,6 +113,11 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
DCHECK(delegate_);
content::GetContentClient()->browser()->RenderViewHostCreated(this);
+
+ NotificationService::current()->Notify(
+ NotificationType::RENDER_VIEW_HOST_CREATED,
+ Source<RenderViewHost>(this),
+ NotificationService::NoDetails());
}
RenderViewHost::~RenderViewHost() {
@@ -139,7 +143,7 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) {
// initialized it) or may not (we have our own process or the old process
// crashed) have been initialized. Calling Init multiple times will be
// ignored, so this is safe.
- if (!process()->Init(renderer_accessible(), is_extension_process_))
+ if (!process()->Init(renderer_accessible()))
return false;
DCHECK(process()->HasConnection());
DCHECK(process()->profile());
@@ -152,10 +156,6 @@ bool RenderViewHost::CreateRenderView(const string16& frame_name) {
if (BindingsPolicy::is_extension_enabled(enabled_bindings_)) {
ChildProcessSecurityPolicy::GetInstance()->GrantExtensionBindings(
process()->id());
-
- // Extensions may have permission to access chrome:// URLs.
- ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
- process()->id(), chrome::kChromeUIScheme);
}
renderer_initialized_ = true;
diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h
index bfd7bf85..b29f2ed 100644
--- a/content/browser/renderer_host/render_view_host.h
+++ b/content/browser/renderer_host/render_view_host.h
@@ -314,12 +314,6 @@ class RenderViewHost : public RenderWidgetHost {
// RenderView. See BindingsPolicy for details.
int enabled_bindings() const { return enabled_bindings_; }
- // See variable comment.
- bool is_extension_process() const { return is_extension_process_; }
- void set_is_extension_process(bool is_extension_process) {
- is_extension_process_ = is_extension_process;
- }
-
// Sets a property with the given name and value on the Web UI binding object.
// Must call AllowWebUIBindings() on this renderer first.
void SetWebUIProperty(const std::string& name, const std::string& value);
@@ -599,10 +593,6 @@ class RenderViewHost : public RenderWidgetHost {
// The session storage namespace to be used by the associated render view.
scoped_refptr<SessionStorageNamespace> session_storage_namespace_;
- // Whether this render view will get extension api bindings. This controls
- // what process type we use.
- bool is_extension_process_;
-
// Whether the accessibility tree should be saved, for unit testing.
bool save_accessibility_tree_for_testing_;