Index: cc/trees/thread_proxy.cc |
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc |
index ae543a3e207deae1015580ce5e0d09d84f6aed96..206edfe3c2a9749f5fccf743604d3505ba7c1ae3 100644 |
--- a/cc/trees/thread_proxy.cc |
+++ b/cc/trees/thread_proxy.cc |
@@ -71,6 +71,11 @@ ThreadProxy::ThreadProxy( |
TRACE_EVENT0("cc", "ThreadProxy::ThreadProxy"); |
DCHECK(IsMainThread()); |
DCHECK(this->layer_tree_host()); |
+ // TODO(khushalsagar): Move this to LayerTreeHost#InitializeThreaded once |
+ // ThreadProxy is split. LayerTreeHost creates the channel and passes it to |
+ // ProxyMain#SetChannel |
David Trainor- moved to gerrit
2015/09/23 17:54:12
. at end.
Khushal
2015/09/23 20:50:28
Done.
|
+ this->SetChannel( |
David Trainor- moved to gerrit
2015/09/23 17:54:12
remove this->?
Khushal
2015/09/23 20:50:28
Done.
|
+ ThreadedChannel::Create(this, main_task_runner, impl_task_runner)); |
} |
ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, |
@@ -123,6 +128,11 @@ ThreadProxy::~ThreadProxy() { |
DCHECK(!main().started); |
} |
+void ThreadProxy::SetChannel(scoped_ptr<ThreadedChannel> threaded_channel) { |
+ threaded_channel_ = threaded_channel.Pass(); |
+ main().channel_main = threaded_channel_.get(); |
+} |
+ |
void ThreadProxy::FinishAllRendering() { |
DCHECK(Proxy::IsMainThread()); |
DCHECK(!main().defer_commits); |
@@ -151,13 +161,10 @@ bool ThreadProxy::CommitToActiveTree() const { |
void ThreadProxy::SetLayerTreeHostClientReady() { |
TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReady"); |
- Proxy::ImplThreadTaskRunner()->PostTask( |
- FROM_HERE, |
- base::Bind(&ThreadProxy::SetLayerTreeHostClientReadyOnImplThread, |
- impl_thread_weak_ptr_)); |
+ main().channel_main->SetLayerTreeHostClientReadyOnImpl(); |
} |
-void ThreadProxy::SetLayerTreeHostClientReadyOnImplThread() { |
+void ThreadProxy::SetLayerTreeHostClientReadyOnImpl() { |
TRACE_EVENT0("cc", "ThreadProxy::SetLayerTreeHostClientReadyOnImplThread"); |
impl().scheduler->SetCanStart(); |
} |
@@ -187,13 +194,10 @@ void ThreadProxy::SetVisibleOnImplThread(CompletionEvent* completion, |
void ThreadProxy::SetThrottleFrameProduction(bool throttle) { |
TRACE_EVENT1("cc", "ThreadProxy::SetThrottleFrameProduction", "throttle", |
throttle); |
- Proxy::ImplThreadTaskRunner()->PostTask( |
- FROM_HERE, |
- base::Bind(&ThreadProxy::SetThrottleFrameProductionOnImplThread, |
- impl_thread_weak_ptr_, throttle)); |
+ main().channel_main->SetThrottleFrameProductionOnImpl(throttle); |
} |
-void ThreadProxy::SetThrottleFrameProductionOnImplThread(bool throttle) { |
+void ThreadProxy::SetThrottleFrameProductionOnImpl(bool throttle) { |
TRACE_EVENT1("cc", "ThreadProxy::SetThrottleFrameProductionOnImplThread", |
"throttle", throttle); |
impl().scheduler->SetThrottleFrameProduction(throttle); |
@@ -359,9 +363,7 @@ void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
"ThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
DCHECK(IsImplThread()); |
impl().scheduler->DidSwapBuffersComplete(); |
- Proxy::MainThreadTaskRunner()->PostTask( |
- FROM_HERE, |
- base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); |
+ impl().channel_impl->DidCompleteSwapBuffers(); |
} |
void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
@@ -1038,6 +1040,11 @@ void ThreadProxy::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events) { |
void ThreadProxy::InitializeImplOnImplThread(CompletionEvent* completion) { |
TRACE_EVENT0("cc", "ThreadProxy::InitializeImplOnImplThread"); |
DCHECK(IsImplThread()); |
+ |
+ // TODO(khushalsagar): ThreadedChannel will create ProxyImpl here and pass a |
+ // reference to itself. |
+ impl().channel_impl = threaded_channel_.get(); |
+ |
impl().layer_tree_host_impl = |
layer_tree_host()->CreateLayerTreeHostImpl(this); |
@@ -1272,4 +1279,12 @@ void ThreadProxy::PostFrameTimingEvents( |
main_frame_events.Pass()); |
} |
+base::WeakPtr<ProxyMain> ThreadProxy::GetMainWeakPtr() { |
+ return main_thread_weak_ptr_; |
+} |
+ |
+base::WeakPtr<ProxyImpl> ThreadProxy::GetImplWeakPtr() { |
+ return impl_thread_weak_ptr_; |
+} |
+ |
} // namespace cc |