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

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

Issue 2810883002: [scheduler] Remove webthread_impl_for_worker_scheduler from public API. (Closed)
Patch Set: Add TODO to remove WebThreadBase from public API Created 3 years, 8 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
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 #include "services/ui/public/interfaces/constants.mojom.h" 149 #include "services/ui/public/interfaces/constants.mojom.h"
150 #include "skia/ext/event_tracer_impl.h" 150 #include "skia/ext/event_tracer_impl.h"
151 #include "skia/ext/skia_memory_dump_provider.h" 151 #include "skia/ext/skia_memory_dump_provider.h"
152 #include "third_party/WebKit/public/platform/WebCache.h" 152 #include "third_party/WebKit/public/platform/WebCache.h"
153 #include "third_party/WebKit/public/platform/WebImageGenerator.h" 153 #include "third_party/WebKit/public/platform/WebImageGenerator.h"
154 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" 154 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h"
155 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" 155 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h"
156 #include "third_party/WebKit/public/platform/WebString.h" 156 #include "third_party/WebKit/public/platform/WebString.h"
157 #include "third_party/WebKit/public/platform/WebThread.h" 157 #include "third_party/WebKit/public/platform/WebThread.h"
158 #include "third_party/WebKit/public/platform/scheduler/child/compositor_worker_s cheduler.h" 158 #include "third_party/WebKit/public/platform/scheduler/child/compositor_worker_s cheduler.h"
159 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_ worker_scheduler.h" 159 #include "third_party/WebKit/public/platform/scheduler/child/webthread_base.h"
160 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" 160 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
161 #include "third_party/WebKit/public/web/WebDatabase.h" 161 #include "third_party/WebKit/public/web/WebDatabase.h"
162 #include "third_party/WebKit/public/web/WebDocument.h" 162 #include "third_party/WebKit/public/web/WebDocument.h"
163 #include "third_party/WebKit/public/web/WebFrame.h" 163 #include "third_party/WebKit/public/web/WebFrame.h"
164 #include "third_party/WebKit/public/web/WebKit.h" 164 #include "third_party/WebKit/public/web/WebKit.h"
165 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 165 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
166 #include "third_party/WebKit/public/web/WebScriptController.h" 166 #include "third_party/WebKit/public/web/WebScriptController.h"
167 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 167 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
168 #include "third_party/WebKit/public/web/WebView.h" 168 #include "third_party/WebKit/public/web/WebView.h"
169 #include "third_party/skia/include/core/SkGraphics.h" 169 #include "third_party/skia/include/core/SkGraphics.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 using base::ThreadRestrictions; 220 using base::ThreadRestrictions;
221 using blink::WebDocument; 221 using blink::WebDocument;
222 using blink::WebFrame; 222 using blink::WebFrame;
223 using blink::WebNetworkStateNotifier; 223 using blink::WebNetworkStateNotifier;
224 using blink::WebRuntimeFeatures; 224 using blink::WebRuntimeFeatures;
225 using blink::WebScriptController; 225 using blink::WebScriptController;
226 using blink::WebSecurityPolicy; 226 using blink::WebSecurityPolicy;
227 using blink::WebString; 227 using blink::WebString;
228 using blink::WebView; 228 using blink::WebView;
229 using blink::scheduler::WebThreadImplForWorkerScheduler;
230 229
231 namespace content { 230 namespace content {
232 231
233 namespace { 232 namespace {
234 233
235 const int64_t kInitialIdleHandlerDelayMs = 1000; 234 const int64_t kInitialIdleHandlerDelayMs = 1000;
236 const int64_t kLongIdleHandlerDelayMs = 30 * 1000; 235 const int64_t kLongIdleHandlerDelayMs = 30 * 1000;
237 236
238 #if defined(OS_ANDROID) 237 #if defined(OS_ANDROID)
239 // On Android, resource messages can each take ~1.5ms to dispatch on the browser 238 // On Android, resource messages can each take ~1.5ms to dispatch on the browser
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 static_cast<blink::WebMemoryPressureLevel>( 282 static_cast<blink::WebMemoryPressureLevel>(
284 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE) == 283 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE) ==
285 blink::kWebMemoryPressureLevelModerate, 284 blink::kWebMemoryPressureLevelModerate,
286 "blink::WebMemoryPressureLevelModerate not align"); 285 "blink::WebMemoryPressureLevelModerate not align");
287 static_assert( 286 static_assert(
288 static_cast<blink::WebMemoryPressureLevel>( 287 static_cast<blink::WebMemoryPressureLevel>(
289 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) == 288 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) ==
290 blink::kWebMemoryPressureLevelCritical, 289 blink::kWebMemoryPressureLevelCritical,
291 "blink::WebMemoryPressureLevelCritical not align"); 290 "blink::WebMemoryPressureLevelCritical not align");
292 291
293 class WebThreadForCompositor : public WebThreadImplForWorkerScheduler {
294 public:
295 explicit WebThreadForCompositor(base::Thread::Options options)
296 : WebThreadImplForWorkerScheduler("Compositor", options) {
297 Init();
298 }
299 ~WebThreadForCompositor() override {}
300
301 private:
302 // WebThreadImplForWorkerScheduler:
303 std::unique_ptr<blink::scheduler::WorkerScheduler> CreateWorkerScheduler()
304 override {
305 return base::MakeUnique<blink::scheduler::CompositorWorkerScheduler>(
306 GetThread());
307 }
308
309 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor);
310 };
311
312 void* CreateHistogram( 292 void* CreateHistogram(
313 const char *name, int min, int max, size_t buckets) { 293 const char *name, int min, int max, size_t buckets) {
314 if (min <= 0) 294 if (min <= 0)
315 min = 1; 295 min = 1;
316 std::string histogram_name; 296 std::string histogram_name;
317 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); 297 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current();
318 if (render_thread_impl) { // Can be null in tests. 298 if (render_thread_impl) { // Can be null in tests.
319 histogram_name = render_thread_impl-> 299 histogram_name = render_thread_impl->
320 histogram_customizer()->ConvertToCustomHistogramName(name); 300 histogram_customizer()->ConvertToCustomHistogramName(name);
321 } else { 301 } else {
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 void RenderThreadImpl::SetResourceDispatcherDelegate( 1060 void RenderThreadImpl::SetResourceDispatcherDelegate(
1081 ResourceDispatcherDelegate* delegate) { 1061 ResourceDispatcherDelegate* delegate) {
1082 resource_dispatcher()->set_delegate(delegate); 1062 resource_dispatcher()->set_delegate(delegate);
1083 } 1063 }
1084 1064
1085 void RenderThreadImpl::InitializeCompositorThread() { 1065 void RenderThreadImpl::InitializeCompositorThread() {
1086 base::Thread::Options options; 1066 base::Thread::Options options;
1087 #if defined(OS_ANDROID) 1067 #if defined(OS_ANDROID)
1088 options.priority = base::ThreadPriority::DISPLAY; 1068 options.priority = base::ThreadPriority::DISPLAY;
1089 #endif 1069 #endif
1090 compositor_thread_.reset(new WebThreadForCompositor(options)); 1070 compositor_thread_ =
1071 blink::scheduler::WebThreadBase::CreateCompositorThread(options);
1091 blink_platform_impl_->SetCompositorThread(compositor_thread_.get()); 1072 blink_platform_impl_->SetCompositorThread(compositor_thread_.get());
1092 compositor_task_runner_ = compositor_thread_->GetTaskRunner(); 1073 compositor_task_runner_ = compositor_thread_->GetTaskRunner();
1093 compositor_task_runner_->PostTask( 1074 compositor_task_runner_->PostTask(
1094 FROM_HERE, 1075 FROM_HERE,
1095 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), false)); 1076 base::Bind(base::IgnoreResult(&ThreadRestrictions::SetIOAllowed), false));
1096 #if defined(OS_LINUX) 1077 #if defined(OS_LINUX)
1097 ChildThreadImpl::current()->SetThreadPriority(compositor_thread_->ThreadId(), 1078 ChildThreadImpl::current()->SetThreadPriority(compositor_thread_->ThreadId(),
1098 base::ThreadPriority::DISPLAY); 1079 base::ThreadPriority::DISPLAY);
1099 #endif 1080 #endif
1100 1081
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 } 2449 }
2469 } 2450 }
2470 2451
2471 void RenderThreadImpl::OnRendererInterfaceRequest( 2452 void RenderThreadImpl::OnRendererInterfaceRequest(
2472 mojom::RendererAssociatedRequest request) { 2453 mojom::RendererAssociatedRequest request) {
2473 DCHECK(!renderer_binding_.is_bound()); 2454 DCHECK(!renderer_binding_.is_bound());
2474 renderer_binding_.Bind(std::move(request)); 2455 renderer_binding_.Bind(std::move(request));
2475 } 2456 }
2476 2457
2477 } // namespace content 2458 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698