| Index: cc/trees/thread_proxy.cc
|
| diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
|
| index a757a82bae40db9b42012094aab6469165b8289b..6c5f11a758ae762b8eeda5d98d26edca49ce8e3a 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,21 @@ 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 +981,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 +999,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");
|
| @@ -992,6 +1016,17 @@ void ThreadProxy::StartCommitOnImplThread(
|
| return;
|
| }
|
|
|
| + const RendererCapabilitiesImpl& impl_caps =
|
| + impl().layer_tree_host_impl->GetRendererCapabilities();
|
| + if (!impl_caps.Equals(main_frame_renderer_caps)) {
|
| + TRACE_EVENT_INSTANT0(
|
| + "cc", "EarlyOut_StaleRendererCaps", TRACE_EVENT_SCOPE_THREAD);
|
| + completion->Signal();
|
| + bool did_handle = true;
|
| + BeginMainFrameAbortedOnImplThread(did_handle);
|
| + return;
|
| + }
|
| +
|
| if (offscreen_context_provider.get())
|
| offscreen_context_provider->BindToCurrentThread();
|
| impl().layer_tree_host_impl->SetOffscreenContextProvider(
|
|
|