| Index: cc/trees/thread_proxy.cc
|
| diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
|
| index a757a82bae40db9b42012094aab6469165b8289b..2f317bbe4f6a0c21becc75b2b84e649cbffc566e 100644
|
| --- a/cc/trees/thread_proxy.cc
|
| +++ b/cc/trees/thread_proxy.cc
|
| @@ -335,18 +335,25 @@ void ThreadProxy::DoCreateAndInitializeOutputSurface() {
|
| OnOutputSurfaceInitializeAttempted(success, capabilities);
|
| }
|
|
|
| +void ThreadProxy::SetRendererCapabilitiesMainThreadCopy(
|
| + const RendererCapabilities& capabilities) {
|
| + DCHECK(IsMainThread());
|
| + main().renderer_capabilities_main_thread_copy = capabilities;
|
| + layer_tree_host()->RendererCapabilitiesChanged();
|
| +}
|
| +
|
| void ThreadProxy::OnOutputSurfaceInitializeAttempted(
|
| bool success,
|
| const RendererCapabilities& capabilities) {
|
| DCHECK(IsMainThread());
|
| DCHECK(layer_tree_host());
|
|
|
| + LayerTreeHost::CreateResult result =
|
| + layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success);
|
| if (success) {
|
| - main().renderer_capabilities_main_thread_copy = capabilities;
|
| + SetRendererCapabilitiesMainThreadCopy(capabilities);
|
| }
|
|
|
| - LayerTreeHost::CreateResult result =
|
| - layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success);
|
| if (result == LayerTreeHost::CreateFailedButTryAgain) {
|
| if (!main().output_surface_creation_callback.callback().is_null()) {
|
| Proxy::MainThreadTaskRunner()->PostTask(
|
| @@ -408,6 +415,22 @@ void ThreadProxy::SetNeedsCommit() {
|
| SendCommitRequestToImplThreadIfNeeded();
|
| }
|
|
|
| +void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
|
| + DCHECK(IsImplThread());
|
| + // PrioritizedResourceManager is not cleared, so this won't yet work with
|
| + // ContentLayer or ImageLayer, which are only used when impl_side_painting is
|
| + // off.
|
| + DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting);
|
| +
|
| + Proxy::MainThreadTaskRunner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&ThreadProxy::SetRendererCapabilitiesMainThreadCopy,
|
| + main_thread_weak_ptr_,
|
| + impl()
|
| + .layer_tree_host_impl->GetRendererCapabilities()
|
| + .MainThreadCapabilities()));
|
| +}
|
| +
|
| void ThreadProxy::DidLoseOutputSurfaceOnImplThread() {
|
| TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread");
|
| DCHECK(IsImplThread());
|
| @@ -959,7 +982,8 @@ void ThreadProxy::BeginMainFrame(
|
| impl_thread_weak_ptr_,
|
| &completion,
|
| queue.release(),
|
| - offscreen_context_provider));
|
| + offscreen_context_provider,
|
| + main().renderer_capabilities_main_thread_copy));
|
| completion.Wait();
|
|
|
| RenderingStatsInstrumentation* stats_instrumentation =
|
| @@ -976,7 +1000,8 @@ void ThreadProxy::BeginMainFrame(
|
| void ThreadProxy::StartCommitOnImplThread(
|
| CompletionEvent* completion,
|
| ResourceUpdateQueue* raw_queue,
|
| - scoped_refptr<ContextProvider> offscreen_context_provider) {
|
| + scoped_refptr<ContextProvider> offscreen_context_provider,
|
| + const RendererCapabilities& main_frame_renderer_caps) {
|
| scoped_ptr<ResourceUpdateQueue> queue(raw_queue);
|
|
|
| TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread");
|
| @@ -1019,6 +1044,7 @@ void ThreadProxy::StartCommitOnImplThread(
|
| impl().contents_texture_manager->PushTexturePrioritiesToBackings();
|
| }
|
|
|
| + impl().renderer_capabilities_for_commit = main_frame_renderer_caps;
|
| impl().commit_completion_event = completion;
|
| impl().current_resource_update_controller = ResourceUpdateController::Create(
|
| this,
|
| @@ -1381,7 +1407,22 @@ void ThreadProxy::DidBeginImplFrameDeadline() {
|
|
|
| void ThreadProxy::ReadyToFinalizeTextureUpdates() {
|
| DCHECK(IsImplThread());
|
| - impl().scheduler->FinishCommit();
|
| +
|
| + const RendererCapabilitiesImpl& impl_caps =
|
| + impl().layer_tree_host_impl->GetRendererCapabilities();
|
| + if (impl_caps.MainThreadCapabilities() ==
|
| + impl().renderer_capabilities_for_commit) {
|
| + impl().scheduler->FinishCommit();
|
| + } else {
|
| + TRACE_EVENT_INSTANT0(
|
| + "cc", "EarlyOut_StaleRendererCaps", TRACE_EVENT_SCOPE_THREAD);
|
| + if (impl().commit_completion_event) {
|
| + impl().commit_completion_event->Signal();
|
| + impl().commit_completion_event = NULL;
|
| + bool did_handle = true;
|
| + BeginMainFrameAbortedOnImplThread(did_handle);
|
| + }
|
| + }
|
| }
|
|
|
| void ThreadProxy::DidCommitAndDrawFrame() {
|
|
|