Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 2093983002: scheduler: Tell v8 about the current RAIL mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing gyp dependencies Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/fake_renderer_scheduler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 shared_main_thread_contexts_ = nullptr; 956 shared_main_thread_contexts_ = nullptr;
957 957
958 if (gpu_channel_.get()) 958 if (gpu_channel_.get())
959 gpu_channel_->DestroyChannel(); 959 gpu_channel_->DestroyChannel();
960 960
961 ChildThreadImpl::Shutdown(); 961 ChildThreadImpl::Shutdown();
962 962
963 // Shut down the message loop and the renderer scheduler before shutting down 963 // Shut down the message loop and the renderer scheduler before shutting down
964 // Blink. This prevents a scenario where a pending task in the message loop 964 // Blink. This prevents a scenario where a pending task in the message loop
965 // accesses Blink objects after Blink shuts down. 965 // accesses Blink objects after Blink shuts down.
966 renderer_scheduler_->SetRAILModeObserver(nullptr);
966 renderer_scheduler_->Shutdown(); 967 renderer_scheduler_->Shutdown();
967 if (main_message_loop_) 968 if (main_message_loop_)
968 main_message_loop_->RunUntilIdle(); 969 main_message_loop_->RunUntilIdle();
969 970
970 if (blink_platform_impl_) { 971 if (blink_platform_impl_) {
971 blink_platform_impl_->Shutdown(); 972 blink_platform_impl_->Shutdown();
972 // This must be at the very end of the shutdown sequence. 973 // This must be at the very end of the shutdown sequence.
973 // blink::shutdown() must be called after all strong references from 974 // blink::shutdown() must be called after all strong references from
974 // Chromium to Blink are cleared. 975 // Chromium to Blink are cleared.
975 blink::shutdown(); 976 blink::shutdown();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line); 1170 SetRuntimeFeaturesDefaultsAndUpdateFromArgs(command_line);
1170 1171
1171 blink_platform_impl_.reset(new RendererBlinkPlatformImpl( 1172 blink_platform_impl_.reset(new RendererBlinkPlatformImpl(
1172 renderer_scheduler_.get(), 1173 renderer_scheduler_.get(),
1173 GetRemoteInterfaces()->GetWeakPtr())); 1174 GetRemoteInterfaces()->GetWeakPtr()));
1174 blink::initialize(blink_platform_impl_.get()); 1175 blink::initialize(blink_platform_impl_.get());
1175 1176
1176 v8::Isolate* isolate = blink::mainThreadIsolate(); 1177 v8::Isolate* isolate = blink::mainThreadIsolate();
1177 isolate->SetCreateHistogramFunction(CreateHistogram); 1178 isolate->SetCreateHistogramFunction(CreateHistogram);
1178 isolate->SetAddHistogramSampleFunction(AddHistogramSample); 1179 isolate->SetAddHistogramSampleFunction(AddHistogramSample);
1180 renderer_scheduler_->SetRAILModeObserver(this);
1179 1181
1180 main_thread_compositor_task_runner_ = 1182 main_thread_compositor_task_runner_ =
1181 renderer_scheduler_->CompositorTaskRunner(); 1183 renderer_scheduler_->CompositorTaskRunner();
1182 1184
1183 main_input_callback_.Reset( 1185 main_input_callback_.Reset(
1184 base::Bind(base::IgnoreResult(&RenderThreadImpl::OnMessageReceived), 1186 base::Bind(base::IgnoreResult(&RenderThreadImpl::OnMessageReceived),
1185 base::Unretained(this))); 1187 base::Unretained(this)));
1186 1188
1187 scoped_refptr<base::SingleThreadTaskRunner> resource_task_queue2; 1189 scoped_refptr<base::SingleThreadTaskRunner> resource_task_queue2;
1188 if (resource_task_queue) { 1190 if (resource_task_queue) {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 } 1638 }
1637 1639
1638 bool RenderThreadImpl::AreImageDecodeTasksEnabled() { 1640 bool RenderThreadImpl::AreImageDecodeTasksEnabled() {
1639 return are_image_decode_tasks_enabled_; 1641 return are_image_decode_tasks_enabled_;
1640 } 1642 }
1641 1643
1642 bool RenderThreadImpl::IsThreadedAnimationEnabled() { 1644 bool RenderThreadImpl::IsThreadedAnimationEnabled() {
1643 return is_threaded_animation_enabled_; 1645 return is_threaded_animation_enabled_;
1644 } 1646 }
1645 1647
1648 void RenderThreadImpl::OnRAILModeChanged(v8::RAILMode rail_mode) {
1649 blink::mainThreadIsolate()->SetRAILMode(rail_mode);
1650 blink::setRAILModeOnWorkerThreadIsolates(rail_mode);
1651 }
1652
1646 bool RenderThreadImpl::IsMainThread() { 1653 bool RenderThreadImpl::IsMainThread() {
1647 return !!current(); 1654 return !!current();
1648 } 1655 }
1649 1656
1650 scoped_refptr<base::SingleThreadTaskRunner> 1657 scoped_refptr<base::SingleThreadTaskRunner>
1651 RenderThreadImpl::GetIOThreadTaskRunner() { 1658 RenderThreadImpl::GetIOThreadTaskRunner() {
1652 return io_thread_task_runner_; 1659 return io_thread_task_runner_;
1653 } 1660 }
1654 1661
1655 std::unique_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( 1662 std::unique_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory(
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) 2228 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical)
2222 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; 2229 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate;
2223 2230
2224 blink::mainThreadIsolate()->MemoryPressureNotification( 2231 blink::mainThreadIsolate()->MemoryPressureNotification(
2225 v8_memory_pressure_level); 2232 v8_memory_pressure_level);
2226 blink::MemoryPressureNotificationToWorkerThreadIsolates( 2233 blink::MemoryPressureNotificationToWorkerThreadIsolates(
2227 v8_memory_pressure_level); 2234 v8_memory_pressure_level);
2228 } 2235 }
2229 2236
2230 } // namespace content 2237 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | content/test/fake_renderer_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698