 Chromium Code Reviews
 Chromium Code Reviews Issue 1449953002:
  compositor-worker: Refactor CompositorWorkerManager  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1449953002:
  compositor-worker: Refactor CompositorWorkerManager  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: content/child/blink_platform_impl.cc | 
| diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc | 
| index ca621267cf83df6204699d1f2ef338b7ebf54f5c..1f05b21b957eced95221f949f14dfb31bb5a12e4 100644 | 
| --- a/content/child/blink_platform_impl.cc | 
| +++ b/content/child/blink_platform_impl.cc | 
| @@ -25,6 +25,7 @@ | 
| #include "base/sys_info.h" | 
| #include "base/thread_task_runner_handle.h" | 
| #include "base/threading/platform_thread.h" | 
| +#include "base/threading/thread.h" | 
| #include "base/time/time.h" | 
| #include "base/trace_event/memory_allocator_dump_guid.h" | 
| #include "base/trace_event/memory_dump_manager.h" | 
| @@ -442,7 +443,8 @@ BlinkPlatformImpl::BlinkPlatformImpl() | 
| BlinkPlatformImpl::BlinkPlatformImpl( | 
| scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) | 
| - : main_thread_task_runner_(main_thread_task_runner) { | 
| + : main_thread_task_runner_(main_thread_task_runner), | 
| + compositor_thread_(nullptr) { | 
| InternalInit(); | 
| } | 
| @@ -529,14 +531,30 @@ bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const { | 
| } | 
| blink::WebThread* BlinkPlatformImpl::createThread(const char* name) { | 
| + base::Thread::Options options; | 
| scheduler::WebThreadImplForWorkerScheduler* thread = | 
| - new scheduler::WebThreadImplForWorkerScheduler(name); | 
| + new scheduler::WebThreadImplForWorkerScheduler(name, options); | 
| thread->TaskRunner()->PostTask( | 
| FROM_HERE, base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, | 
| base::Unretained(this), thread)); | 
| return thread; | 
| } | 
| +blink::WebThread* BlinkPlatformImpl::createThreadForCompositor( | 
| + const char* name) { | 
| + base::Thread::Options options; | 
| + DCHECK(!compositor_thread_); | 
| +#if defined(OS_ANDROID) | 
| + options.priority = base::ThreadPriority::DISPLAY; | 
| +#endif | 
| + compositor_thread_ = | 
| + new scheduler::WebThreadImplForWorkerScheduler(name, options); | 
| 
piman
2015/11/30 21:41:45
I think this makes ownership muddy and confusing.
 
Ian Vollick
2015/12/01 04:00:04
Agree that this is crummy, but I think there's som
 
piman
2015/12/01 04:24:10
Unretained(this) is still fine if BlinkPlatformImp
 
Ian Vollick
2015/12/01 05:01:08
I think I've got a plan, but before describing it
 | 
| + compositor_thread_->TaskRunner()->PostTask( | 
| + FROM_HERE, base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS, | 
| + base::Unretained(this), compositor_thread_)); | 
| + return compositor_thread_; | 
| +} | 
| + | 
| blink::WebThread* BlinkPlatformImpl::currentThread() { | 
| return static_cast<blink::WebThread*>(current_thread_slot_.Get()); | 
| } | 
| @@ -1089,6 +1107,10 @@ void BlinkPlatformImpl::cryptographicallyRandomValues( | 
| base::RandBytes(buffer, length); | 
| } | 
| +blink::WebThread* BlinkPlatformImpl::compositorThread() const { | 
| + return compositor_thread_; | 
| +} | 
| + | 
| blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( | 
| blink::WebGestureDevice device_source, | 
| const blink::WebFloatPoint& velocity, |