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

Unified 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: self.nit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index 75b40d2174aa53c8e272bf5365d7ea80441b9e56..42f6052066d8f73be0ac433829d1f6bb1149d5e3 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -83,6 +83,7 @@ using blink::WebThemeEngine;
using blink::WebURL;
using blink::WebURLError;
using blink::WebURLLoader;
+using scheduler::WebThreadImplForWorkerScheduler;
namespace content {
@@ -482,6 +483,16 @@ void BlinkPlatformImpl::InternalInit() {
}
}
+void BlinkPlatformImpl::WaitUntilWebThreadTLSUpdate(
+ scheduler::WebThreadBase* thread) {
+ base::WaitableEvent event(false, false);
+ thread->TaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this),
+ base::Unretained(thread), base::Unretained(&event)));
+ event.Wait();
+}
+
void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread,
base::WaitableEvent* event) {
DCHECK(!current_thread_slot_.Get());
@@ -551,21 +562,18 @@ bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const {
}
blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
- return createThreadWithOptions(name, base::Thread::Options()).release();
-}
-
-scoped_ptr<scheduler::WebThreadBase> BlinkPlatformImpl::createThreadWithOptions(
- const char* name,
- base::Thread::Options options) {
- scoped_ptr<scheduler::WebThreadBase> thread(
- new scheduler::WebThreadImplForWorkerScheduler(name, options));
- base::WaitableEvent event(false, false);
- thread->TaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, base::Unretained(this),
- base::Unretained(thread.get()), base::Unretained(&event)));
- event.Wait();
- return thread;
+ scoped_ptr<WebThreadImplForWorkerScheduler> thread(
+ new WebThreadImplForWorkerScheduler(name));
+ thread->Init();
+ WaitUntilWebThreadTLSUpdate(thread.get());
+ return thread.release();
+}
+
+void BlinkPlatformImpl::SetCompositorThread(
+ scheduler::WebThreadBase* compositor_thread) {
+ compositor_thread_ = compositor_thread;
+ if (compositor_thread_)
+ WaitUntilWebThreadTLSUpdate(compositor_thread_);
}
blink::WebThread* BlinkPlatformImpl::currentThread() {
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698