Commit f3437441 authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Commit Bot

Pass a task runner to base::Timer at RenderViewImpl

This is part of efforts to replace base::ThreadTaskRunnerHandle::Get()
and SequencedTaskRunnerHandle::Get() with other appropriate task runners
in the renderer.

This avoids the SequencedTaskRunnerHandle::Get() call when the constructor's
default parameter is used. We are trying to ban SequencedTaskRunnerHandle::Get()
in content/renderer because it usually is not the right task runner to use,
as a per-frame runner should be used instead. In this case, it doesn't
really matter since frames are not involved, but we still want to remove the
calls for the bigger benefit of banning it in content/renderer.

Bug: 786332
Change-Id: I96a5c6657c029bd685e2302a778316b69b3af683
Reviewed-on: https://chromium-review.googlesource.com/942287
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540820}
parent 6949ff07
...@@ -505,7 +505,8 @@ RenderViewImpl::RenderViewImpl( ...@@ -505,7 +505,8 @@ RenderViewImpl::RenderViewImpl(
void RenderViewImpl::Initialize( void RenderViewImpl::Initialize(
mojom::CreateViewParamsPtr params, mojom::CreateViewParamsPtr params,
const RenderWidget::ShowCallback& show_callback) { const RenderWidget::ShowCallback& show_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
bool was_created_by_renderer = !show_callback.is_null(); bool was_created_by_renderer = !show_callback.is_null();
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// TODO(sgurun): crbug.com/325351 Needed only for android webview's deprecated // TODO(sgurun): crbug.com/325351 Needed only for android webview's deprecated
...@@ -622,6 +623,9 @@ void RenderViewImpl::Initialize( ...@@ -622,6 +623,9 @@ void RenderViewImpl::Initialize(
GetContentClient()->renderer()->RenderViewCreated(this); GetContentClient()->renderer()->RenderViewCreated(this);
page_zoom_level_ = params->page_zoom_level; page_zoom_level_ = params->page_zoom_level;
nav_state_sync_timer_.SetTaskRunner(task_runner);
check_preferred_size_timer_.SetTaskRunner(std::move(task_runner));
} }
RenderViewImpl::~RenderViewImpl() { RenderViewImpl::~RenderViewImpl() {
...@@ -994,7 +998,8 @@ RenderViewImpl* RenderViewImpl::Create( ...@@ -994,7 +998,8 @@ RenderViewImpl* RenderViewImpl::Create(
else else
render_view = new RenderViewImpl(compositor_deps, *params, task_runner); render_view = new RenderViewImpl(compositor_deps, *params, task_runner);
render_view->Initialize(std::move(params), show_callback); render_view->Initialize(std::move(params), show_callback,
std::move(task_runner));
return render_view; return render_view;
} }
......
...@@ -392,7 +392,8 @@ class CONTENT_EXPORT RenderViewImpl : public RenderWidget, ...@@ -392,7 +392,8 @@ class CONTENT_EXPORT RenderViewImpl : public RenderWidget,
scoped_refptr<base::SingleThreadTaskRunner> task_runner); scoped_refptr<base::SingleThreadTaskRunner> task_runner);
void Initialize(mojom::CreateViewParamsPtr params, void Initialize(mojom::CreateViewParamsPtr params,
const RenderWidget::ShowCallback& show_callback); const RenderWidget::ShowCallback& show_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner);
void SetScreenMetricsEmulationParameters( void SetScreenMetricsEmulationParameters(
bool enabled, bool enabled,
const blink::WebDeviceEmulationParams& params) override; const blink::WebDeviceEmulationParams& params) override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment