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

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: fix win compile by including ContextProvider from output_surface_client.h 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
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
1168 offscreen_context_provider->BindToCurrentThread();
1169
1170 if (*success) { 1167 if (*success) {
1171 *capabilities = layer_tree_host_impl_->GetRendererCapabilities(); 1168 *capabilities = layer_tree_host_impl_->GetRendererCapabilities();
1172 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported( 1169 scheduler_on_impl_thread_->SetSwapBuffersCompleteSupported(
1173 capabilities->using_swap_complete_callback); 1170 capabilities->using_swap_complete_callback);
1174 1171
1175 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface(); 1172 OutputSurface* output_surface_ptr = layer_tree_host_impl_->output_surface();
1176 DCHECK(output_surface_ptr); 1173 DCHECK(output_surface_ptr);
1177 int max_frames_pending = 1174 int max_frames_pending =
1178 output_surface_ptr->capabilities().max_frames_pending; 1175 output_surface_ptr->capabilities().max_frames_pending;
1179 if (max_frames_pending <= 0) 1176 if (max_frames_pending <= 0)
1180 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING; 1177 max_frames_pending = FrameRateController::DEFAULT_MAX_FRAMES_PENDING;
1181 if (output_surface_ptr->capabilities().has_parent_compositor) 1178 if (output_surface_ptr->capabilities().has_parent_compositor)
1182 max_frames_pending = 1; 1179 max_frames_pending = 1;
1183 1180
1184 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending); 1181 scheduler_on_impl_thread_->SetMaxFramesPending(max_frames_pending);
1185 1182
1186 if (layer_tree_host_impl_->resource_provider()) 1183 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
1187 layer_tree_host_impl_->resource_provider()-> 1184 }
1188 set_offscreen_context_provider(offscreen_context_provider);
1189 1185
1190 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); 1186 DidTryInitializeRendererOnImplThread(*success, offscreen_context_provider);
1191 } else if (offscreen_context_provider.get()) {
1192 offscreen_context_provider->VerifyContexts();
1193 }
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())
1198 offscreen_context_provider->BindToCurrentThread();
1199
1200 if (success) {
1201 DCHECK_EQ(layer_tree_host_impl_->GetRendererCapabilities()
1202 .using_swap_complete_callback,
1203 scheduler_on_impl_thread_->swap_buffers_complete_supported());
1204 if (layer_tree_host_impl_->resource_provider()) {
1205 layer_tree_host_impl_->resource_provider()->
1206 set_offscreen_context_provider(offscreen_context_provider);
1207 }
1208 } else if (offscreen_context_provider.get()) {
1209 offscreen_context_provider->VerifyContexts();
1210 }
1211 }
1212
1198 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) { 1213 void ThreadProxy::FinishGLOnImplThread(CompletionEvent* completion) {
1199 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread"); 1214 TRACE_EVENT0("cc", "ThreadProxy::FinishGLOnImplThread");
1200 DCHECK(IsImplThread()); 1215 DCHECK(IsImplThread());
1201 if (layer_tree_host_impl_->resource_provider()) 1216 if (layer_tree_host_impl_->resource_provider())
1202 layer_tree_host_impl_->resource_provider()->Finish(); 1217 layer_tree_host_impl_->resource_provider()->Finish();
1203 completion->Signal(); 1218 completion->Signal();
1204 } 1219 }
1205 1220
1206 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1221 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1207 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1222 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 !layer_tree_host_impl_->pending_tree()) { 1392 !layer_tree_host_impl_->pending_tree()) {
1378 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation", 1393 TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation",
1379 TRACE_EVENT_SCOPE_THREAD); 1394 TRACE_EVENT_SCOPE_THREAD);
1380 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); 1395 DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
1381 completion_event_for_commit_held_on_tree_activation_->Signal(); 1396 completion_event_for_commit_held_on_tree_activation_->Signal();
1382 completion_event_for_commit_held_on_tree_activation_ = NULL; 1397 completion_event_for_commit_held_on_tree_activation_ = NULL;
1383 } 1398 }
1384 } 1399 }
1385 1400
1386 } // namespace cc 1401 } // namespace cc
OLDNEW
« 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