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

Side by Side 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: with tests 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 unified diff | Download patch | Annotate | Revision Log
« cc/trees/single_thread_proxy.cc ('K') | « 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 base::Passed(&output_surface), 328 base::Passed(&output_surface),
329 offscreen_context_provider, 329 offscreen_context_provider,
330 &success, 330 &success,
331 &capabilities)); 331 &capabilities));
332 completion.Wait(); 332 completion.Wait();
333 } 333 }
334 334
335 OnOutputSurfaceInitializeAttempted(success, capabilities); 335 OnOutputSurfaceInitializeAttempted(success, capabilities);
336 } 336 }
337 337
338 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy(
339 const RendererCapabilities& capabilities) {
340 DCHECK(IsMainThread());
341 main().renderer_capabilities_main_thread_copy = capabilities;
342 layer_tree_host()->RendererCapabilitiesChanged();
343 }
344
338 void ThreadProxy::OnOutputSurfaceInitializeAttempted( 345 void ThreadProxy::OnOutputSurfaceInitializeAttempted(
339 bool success, 346 bool success,
340 const RendererCapabilities& capabilities) { 347 const RendererCapabilities& capabilities) {
341 DCHECK(IsMainThread()); 348 DCHECK(IsMainThread());
342 DCHECK(layer_tree_host()); 349 DCHECK(layer_tree_host());
343 350
351 LayerTreeHost::CreateResult result =
352 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success);
344 if (success) { 353 if (success) {
345 main().renderer_capabilities_main_thread_copy = capabilities; 354 SetRendererCapabilitiesMainThreadCopy(capabilities);
346 } 355 }
347 356
348 LayerTreeHost::CreateResult result =
349 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success);
350 if (result == LayerTreeHost::CreateFailedButTryAgain) { 357 if (result == LayerTreeHost::CreateFailedButTryAgain) {
351 if (!main().output_surface_creation_callback.callback().is_null()) { 358 if (!main().output_surface_creation_callback.callback().is_null()) {
352 Proxy::MainThreadTaskRunner()->PostTask( 359 Proxy::MainThreadTaskRunner()->PostTask(
353 FROM_HERE, main().output_surface_creation_callback.callback()); 360 FROM_HERE, main().output_surface_creation_callback.callback());
354 } 361 }
355 } else { 362 } else {
356 main().output_surface_creation_callback.Cancel(); 363 main().output_surface_creation_callback.Cancel();
357 } 364 }
358 } 365 }
359 366
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 main().can_cancel_commit = false; 408 main().can_cancel_commit = false;
402 409
403 if (main().commit_requested) 410 if (main().commit_requested)
404 return; 411 return;
405 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit"); 412 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit");
406 main().commit_requested = true; 413 main().commit_requested = true;
407 414
408 SendCommitRequestToImplThreadIfNeeded(); 415 SendCommitRequestToImplThreadIfNeeded();
409 } 416 }
410 417
418 void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
419 DCHECK(IsImplThread());
420 // PrioritizedResourceManager is not cleared, so this won't yet work with
421 // ContentLayer or ImageLayer, which are only used when impl_side_painting is
422 // off.
423 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting);
424
425 Proxy::MainThreadTaskRunner()->PostTask(
426 FROM_HERE,
427 base::Bind(&ThreadProxy::SetRendererCapabilitiesMainThreadCopy,
428 main_thread_weak_ptr_,
429 impl().layer_tree_host_impl->GetRendererCapabilities()
430 .MainThreadCapabilities()));
431 }
432
411 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { 433 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() {
412 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); 434 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread");
413 DCHECK(IsImplThread()); 435 DCHECK(IsImplThread());
414 CheckOutputSurfaceStatusOnImplThread(); 436 CheckOutputSurfaceStatusOnImplThread();
415 } 437 }
416 438
417 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { 439 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() {
418 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); 440 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread");
419 DCHECK(IsImplThread()); 441 DCHECK(IsImplThread());
420 if (!impl().layer_tree_host_impl->IsContextLost()) 442 if (!impl().layer_tree_host_impl->IsContextLost())
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 // to receive its callbacks before that. 974 // to receive its callbacks before that.
953 BlockingTaskRunner::CapturePostTasks blocked; 975 BlockingTaskRunner::CapturePostTasks blocked;
954 976
955 CompletionEvent completion; 977 CompletionEvent completion;
956 Proxy::ImplThreadTaskRunner()->PostTask( 978 Proxy::ImplThreadTaskRunner()->PostTask(
957 FROM_HERE, 979 FROM_HERE,
958 base::Bind(&ThreadProxy::StartCommitOnImplThread, 980 base::Bind(&ThreadProxy::StartCommitOnImplThread,
959 impl_thread_weak_ptr_, 981 impl_thread_weak_ptr_,
960 &completion, 982 &completion,
961 queue.release(), 983 queue.release(),
962 offscreen_context_provider)); 984 offscreen_context_provider,
985 main().renderer_capabilities_main_thread_copy));
963 completion.Wait(); 986 completion.Wait();
964 987
965 RenderingStatsInstrumentation* stats_instrumentation = 988 RenderingStatsInstrumentation* stats_instrumentation =
966 layer_tree_host()->rendering_stats_instrumentation(); 989 layer_tree_host()->rendering_stats_instrumentation();
967 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent( 990 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent(
968 stats_instrumentation->main_thread_rendering_stats()); 991 stats_instrumentation->main_thread_rendering_stats());
969 stats_instrumentation->AccumulateAndClearMainThreadStats(); 992 stats_instrumentation->AccumulateAndClearMainThreadStats();
970 } 993 }
971 994
972 layer_tree_host()->CommitComplete(); 995 layer_tree_host()->CommitComplete();
973 layer_tree_host()->DidBeginMainFrame(); 996 layer_tree_host()->DidBeginMainFrame();
974 } 997 }
975 998
976 void ThreadProxy::StartCommitOnImplThread( 999 void ThreadProxy::StartCommitOnImplThread(
977 CompletionEvent* completion, 1000 CompletionEvent* completion,
978 ResourceUpdateQueue* raw_queue, 1001 ResourceUpdateQueue* raw_queue,
979 scoped_refptr<ContextProvider> offscreen_context_provider) { 1002 scoped_refptr<ContextProvider> offscreen_context_provider,
1003 const RendererCapabilities& main_frame_renderer_caps) {
980 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); 1004 scoped_ptr<ResourceUpdateQueue> queue(raw_queue);
981 1005
982 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); 1006 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread");
983 DCHECK(!impl().commit_completion_event); 1007 DCHECK(!impl().commit_completion_event);
984 DCHECK(IsImplThread() && IsMainThreadBlocked()); 1008 DCHECK(IsImplThread() && IsMainThreadBlocked());
985 DCHECK(impl().scheduler); 1009 DCHECK(impl().scheduler);
986 DCHECK(impl().scheduler->CommitPending()); 1010 DCHECK(impl().scheduler->CommitPending());
987 1011
988 if (!impl().layer_tree_host_impl) { 1012 if (!impl().layer_tree_host_impl) {
989 TRACE_EVENT_INSTANT0( 1013 TRACE_EVENT_INSTANT0(
990 "cc", "EarlyOut_NoLayerTree", TRACE_EVENT_SCOPE_THREAD); 1014 "cc", "EarlyOut_NoLayerTree", TRACE_EVENT_SCOPE_THREAD);
991 completion->Signal(); 1015 completion->Signal();
992 return; 1016 return;
993 } 1017 }
994 1018
1019 const RendererCapabilitiesImpl& impl_caps =
1020 impl().layer_tree_host_impl->GetRendererCapabilities();
1021 if (!impl_caps.Equals(main_frame_renderer_caps)) {
1022 TRACE_EVENT_INSTANT0(
1023 "cc", "EarlyOut_StaleRendererCaps", TRACE_EVENT_SCOPE_THREAD);
1024 completion->Signal();
1025 bool did_handle = true;
1026 BeginMainFrameAbortedOnImplThread(did_handle);
1027 return;
1028 }
1029
995 if (offscreen_context_provider.get()) 1030 if (offscreen_context_provider.get())
996 offscreen_context_provider->BindToCurrentThread(); 1031 offscreen_context_provider->BindToCurrentThread();
997 impl().layer_tree_host_impl->SetOffscreenContextProvider( 1032 impl().layer_tree_host_impl->SetOffscreenContextProvider(
998 offscreen_context_provider); 1033 offscreen_context_provider);
999 1034
1000 if (impl().contents_texture_manager) { 1035 if (impl().contents_texture_manager) {
1001 DCHECK_EQ(impl().contents_texture_manager, 1036 DCHECK_EQ(impl().contents_texture_manager,
1002 blocked_main().contents_texture_manager()); 1037 blocked_main().contents_texture_manager());
1003 } else { 1038 } else {
1004 // Cache this pointer that was created on the main thread side to avoid a 1039 // Cache this pointer that was created on the main thread side to avoid a
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 impl().commit_to_activate_duration_history.InsertSample( 1747 impl().commit_to_activate_duration_history.InsertSample(
1713 base::TimeTicks::HighResNow() - impl().commit_complete_time); 1748 base::TimeTicks::HighResNow() - impl().commit_complete_time);
1714 } 1749 }
1715 1750
1716 void ThreadProxy::DidManageTiles() { 1751 void ThreadProxy::DidManageTiles() {
1717 DCHECK(IsImplThread()); 1752 DCHECK(IsImplThread());
1718 impl().scheduler->DidManageTiles(); 1753 impl().scheduler->DidManageTiles();
1719 } 1754 }
1720 1755
1721 } // namespace cc 1756 } // namespace cc
OLDNEW
« 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