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

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: cancel commits with stale caps, no tests yet 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
« 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 <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 // We don't clear PrioritizedResourceManager.
421 DCHECK(impl().layer_tree_host_impl->settings().impl_side_painting);
422
423 Proxy::MainThreadTaskRunner()->PostTask(
424 FROM_HERE,
425 base::Bind(&ThreadProxy::SetRendererCapabilitiesMainThreadCopy,
426 main_thread_weak_ptr_,
427 impl().layer_tree_host_impl->GetRendererCapabilities()
428 .MainThreadCapabilities()));
429 }
430
411 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { 431 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() {
412 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); 432 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread");
413 DCHECK(IsImplThread()); 433 DCHECK(IsImplThread());
414 CheckOutputSurfaceStatusOnImplThread(); 434 CheckOutputSurfaceStatusOnImplThread();
415 } 435 }
416 436
417 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { 437 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() {
418 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); 438 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread");
419 DCHECK(IsImplThread()); 439 DCHECK(IsImplThread());
420 if (!impl().layer_tree_host_impl->IsContextLost()) 440 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. 972 // to receive its callbacks before that.
953 BlockingTaskRunner::CapturePostTasks blocked; 973 BlockingTaskRunner::CapturePostTasks blocked;
954 974
955 CompletionEvent completion; 975 CompletionEvent completion;
956 Proxy::ImplThreadTaskRunner()->PostTask( 976 Proxy::ImplThreadTaskRunner()->PostTask(
957 FROM_HERE, 977 FROM_HERE,
958 base::Bind(&ThreadProxy::StartCommitOnImplThread, 978 base::Bind(&ThreadProxy::StartCommitOnImplThread,
959 impl_thread_weak_ptr_, 979 impl_thread_weak_ptr_,
960 &completion, 980 &completion,
961 queue.release(), 981 queue.release(),
962 offscreen_context_provider)); 982 offscreen_context_provider,
983 main().renderer_capabilities_main_thread_copy));
963 completion.Wait(); 984 completion.Wait();
964 985
965 RenderingStatsInstrumentation* stats_instrumentation = 986 RenderingStatsInstrumentation* stats_instrumentation =
966 layer_tree_host()->rendering_stats_instrumentation(); 987 layer_tree_host()->rendering_stats_instrumentation();
967 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent( 988 BenchmarkInstrumentation::IssueMainThreadRenderingStatsEvent(
968 stats_instrumentation->main_thread_rendering_stats()); 989 stats_instrumentation->main_thread_rendering_stats());
969 stats_instrumentation->AccumulateAndClearMainThreadStats(); 990 stats_instrumentation->AccumulateAndClearMainThreadStats();
970 } 991 }
971 992
972 layer_tree_host()->CommitComplete(); 993 layer_tree_host()->CommitComplete();
973 layer_tree_host()->DidBeginMainFrame(); 994 layer_tree_host()->DidBeginMainFrame();
974 } 995 }
975 996
976 void ThreadProxy::StartCommitOnImplThread( 997 void ThreadProxy::StartCommitOnImplThread(
977 CompletionEvent* completion, 998 CompletionEvent* completion,
978 ResourceUpdateQueue* raw_queue, 999 ResourceUpdateQueue* raw_queue,
979 scoped_refptr<ContextProvider> offscreen_context_provider) { 1000 scoped_refptr<ContextProvider> offscreen_context_provider,
1001 const RendererCapabilities& main_frame_renderer_caps) {
980 scoped_ptr<ResourceUpdateQueue> queue(raw_queue); 1002 scoped_ptr<ResourceUpdateQueue> queue(raw_queue);
981 1003
982 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread"); 1004 TRACE_EVENT0("cc", "ThreadProxy::StartCommitOnImplThread");
983 DCHECK(!impl().commit_completion_event); 1005 DCHECK(!impl().commit_completion_event);
984 DCHECK(IsImplThread() && IsMainThreadBlocked()); 1006 DCHECK(IsImplThread() && IsMainThreadBlocked());
985 DCHECK(impl().scheduler); 1007 DCHECK(impl().scheduler);
986 DCHECK(impl().scheduler->CommitPending()); 1008 DCHECK(impl().scheduler->CommitPending());
987 1009
988 if (!impl().layer_tree_host_impl) { 1010 if (!impl().layer_tree_host_impl) {
989 TRACE_EVENT_INSTANT0( 1011 TRACE_EVENT_INSTANT0(
990 "cc", "EarlyOut_NoLayerTree", TRACE_EVENT_SCOPE_THREAD); 1012 "cc", "EarlyOut_NoLayerTree", TRACE_EVENT_SCOPE_THREAD);
991 completion->Signal(); 1013 completion->Signal();
992 return; 1014 return;
993 } 1015 }
994 1016
1017 const RendererCapabilitiesImpl& impl_caps =
1018 impl().layer_tree_host_impl->GetRendererCapabilities();
1019 if (!impl_caps.Equals(main_frame_renderer_caps)) {
1020 TRACE_EVENT_INSTANT0(
1021 "cc", "EarlyOut_StaleRendererCaps", TRACE_EVENT_SCOPE_THREAD);
boliu 2014/02/07 04:29:55 TEST!
1022 completion->Signal();
1023 bool did_handle = true;
1024 BeginMainFrameAbortedOnImplThread(did_handle);
1025 return;
1026 }
1027
995 if (offscreen_context_provider.get()) 1028 if (offscreen_context_provider.get())
996 offscreen_context_provider->BindToCurrentThread(); 1029 offscreen_context_provider->BindToCurrentThread();
997 impl().layer_tree_host_impl->SetOffscreenContextProvider( 1030 impl().layer_tree_host_impl->SetOffscreenContextProvider(
998 offscreen_context_provider); 1031 offscreen_context_provider);
999 1032
1000 if (impl().contents_texture_manager) { 1033 if (impl().contents_texture_manager) {
1001 DCHECK_EQ(impl().contents_texture_manager, 1034 DCHECK_EQ(impl().contents_texture_manager,
1002 blocked_main().contents_texture_manager()); 1035 blocked_main().contents_texture_manager());
1003 } else { 1036 } else {
1004 // Cache this pointer that was created on the main thread side to avoid a 1037 // 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( 1745 impl().commit_to_activate_duration_history.InsertSample(
1713 base::TimeTicks::HighResNow() - impl().commit_complete_time); 1746 base::TimeTicks::HighResNow() - impl().commit_complete_time);
1714 } 1747 }
1715 1748
1716 void ThreadProxy::DidManageTiles() { 1749 void ThreadProxy::DidManageTiles() {
1717 DCHECK(IsImplThread()); 1750 DCHECK(IsImplThread());
1718 impl().scheduler->DidManageTiles(); 1751 impl().scheduler->DidManageTiles();
1719 } 1752 }
1720 1753
1721 } // namespace cc 1754 } // 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