Chromium Code Reviews| Index: content/renderer/render_thread_impl.cc |
| diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
| index ed37e5ebe2b5cd39365a554dd33d38ee8d1fceaa..189326e22f365dda8856dec3faaa9876a4940761 100644 |
| --- a/content/renderer/render_thread_impl.cc |
| +++ b/content/renderer/render_thread_impl.cc |
| @@ -441,6 +441,11 @@ scoped_refptr<ContextProviderCommandBuffer> CreateOffscreenContext( |
| attributes, nullptr, type)); |
| } |
| +void SetRAILModeOnWorker(v8::RAILMode rail_mode) { |
| + if (v8::Isolate* isolate = v8::Isolate::GetCurrent()) |
|
jochen (gone - plz use gerrit)
2016/06/28 13:20:58
the latest and greatest is introducing helper func
Sami
2016/06/28 13:53:18
I am now aligned with the latest and greatest tren
|
| + isolate->SetRAILMode(rail_mode); |
| +} |
| + |
| } // namespace |
| // For measuring memory usage after each task. Behind a command line flag. |
| @@ -948,6 +953,7 @@ void RenderThreadImpl::Shutdown() { |
| // Shut down the message loop and the renderer scheduler before shutting down |
| // Blink. This prevents a scenario where a pending task in the message loop |
| // accesses Blink objects after Blink shuts down. |
| + renderer_scheduler_->SetRAILModeObserver(nullptr); |
| renderer_scheduler_->Shutdown(); |
| if (main_message_loop_) |
| main_message_loop_->RunUntilIdle(); |
| @@ -1161,6 +1167,7 @@ void RenderThreadImpl::InitializeWebKit( |
| v8::Isolate* isolate = blink::mainThreadIsolate(); |
| isolate->SetCreateHistogramFunction(CreateHistogram); |
| isolate->SetAddHistogramSampleFunction(AddHistogramSample); |
| + renderer_scheduler_->SetRAILModeObserver(this); |
| main_thread_compositor_task_runner_ = |
| renderer_scheduler_->CompositorTaskRunner(); |
| @@ -1628,6 +1635,12 @@ bool RenderThreadImpl::IsThreadedAnimationEnabled() { |
| return is_threaded_animation_enabled_; |
| } |
| +void RenderThreadImpl::OnRAILModeChanged(v8::RAILMode rail_mode) { |
| + blink::mainThreadIsolate()->SetRAILMode(rail_mode); |
| + WorkerThreadRegistry::Instance()->PostTaskToAllThreads( |
| + base::Bind(&SetRAILModeOnWorker, rail_mode)); |
| +} |
| + |
| bool RenderThreadImpl::IsMainThread() { |
| return !!current(); |
| } |