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

Side by Side Diff: trunk/src/cc/trees/single_thread_proxy.cc

Issue 103163003: Revert 238458 "cc: Defer first OutputSurface creation until clie..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | « trunk/src/cc/trees/single_thread_proxy.h ('k') | trunk/src/cc/trees/thread_proxy.h » ('j') | 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 26 matching lines...) Expand all
37 inside_draw_(false) { 37 inside_draw_(false) {
38 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 38 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
39 DCHECK(Proxy::IsMainThread()); 39 DCHECK(Proxy::IsMainThread());
40 DCHECK(layer_tree_host); 40 DCHECK(layer_tree_host);
41 41
42 // Impl-side painting not supported without threaded compositing. 42 // Impl-side painting not supported without threaded compositing.
43 CHECK(!layer_tree_host->settings().impl_side_painting) 43 CHECK(!layer_tree_host->settings().impl_side_painting)
44 << "Threaded compositing must be enabled to use impl-side painting."; 44 << "Threaded compositing must be enabled to use impl-side painting.";
45 } 45 }
46 46
47 void SingleThreadProxy::Start() { 47 void SingleThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) {
48 DCHECK(first_output_surface);
48 DebugScopedSetImplThread impl(this); 49 DebugScopedSetImplThread impl(this);
49 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 50 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
51 first_output_surface_ = first_output_surface.Pass();
50 } 52 }
51 53
52 SingleThreadProxy::~SingleThreadProxy() { 54 SingleThreadProxy::~SingleThreadProxy() {
53 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); 55 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
54 DCHECK(Proxy::IsMainThread()); 56 DCHECK(Proxy::IsMainThread());
55 // Make sure Stop() got called or never Started. 57 // Make sure Stop() got called or never Started.
56 DCHECK(!layer_tree_host_impl_); 58 DCHECK(!layer_tree_host_impl_);
57 } 59 }
58 60
59 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) { 61 bool SingleThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 106
105 // Changing visibility could change ShouldComposite(). 107 // Changing visibility could change ShouldComposite().
106 UpdateBackgroundAnimateTicking(); 108 UpdateBackgroundAnimateTicking();
107 } 109 }
108 110
109 void SingleThreadProxy::CreateAndInitializeOutputSurface() { 111 void SingleThreadProxy::CreateAndInitializeOutputSurface() {
110 TRACE_EVENT0( 112 TRACE_EVENT0(
111 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface"); 113 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface");
112 DCHECK(Proxy::IsMainThread()); 114 DCHECK(Proxy::IsMainThread());
113 115
114 scoped_ptr<OutputSurface> output_surface = 116 scoped_ptr<OutputSurface> output_surface = first_output_surface_.Pass();
115 layer_tree_host_->CreateOutputSurface(); 117 if (!output_surface)
118 output_surface = layer_tree_host_->CreateOutputSurface();
116 if (!output_surface) { 119 if (!output_surface) {
117 OnOutputSurfaceInitializeAttempted(false); 120 OnOutputSurfaceInitializeAttempted(false);
118 return; 121 return;
119 } 122 }
120 123
121 scoped_refptr<cc::ContextProvider> offscreen_context_provider; 124 scoped_refptr<cc::ContextProvider> offscreen_context_provider;
122 if (created_offscreen_context_provider_) { 125 if (created_offscreen_context_provider_) {
123 offscreen_context_provider = 126 offscreen_context_provider =
124 layer_tree_host_->client()->OffscreenContextProvider(); 127 layer_tree_host_->client()->OffscreenContextProvider();
125 if (!offscreen_context_provider.get() || 128 if (!offscreen_context_provider.get() ||
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 void SingleThreadProxy::DidSwapFrame() { 548 void SingleThreadProxy::DidSwapFrame() {
546 if (next_frame_is_newly_committed_frame_) { 549 if (next_frame_is_newly_committed_frame_) {
547 next_frame_is_newly_committed_frame_ = false; 550 next_frame_is_newly_committed_frame_ = false;
548 layer_tree_host_->DidCommitAndDrawFrame(); 551 layer_tree_host_->DidCommitAndDrawFrame();
549 } 552 }
550 } 553 }
551 554
552 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 555 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
553 556
554 } // namespace cc 557 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/trees/single_thread_proxy.h ('k') | trunk/src/cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698