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

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 14772021: cc::OutputSurfaceClient::InitializeForGL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Do not update caps in DidTryInitializeRendererOnImplThread Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/thread_proxy.h" 5 #include "cc/trees/thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/base/thread.h" 10 #include "cc/base/thread.h"
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 DCHECK(IsImplThread()); 1157 DCHECK(IsImplThread());
1158 DCHECK(IsMainThreadBlocked()); 1158 DCHECK(IsMainThreadBlocked());
1159 DCHECK(success); 1159 DCHECK(success);
1160 DCHECK(capabilities); 1160 DCHECK(capabilities);
1161 1161
1162 layer_tree_host_->DeleteContentsTexturesOnImplThread( 1162 layer_tree_host_->DeleteContentsTexturesOnImplThread(
1163 layer_tree_host_impl_->resource_provider()); 1163 layer_tree_host_impl_->resource_provider());
1164 1164
1165 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); 1165 *success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass());
1166 1166
1167 if (offscreen_context_provider.get()) 1167 DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider);
1168 offscreen_context_provider->BindToCurrentThread();
1169 1168
1170 if (*success) { 1169 if (*success) {
1171 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); 1170 *capabilities = layer_tree_host_impl_->GetRendererCapabilities();
1172 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( 1171 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported(
1173 capabilities->using_swap_complete_callback); 1172 capabilities->using_swap_complete_callback);
1174 1173
1175 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); 1174 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface();
1176 DCHECK(output_surface_ptr); 1175 DCHECK(output_surface_ptr);
1177 int max_frames_pending = 1176 int max_frames_pending =
1178 output_surface_ptr->capabilities().max_frames_pending; 1177 output_surface_ptr->capabilities().max_frames_pending;
1179 if (max_frames_pending <= 0) 1178 if (max_frames_pending <= 0)
1180 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; 1179 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
1181 if (output_surface_ptr->capabilities().has_parent_compositor) 1180 if (output_surface_ptr->capabilities().has_parent_compositor)
1182 max_frames_pending = 1; 1181 max_frames_pending = 1;
1183 1182
1184 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); 1183 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending);
1185 1184
1186 if (layer_tree_host_impl_->resource_provider())
1187 layer_tree_host_impl_->resource_provider()->
1188 set_offscreen_context_provider(offscreen_context_provider);
1189
1190 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); 1185 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
1191 } else if (offscreen_context_provider.get()) {
1192 offscreen_context_provider->VerifyContexts();
1193 } 1186 }
1194 1187
1195 completion->Signal(); 1188 completion->Signal();
1196 } 1189 }
1197 1190
1191 void ThreadProxy::DidTryInitializeRendererOnImplThread(
1192 bool success,
1193 scoped_refptr<ContextProvider> offscreen_context_provider) {
1194 DCHECK(IsImplThread());
1195 DCHECK(!inside_draw_);
1196
1197 if (offscreen_context_provider.get())
boliu 2013/06/06 19:27:14 Moved everything back to InitializeOutputSurfaceOn
danakj 2013/06/06 19:36:13 You could add a getter to the scheduler to dcheck
1198 offscreen_context_provider->BindToCurrentThread();
1199
1200 if (success) {
1201 if (layer_tree_host_impl_->resource_provider()) {
1202 layer_tree_host_impl_->resource_provider()->
1203 set_offscreen_context_provider(offscreen_context_provider);
1204 }
1205 } else if (offscreen_context_provider.get()) {
1206 offscreen_context_provider->VerifyContexts();
1207 }
1208 }
1209
1198 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { 1210 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) {
1199 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); 1211 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
1200 DCHECK(IsImplThread()); 1212 DCHECK(IsImplThread());
1201 if (layer_tree_host_impl_->resource_provider()) 1213 if (layer_tree_host_impl_->resource_provider())
1202 layer_tree_host_impl_->resource_provider()->Finish(); 1214 layer_tree_host_impl_->resource_provider()->Finish();
1203 completion->Signal(); 1215 completion->Signal();
1204 } 1216 }
1205 1217
1206 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1218 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1207 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1219 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 !layer_tree_host_impl_->pending_tree()) { 1389 !layer_tree_host_impl_->pending_tree()) {
1378 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", 1390 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation",
1379 TRACE_EVENT_SCOPE_THREAD); 1391 TRACE_EVENT_SCOPE_THREAD);
1380 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); 1392 DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
1381 completion_event_for_commit_held_on_tree_activation_->Signal(); 1393 completion_event_for_commit_held_on_tree_activation_->Signal();
1382 completion_event_for_commit_held_on_tree_activation_ = NULL; 1394 completion_event_for_commit_held_on_tree_activation_ = NULL;
1383 } 1395 }
1384 } 1396 }
1385 1397
1386 } // namespace cc 1398 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_unittest.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