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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 1589463002: compositor worker: Use a WebThread for the compositor thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix-mandoline-tests Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
30 #include "base/time/time.h" 30 #include "base/time/time.h"
31 #include "base/trace_event/memory_allocator_dump_guid.h" 31 #include "base/trace_event/memory_allocator_dump_guid.h"
32 #include "base/trace_event/memory_dump_manager.h" 32 #include "base/trace_event/memory_dump_manager.h"
33 #include "base/trace_event/trace_event.h" 33 #include "base/trace_event/trace_event.h"
34 #include "blink/public/resources/grit/blink_image_resources.h" 34 #include "blink/public/resources/grit/blink_image_resources.h"
35 #include "blink/public/resources/grit/blink_resources.h" 35 #include "blink/public/resources/grit/blink_resources.h"
36 #include "build/build_config.h" 36 #include "build/build_config.h"
37 #include "components/mime_util/mime_util.h" 37 #include "components/mime_util/mime_util.h"
38 #include "components/scheduler/child/web_task_runner_impl.h" 38 #include "components/scheduler/child/web_task_runner_impl.h"
39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" 39 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
40 #include "components/scheduler/child/worker_scheduler.h"
40 #include "content/app/resources/grit/content_resources.h" 41 #include "content/app/resources/grit/content_resources.h"
41 #include "content/app/strings/grit/content_strings.h" 42 #include "content/app/strings/grit/content_strings.h"
42 #include "content/child/background_sync/background_sync_provider.h" 43 #include "content/child/background_sync/background_sync_provider.h"
43 #include "content/child/child_thread_impl.h" 44 #include "content/child/child_thread_impl.h"
44 #include "content/child/content_child_helpers.h" 45 #include "content/child/content_child_helpers.h"
45 #include "content/child/geofencing/web_geofencing_provider_impl.h" 46 #include "content/child/geofencing/web_geofencing_provider_impl.h"
46 #include "content/child/navigator_connect/service_port_provider.h" 47 #include "content/child/navigator_connect/service_port_provider.h"
47 #include "content/child/notifications/notification_dispatcher.h" 48 #include "content/child/notifications/notification_dispatcher.h"
48 #include "content/child/notifications/notification_manager.h" 49 #include "content/child/notifications/notification_manager.h"
49 #include "content/child/permissions/permission_dispatcher.h" 50 #include "content/child/permissions/permission_dispatcher.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 using blink::WebThemeEngine; 83 using blink::WebThemeEngine;
83 using blink::WebURL; 84 using blink::WebURL;
84 using blink::WebURLError; 85 using blink::WebURLError;
85 using blink::WebURLLoader; 86 using blink::WebURLLoader;
86 using scheduler::WebThreadImplForWorkerScheduler; 87 using scheduler::WebThreadImplForWorkerScheduler;
87 88
88 namespace content { 89 namespace content {
89 90
90 namespace { 91 namespace {
91 92
93 class CompositorWorkerScheduler : public scheduler::WorkerScheduler {
Sami 2016/01/14 13:55:05 Would you mind putting this to components/schedule
sadrul 2016/01/14 15:20:40 Done (moved to */child/* instead of in */renderer/
94 public:
95 explicit CompositorWorkerScheduler(base::Thread* thread) : thread_(thread) {}
96 ~CompositorWorkerScheduler() override {}
97
98 // WorkerScheduler:
99 scoped_refptr<base::SingleThreadTaskRunner> DefaultTaskRunner() override {
100 return thread_->task_runner();
Sami 2016/01/14 13:55:05 If we do decide to land this pass through schedule
sadrul 2016/01/14 15:20:40 Done.
101 }
102
103 scoped_refptr<scheduler::SingleThreadIdleTaskRunner> IdleTaskRunner()
104 override {
105 return nullptr;
Sami 2016/01/14 13:55:05 Presumably the compositor worker will need to do s
sadrul 2016/01/14 15:20:40 Done.
106 }
107
108 bool CanExceedIdleDeadlineIfRequired() const override { return false; }
109
110 bool ShouldYieldForHighPriorityWork() override { return false; }
111
112 void AddTaskObserver(
113 base::MessageLoop::TaskObserver* task_observer) override {
114 thread_->message_loop()->AddTaskObserver(task_observer);
115 }
116
117 void RemoveTaskObserver(
118 base::MessageLoop::TaskObserver* task_observer) override {
119 thread_->message_loop()->RemoveTaskObserver(task_observer);
120 }
121
122 void Init() override {}
123 void Shutdown() override {}
124
125 private:
126 base::Thread* thread_;
127 DISALLOW_COPY_AND_ASSIGN(CompositorWorkerScheduler);
128 };
129
92 class WebThreadForCompositor : public WebThreadImplForWorkerScheduler { 130 class WebThreadForCompositor : public WebThreadImplForWorkerScheduler {
93 public: 131 public:
94 explicit WebThreadForCompositor(base::Thread::Options options) 132 explicit WebThreadForCompositor(base::Thread::Options options)
95 : WebThreadImplForWorkerScheduler("Compositor", options) { 133 : WebThreadImplForWorkerScheduler("Compositor", options) {
96 Init(); 134 Init();
97 } 135 }
98 ~WebThreadForCompositor() override {} 136 ~WebThreadForCompositor() override {}
99 137
100 private: 138 private:
101 // WebThreadImplForWorkerScheduler: 139 // WebThreadImplForWorkerScheduler:
102 bool UseThreadTaskRunnerAsDefault() const override { return true; } 140 scoped_ptr<scheduler::WorkerScheduler> CreateWorkerScheduler() override {
141 return make_scoped_ptr(new CompositorWorkerScheduler(thread()));
142 }
103 143
104 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor); 144 DISALLOW_COPY_AND_ASSIGN(WebThreadForCompositor);
105 }; 145 };
106 146
107 class WebWaitableEventImpl : public blink::WebWaitableEvent { 147 class WebWaitableEventImpl : public blink::WebWaitableEvent {
108 public: 148 public:
109 WebWaitableEventImpl(ResetPolicy policy, InitialState state) { 149 WebWaitableEventImpl(ResetPolicy policy, InitialState state) {
110 bool manual_reset = policy == ResetPolicy::Manual; 150 bool manual_reset = policy == ResetPolicy::Manual;
111 bool initially_signaled = state == InitialState::Signaled; 151 bool initially_signaled = state == InitialState::Signaled;
112 impl_.reset(new base::WaitableEvent(manual_reset, initially_signaled)); 152 impl_.reset(new base::WaitableEvent(manual_reset, initially_signaled));
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 1374 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
1335 static_cast<ui::DomKey>(dom_key))); 1375 static_cast<ui::DomKey>(dom_key)));
1336 } 1376 }
1337 1377
1338 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 1378 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
1339 return static_cast<int>( 1379 return static_cast<int>(
1340 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); 1380 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
1341 } 1381 }
1342 1382
1343 } // namespace content 1383 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698