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

Unified Diff: cc/trees/thread_proxy.cc

Issue 151093005: cc: Update Main RendererCapabilities on DeferredInitialize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cancel commits with stale caps, no tests yet Created 6 years, 10 months 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
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index a757a82bae40db9b42012094aab6469165b8289b..f3941a7ec2c28bfb31c9dae2a75fe63da1f97558 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,19 @@ void ThreadProxy::SetNeedsCommit() {
SendCommitRequestToImplThreadIfNeeded();
}
+void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
+ DCHECK(IsImplThread());
+ // We don't clear PrioritizedResourceManager.
+ 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 +979,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 +997,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 +1014,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);
boliu 2014/02/07 04:29:55 TEST!
+ 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(
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698