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

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: UpdateRendererCapabilitiesOnImplThread in CreateAndSetRenderer 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 base::Passed(&output_surface), 331 base::Passed(&output_surface),
332 offscreen_context_provider, 332 offscreen_context_provider,
333 &success, 333 &success,
334 &capabilities)); 334 &capabilities));
335 completion.Wait(); 335 completion.Wait();
336 } 336 }
337 337
338 OnOutputSurfaceInitializeAttempted(success, capabilities); 338 OnOutputSurfaceInitializeAttempted(success, capabilities);
339 } 339 }
340 340
341 void ThreadProxy::SetRendererCapabilitiesMainThreadCopy(
342 const RendererCapabilities& capabilities) {
343 DCHECK(IsMainThread());
344 if (main().renderer_capabilities_main_thread_copy == capabilities)
345 return;
346
347 main().renderer_capabilities_main_thread_copy = capabilities;
348 layer_tree_host()->RendererCapabilitiesChanged();
349 }
350
341 void ThreadProxy::OnOutputSurfaceInitializeAttempted( 351 void ThreadProxy::OnOutputSurfaceInitializeAttempted(
342 bool success, 352 bool success,
343 const RendererCapabilities& capabilities) { 353 const RendererCapabilities& capabilities) {
344 DCHECK(IsMainThread()); 354 DCHECK(IsMainThread());
345 DCHECK(layer_tree_host()); 355 DCHECK(layer_tree_host());
346 356
347 if (success) {
348 main().renderer_capabilities_main_thread_copy = capabilities;
349 }
350
351 LayerTreeHost::CreateResult result = 357 LayerTreeHost::CreateResult result =
352 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success); 358 layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(success);
359 main().renderer_capabilities_main_thread_copy = capabilities;
360 layer_tree_host()->RendererCapabilitiesChanged();
361
353 if (result == LayerTreeHost::CreateFailedButTryAgain) { 362 if (result == LayerTreeHost::CreateFailedButTryAgain) {
354 if (!main().output_surface_creation_callback.callback().is_null()) { 363 if (!main().output_surface_creation_callback.callback().is_null()) {
355 Proxy::MainThreadTaskRunner()->PostTask( 364 Proxy::MainThreadTaskRunner()->PostTask(
356 FROM_HERE, main().output_surface_creation_callback.callback()); 365 FROM_HERE, main().output_surface_creation_callback.callback());
357 } 366 }
358 } else { 367 } else {
359 main().output_surface_creation_callback.Cancel(); 368 main().output_surface_creation_callback.Cancel();
360 } 369 }
361 } 370 }
362 371
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 main().can_cancel_commit = false; 413 main().can_cancel_commit = false;
405 414
406 if (main().commit_requested) 415 if (main().commit_requested)
407 return; 416 return;
408 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit"); 417 TRACE_EVENT0("cc", "ThreadProxy::SetNeedsCommit");
409 main().commit_requested = true; 418 main().commit_requested = true;
410 419
411 SendCommitRequestToImplThreadIfNeeded(); 420 SendCommitRequestToImplThreadIfNeeded();
412 } 421 }
413 422
423 void ThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
424 DCHECK(IsImplThread());
425 Proxy::MainThreadTaskRunner()->PostTask(
426 FROM_HERE,
427 base::Bind(&ThreadProxy::SetRendererCapabilitiesMainThreadCopy,
428 main_thread_weak_ptr_,
429 impl()
430 .layer_tree_host_impl->GetRendererCapabilities()
431 .MainThreadCapabilities()));
432 }
433
414 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() { 434 void ThreadProxy::DidLoseOutputSurfaceOnImplThread() {
415 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread"); 435 TRACE_EVENT0("cc", "ThreadProxy::DidLoseOutputSurfaceOnImplThread");
416 DCHECK(IsImplThread()); 436 DCHECK(IsImplThread());
417 CheckOutputSurfaceStatusOnImplThread(); 437 CheckOutputSurfaceStatusOnImplThread();
418 } 438 }
419 439
420 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() { 440 void ThreadProxy::CheckOutputSurfaceStatusOnImplThread() {
421 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread"); 441 TRACE_EVENT0("cc", "ThreadProxy::CheckOutputSurfaceStatusOnImplThread");
422 DCHECK(IsImplThread()); 442 DCHECK(IsImplThread());
423 if (!impl().layer_tree_host_impl->IsContextLost()) 443 if (!impl().layer_tree_host_impl->IsContextLost())
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 impl().commit_to_activate_duration_history.InsertSample( 1734 impl().commit_to_activate_duration_history.InsertSample(
1715 base::TimeTicks::HighResNow() - impl().commit_complete_time); 1735 base::TimeTicks::HighResNow() - impl().commit_complete_time);
1716 } 1736 }
1717 1737
1718 void ThreadProxy::DidManageTiles() { 1738 void ThreadProxy::DidManageTiles() {
1719 DCHECK(IsImplThread()); 1739 DCHECK(IsImplThread());
1720 impl().scheduler->DidManageTiles(); 1740 impl().scheduler->DidManageTiles();
1721 } 1741 }
1722 1742
1723 } // namespace cc 1743 } // 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