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

Unified Diff: cc/trees/thread_proxy.cc

Issue 14772021: cc::OutputSurfaceClient::InitializeForGL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Dedup and refactor code Created 7 years, 7 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
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index c8b8cc411a5d78e98e7f0b4ae4a55f02186391aa..24f14ed7c41bde4f6202aca50cd8d127b1ee88d6 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -236,9 +236,8 @@ void ThreadProxy::OnOutputSurfaceInitializeAttempted(
DCHECK(IsMainThread());
DCHECK(layer_tree_host_);
- if (success) {
+ if (success)
renderer_capabilities_main_thread_copy_ = capabilities;
- }
LayerTreeHost::CreateResult result =
layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(success);
@@ -287,6 +286,22 @@ void ThreadProxy::SetNeedsCommit() {
&ThreadProxy::SetNeedsCommitOnImplThread, impl_thread_weak_ptr_));
}
+void ThreadProxy::DidUpdateCapabilitiesOnImplThread() {
+ DCHECK(IsImplThread());
+ UpdateCapabilitiesOnImplThread();
+ Proxy::MainThread()->PostTask(
+ base::Bind(&ThreadProxy::DidUpdateCapabilities,
+ main_thread_weak_ptr_,
+ layer_tree_host_impl_->GetRendererCapabilities()));
+}
+
+void ThreadProxy::DidUpdateCapabilities(
+ const RendererCapabilities& capabilities) {
+ DCHECK(IsMainThread());
+ renderer_capabilities_main_thread_copy_ = capabilities;
+ layer_tree_host_->DidUpdateCapabilities();
+}
+
void ThreadProxy::DidLoseOutputSurfaceOnImplThread() {
DCHECK(IsImplThread());
TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread");
@@ -1152,19 +1167,7 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread(
if (*success) {
*capabilities = layer_tree_host_impl_->GetRendererCapabilities();
- scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported(
- capabilities->using_swap_complete_callback);
-
- OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface();
- DCHECK(output_surface_ptr);
- int max_frames_pending =
- output_surface_ptr->capabilities().max_frames_pending;
- if (max_frames_pending <= 0)
- max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
- if (output_surface_ptr->capabilities().has_parent_compositor)
- max_frames_pending = 1;
-
- scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending);
+ UpdateCapabilitiesOnImplThread();
layer_tree_host_impl_->resource_provider()->
set_offscreen_context_provider(offscreen_context_provider);
@@ -1177,6 +1180,26 @@ void ThreadProxy::InitializeOutputSurfaceOnImplThread(
completion->Signal();
}
+void ThreadProxy::UpdateCapabilitiesOnImplThread() {
+ DCHECK(IsImplThread());
+
+ RendererCapabilities capabilities =
+ layer_tree_host_impl_->GetRendererCapabilities();
+ scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported(
+ capabilities.using_swap_complete_callback);
+
+ OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface();
+ DCHECK(output_surface_ptr);
+ int max_frames_pending =
+ output_surface_ptr->capabilities().max_frames_pending;
+ if (max_frames_pending <= 0)
+ max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
+ if (output_surface_ptr->capabilities().has_parent_compositor)
+ max_frames_pending = 1;
+
+ scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending);
+}
+
void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) {
TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
DCHECK(IsImplThread());

Powered by Google App Engine
This is Rietveld 408576698