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

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

Issue 24078024: cc: Return resources to child compositor via a Callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: deletechild: No AndReceiveAck needed, change STP Created 7 years, 3 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/layer_tree_host_unittest_delegated.cc ('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/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/output/context_provider.h" 9 #include "cc/output/context_provider.h"
10 #include "cc/output/output_surface.h" 10 #include "cc/output/output_surface.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (created_offscreen_context_provider_) { 118 if (created_offscreen_context_provider_) {
119 offscreen_context_provider = 119 offscreen_context_provider =
120 layer_tree_host_->client()->OffscreenContextProviderForMainThread(); 120 layer_tree_host_->client()->OffscreenContextProviderForMainThread();
121 if (!offscreen_context_provider.get()) { 121 if (!offscreen_context_provider.get()) {
122 OnOutputSurfaceInitializeAttempted(false); 122 OnOutputSurfaceInitializeAttempted(false);
123 return; 123 return;
124 } 124 }
125 } 125 }
126 126
127 { 127 {
128 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); 128 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
129 DebugScopedSetImplThread impl(this); 129 DebugScopedSetImplThread impl(this);
130 layer_tree_host_->DeleteContentsTexturesOnImplThread( 130 layer_tree_host_->DeleteContentsTexturesOnImplThread(
131 layer_tree_host_impl_->resource_provider()); 131 layer_tree_host_impl_->resource_provider());
132 } 132 }
133 133
134 bool initialized; 134 bool initialized;
135 { 135 {
136 DebugScopedSetImplThread impl(this); 136 DebugScopedSetImplThread impl(this);
137 137
138 DCHECK(output_surface); 138 DCHECK(output_surface);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 void SingleThreadProxy::SetNeedsUpdateLayers() { 176 void SingleThreadProxy::SetNeedsUpdateLayers() {
177 DCHECK(Proxy::IsMainThread()); 177 DCHECK(Proxy::IsMainThread());
178 layer_tree_host_->ScheduleComposite(); 178 layer_tree_host_->ScheduleComposite();
179 } 179 }
180 180
181 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { 181 void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
182 DCHECK(Proxy::IsMainThread()); 182 DCHECK(Proxy::IsMainThread());
183 // Commit immediately. 183 // Commit immediately.
184 { 184 {
185 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); 185 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
186 DebugScopedSetImplThread impl(this); 186 DebugScopedSetImplThread impl(this);
187 187
188 // This CapturePostTasks should be destroyed before CommitComplete() is 188 // This CapturePostTasks should be destroyed before CommitComplete() is
189 // called since that goes out to the embedder, and we want the embedder 189 // called since that goes out to the embedder, and we want the embedder
190 // to receive its callbacks before that. 190 // to receive its callbacks before that.
191 BlockingTaskRunner::CapturePostTasks blocked; 191 BlockingTaskRunner::CapturePostTasks blocked;
192 192
193 RenderingStatsInstrumentation* stats_instrumentation = 193 RenderingStatsInstrumentation* stats_instrumentation =
194 layer_tree_host_->rendering_stats_instrumentation(); 194 layer_tree_host_->rendering_stats_instrumentation();
195 base::TimeTicks start_time = stats_instrumentation->StartRecording(); 195 base::TimeTicks start_time = stats_instrumentation->StartRecording();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool SingleThreadProxy::CommitRequested() const { return false; } 256 bool SingleThreadProxy::CommitRequested() const { return false; }
257 257
258 size_t SingleThreadProxy::MaxPartialTextureUpdates() const { 258 size_t SingleThreadProxy::MaxPartialTextureUpdates() const {
259 return std::numeric_limits<size_t>::max(); 259 return std::numeric_limits<size_t>::max();
260 } 260 }
261 261
262 void SingleThreadProxy::Stop() { 262 void SingleThreadProxy::Stop() {
263 TRACE_EVENT0("cc", "SingleThreadProxy::stop"); 263 TRACE_EVENT0("cc", "SingleThreadProxy::stop");
264 DCHECK(Proxy::IsMainThread()); 264 DCHECK(Proxy::IsMainThread());
265 { 265 {
266 DebugScopedSetMainThreadBlocked mainThreadBlocked(this); 266 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
267 DebugScopedSetImplThread impl(this); 267 DebugScopedSetImplThread impl(this);
268 268
269 layer_tree_host_->DeleteContentsTexturesOnImplThread( 269 layer_tree_host_->DeleteContentsTexturesOnImplThread(
270 layer_tree_host_impl_->resource_provider()); 270 layer_tree_host_impl_->resource_provider());
271 layer_tree_host_impl_.reset(); 271 layer_tree_host_impl_.reset();
272 } 272 }
273 layer_tree_host_ = NULL; 273 layer_tree_host_ = NULL;
274 } 274 }
275 275
276 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { 276 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 // Called by the legacy scheduling path (e.g. where render_widget does the 358 // Called by the legacy scheduling path (e.g. where render_widget does the
359 // scheduling) 359 // scheduling)
360 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { 360 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
361 gfx::Rect device_viewport_damage_rect; 361 gfx::Rect device_viewport_damage_rect;
362 362
363 LayerTreeHostImpl::FrameData frame; 363 LayerTreeHostImpl::FrameData frame;
364 if (CommitAndComposite(frame_begin_time, 364 if (CommitAndComposite(frame_begin_time,
365 device_viewport_damage_rect, 365 device_viewport_damage_rect,
366 false, // for_readback 366 false, // for_readback
367 &frame)) { 367 &frame)) {
368 layer_tree_host_impl_->SwapBuffers(frame); 368 {
369 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
370 DebugScopedSetImplThread impl(this);
371
372 // This CapturePostTasks should be destroyed before
373 // DidCommitAndDrawFrame() is called since that goes out to the embedder,
374 // and we want the embedder to receive its callbacks before that.
375 // NOTE: This maintains consistent ordering with the ThreadProxy since
376 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread
377 // there as the main thread is not blocked, so any posted tasks inside
378 // the swap buffers will execute first.
379 BlockingTaskRunner::CapturePostTasks blocked;
380
381 layer_tree_host_impl_->SwapBuffers(frame);
382 }
369 DidSwapFrame(); 383 DidSwapFrame();
370 } 384 }
371 } 385 }
372 386
373 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const { 387 scoped_ptr<base::Value> SingleThreadProxy::AsValue() const {
374 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 388 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
375 { 389 {
376 // The following line casts away const modifiers because it is just 390 // The following line casts away const modifiers because it is just
377 // setting debug state. We still want the AsValue() function and its 391 // setting debug state. We still want the AsValue() function and its
378 // call chain to be const throughout. 392 // call chain to be const throughout.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 void SingleThreadProxy::DidSwapFrame() { 520 void SingleThreadProxy::DidSwapFrame() {
507 if (next_frame_is_newly_committed_frame_) { 521 if (next_frame_is_newly_committed_frame_) {
508 next_frame_is_newly_committed_frame_ = false; 522 next_frame_is_newly_committed_frame_ = false;
509 layer_tree_host_->DidCommitAndDrawFrame(); 523 layer_tree_host_->DidCommitAndDrawFrame();
510 } 524 }
511 } 525 }
512 526
513 bool SingleThreadProxy::CommitPendingForTesting() { return false; } 527 bool SingleThreadProxy::CommitPendingForTesting() { return false; }
514 528
515 } // namespace cc 529 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_delegated.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698