summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpcc <pcc@google.com>2015-02-12 15:26:40 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-12 23:27:31 +0000
commitbea94bfec1e16564d5c259653fad5d05dcee4373 (patch)
tree3e45fab38ea7edacaf43050eefd48e22515e7748
parent2fca699d850e379780279c3d0cb27d66eef83a97 (diff)
downloadchromium_src-bea94bfec1e16564d5c259653fad5d05dcee4373.zip
chromium_src-bea94bfec1e16564d5c259653fad5d05dcee4373.tar.gz
chromium_src-bea94bfec1e16564d5c259653fad5d05dcee4373.tar.bz2
Move RenderProcessHostImpl::GetActiveViewCount to RenderProcessHost, remove mock.
Previously, in test cases where MockRenderProcessHost was being used, we were calling the wrong implementation of GetActiveViewCount from RenderViewHostImpl::AllowBindings by static_casting to RenderProcessHostImpl. R=sievers@chromium.org BUG=457523 Review URL: https://codereview.chromium.org/917593002 Cr-Commit-Position: refs/heads/master@{#316079}
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc2
-rw-r--r--content/browser/renderer_host/render_process_host_impl.h4
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc4
-rw-r--r--content/public/browser/render_process_host.h4
-rw-r--r--content/public/test/mock_render_process_host.cc12
-rw-r--r--content/public/test/mock_render_process_host.h2
6 files changed, 6 insertions, 22 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 00d3791..ef995f6 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2094,7 +2094,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead,
// TODO(darin): clean this up
}
-int RenderProcessHostImpl::GetActiveViewCount() {
+int RenderProcessHost::GetActiveViewCount() {
int num_active_views = 0;
scoped_ptr<RenderWidgetHostIterator> widgets(
RenderWidgetHost::GetRenderWidgetHosts());
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index 43a40bc..03733f7 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -174,10 +174,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
child_process_activity_time_ = base::TimeTicks::Now();
}
- // Returns the current number of active views in this process. Excludes
- // any RenderViewHosts that are swapped out.
- int GetActiveViewCount();
-
// Start and end frame subscription for a specific renderer.
// This API only supports subscription to accelerated composited frames.
void BeginFrameSubscription(
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 14e1545..587f144 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -732,10 +732,8 @@ void RenderViewHostImpl::AllowBindings(int bindings_flags) {
GetProcess()->GetID())) {
// This process has no bindings yet. Make sure it does not have more
// than this single active view.
- RenderProcessHostImpl* process =
- static_cast<RenderProcessHostImpl*>(GetProcess());
// --single-process only has one renderer.
- if (process->GetActiveViewCount() > 1 &&
+ if (GetProcess()->GetActiveViewCount() > 1 &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kSingleProcess))
return;
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h
index 19bb6af..bb77498 100644
--- a/content/public/browser/render_process_host.h
+++ b/content/public/browser/render_process_host.h
@@ -277,6 +277,10 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
int cdm_id) const = 0;
#endif
+ // Returns the current number of active views in this process. Excludes
+ // any RenderViewHosts that are swapped out.
+ int GetActiveViewCount();
+
// Static management functions -----------------------------------------------
// Flag to run the renderer in process. This is primarily
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index 21f3140..337cb21 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -193,18 +193,6 @@ IPC::ChannelProxy* MockRenderProcessHost::GetChannel() {
void MockRenderProcessHost::AddFilter(BrowserMessageFilter* filter) {
}
-int MockRenderProcessHost::GetActiveViewCount() {
- int num_active_views = 0;
- scoped_ptr<RenderWidgetHostIterator> widgets(
- RenderWidgetHost::GetRenderWidgetHosts());
- while (RenderWidgetHost* widget = widgets->GetNextHost()) {
- // Count only RenderWidgetHosts in this process.
- if (widget->GetProcess()->GetID() == GetID())
- num_active_views++;
- }
- return num_active_views;
-}
-
bool MockRenderProcessHost::FastShutdownForPageCount(size_t count) {
if (static_cast<size_t>(GetActiveViewCount()) == count)
return FastShutdownIfPossible();
diff --git a/content/public/test/mock_render_process_host.h b/content/public/test/mock_render_process_host.h
index fe43817..cd446db 100644
--- a/content/public/test/mock_render_process_host.h
+++ b/content/public/test/mock_render_process_host.h
@@ -105,8 +105,6 @@ class MockRenderProcessHost : public RenderProcessHost {
factory_ = factory;
}
- int GetActiveViewCount();
-
void set_is_isolated_guest(bool is_isolated_guest) {
is_isolated_guest_ = is_isolated_guest;
}