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

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: Release Mailbox if UsingSharedMemoryResources changed in TextureLayer::Update 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
« cc/trees/single_thread_proxy.cc ('K') | « 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 cdf05c01db9d9506caf135323b967cf6855be1f7..878b55dbab9901059dd3dcaba4092d69c321ceab 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -338,18 +338,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(
@@ -411,6 +418,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());
@@ -962,7 +985,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 =
@@ -979,7 +1003,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");
@@ -1022,6 +1047,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,
@@ -1384,7 +1410,22 @@ void ThreadProxy::DidBeginImplFrameDeadline() {
void ThreadProxy::ReadyToFinalizeTextureUpdates() {
DCHECK(IsImplThread());
- impl().scheduler->FinishCommit();
+
+ const RendererCapabilitiesImpl& impl_caps =
enne (OOO) 2014/02/14 20:21:48 I don't quite follow what sorts of caps aren't sup
boliu 2014/02/14 20:45:42 I thought it might be a problem. But I don't know
+ 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() {
« cc/trees/single_thread_proxy.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698