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

Unified Diff: content/child/blink_platform_impl.cc

Issue 1449953002: compositor-worker: Refactor CompositorWorkerManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clarify compositor thread ownership. guarantee initialization correctness. Created 5 years 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
Index: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index cb6a4fdebe2206c7629d6d52f355479f39f80590..e723a1f40f6c3795ed20b070cd4839b307d555ed 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,8 +531,14 @@ bool BlinkPlatformImpl::portAllowed(const blink::WebURL& url) const {
}
blink::WebThread* BlinkPlatformImpl::createThread(const char* name) {
- scheduler::WebThreadImplForWorkerScheduler* thread =
- new scheduler::WebThreadImplForWorkerScheduler(name);
+ return createThreadWithOptions(name, base::Thread::Options());
+}
+
+blink::WebThread* BlinkPlatformImpl::createThreadWithOptions(
+ const char* name,
+ base::Thread::Options options) {
+ scheduler::WebThreadBase* thread =
+ new scheduler::WebThreadImplForWorkerScheduler(name, options);
thread->TaskRunner()->PostTask(
FROM_HERE, base::Bind(&BlinkPlatformImpl::UpdateWebThreadTLS,
base::Unretained(this), thread));
@@ -1083,6 +1091,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,

Powered by Google App Engine
This is Rietveld 408576698